From aaa3a23d2c7ae6de40006edf70124caba9ca578e Mon Sep 17 00:00:00 2001 From: "t.felgentreff" Date: Wed, 30 Jun 2010 13:04:52 +0000 Subject: [PATCH] move method to helper git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1263 7926756e-e54e-46e6-9721-ed318f58905e --- app/helpers/reporting_helper.rb | 22 ++++++++++++++++ .../cost_reports/_cost_report_table.rhtml | 25 +------------------ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/app/helpers/reporting_helper.rb b/app/helpers/reporting_helper.rb index 9c80f4b4f9..f74759c2f8 100644 --- a/app/helpers/reporting_helper.rb +++ b/app/helpers/reporting_helper.rb @@ -10,4 +10,26 @@ module ReportingHelper {:name => :operators, :filter_name => filter.underscore_name, :operators => filter.available_operators}, {:name => :multi_values, :filter_name => filter.underscore_name, :values => filter.available_values}] end + + ## + # For a given row, determine how to render it's contents according to usability and + # localization rules + def show_row(row) + row.render do |key, value| + case key.to_sym + when :project_id then "Project ##{value}: #{Project.find(value.to_i).name}" + when :user_id then link_to_user User.find(value) + when :tyear then value + when :tweek then + if value.to_i == Date.today.cweek + l(:label_this_week) + elsif value.to_i == (Date.today.cweek - 1) + l(:label_last_week) + else + "#{l(:label_week)} ##{value}" + end + else "#{key}: #{value}" + end + end + end end \ No newline at end of file diff --git a/app/views/cost_reports/_cost_report_table.rhtml b/app/views/cost_reports/_cost_report_table.rhtml index 9b5548fc5a..fe53c085d3 100644 --- a/app/views/cost_reports/_cost_report_table.rhtml +++ b/app/views/cost_reports/_cost_report_table.rhtml @@ -1,27 +1,4 @@ -<% # FIXME: Move this somewhere safe - - ## - # For a given row, determine how to render it's contents according to usability and - # localization rules - def show_row(row) - row.render do |key, value| - case key.to_sym - when :project_id then "Project ##{value}: #{Project.find(value.to_i).name}" - when :user_id then link_to_user User.find(value) - when :tyear then value - when :tweek then - if value.to_i == Date.today.cweek - l(:label_this_week).capitalize - elsif value.to_i == (Date.today.cweek - 1) - l(:label_last_week).capitalize - else - "#{l(:label_week)} ##{value}" - end - else "#{key}: #{value}" - end - end - end - +<% walker.for_final_row do |row, cells| "#{show_row row}" << cells.join << "#{row.real_costs} €" end