From a55227c9bbf69dec43643566014448da5e49343e Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Fri, 7 Aug 2009 10:42:03 -0700 Subject: [PATCH] [#2863] Split the single deliverable template into 3 partials. --- app/views/deliverables/_deliverable.html.erb | 89 +------------------ .../_deliverable_description_row.html.erb | 6 ++ .../_deliverable_details_row.html.erb | 65 ++++++++++++++ .../_deliverable_summary_row.html.erb | 15 ++++ 4 files changed, 89 insertions(+), 86 deletions(-) create mode 100644 app/views/deliverables/_deliverable_description_row.html.erb create mode 100644 app/views/deliverables/_deliverable_details_row.html.erb create mode 100644 app/views/deliverables/_deliverable_summary_row.html.erb diff --git a/app/views/deliverables/_deliverable.html.erb b/app/views/deliverables/_deliverable.html.erb index ad96098..2fcb60b 100644 --- a/app/views/deliverables/_deliverable.html.erb +++ b/app/views/deliverables/_deliverable.html.erb @@ -1,87 +1,4 @@ <% css = cycle('odd','even') %> - - - <%= toggle_arrows(deliverable.id) %> - - - <%= content_tag(:td, deliverable.id) %> - <%= content_tag(:td, h(deliverable.score.to_i), :class => 'score') if allowed_management? %> - <%= content_tag(:td, h(deliverable.subject), :class => 'subject') %> - <%= content_tag(:td, number_to_currency(deliverable.budget || 0.0, :precision => 0), :class => 'budget') if allowed_management? %> - <%= content_tag(:td, number_to_currency(deliverable.labor_budget || 0.0, :precision => 0), :class => 'budget') if allowed_management? %> - <%= content_tag(:td, number_to_currency(deliverable.spent, :precision => 0), :class => 'spent') if allowed_management? %> - <%= content_tag(:td, format_date(deliverable.due), :class => 'due_date') %> - <%= content_tag(:td, progress_bar(deliverable.progress, :width => '100%', :class => 'done_ratio')) %> - <%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_summary_row, { :deliverable => deliverable }) %> - - - - <%= content_tag(:p,link_to(l(:button_edit), :action => 'edit', :id => @project.id, :deliverable_id => deliverable.id)) if allowed_management? -%> - <%= content_tag(:p,link_to(l(:button_delete), { :action => 'destroy', :id => @project.id, :deliverable_id => deliverable.id}, :confirm => l(:text_are_you_sure))) if allowed_management? %> - <%= content_tag(:p,link_to(l(:label_issue_plural), :action => 'issues', :id => @project.id, :deliverable_id => deliverable.id)) -%> - <% if allowed_management? && @project.versions.size > 0 %> -
- <% form_for :deliverable, deliverable, :url => { :action => "bulk_assign_issues", :id => @project.id, :deliverable_id => deliverable.id} do |f| %> - - <%= select("version", "id", @project.versions.sort.collect {|v| [v.name, v.id ] }, { :prompt => '-- Version --' }) %>
- <%= submit_tag(l(:label_bulk_assign)) %> - <% end %> -
- <% end %> - - - - - <%= row_with_double_data l(:label_progress), number_to_percentage(deliverable.progress, :precision => 0), '' %> - <% if allowed_management? %> - - <% if deliverable.hourly? %> - <%= row_with_double_data l(:label_hours_estimated), number_with_precision(deliverable.total_hours, 0), '' %> - <% end %> - <% if deliverable.fixed? %> - <%= row_with_double_data l(:label_fixed_amount), '', number_to_currency(deliverable.fixed_cost, :precision => 0) %> - <% end %> - - <% if deliverable.hours_used > 0 %> - <%= row_with_double_data l(:label_hours_used), number_with_precision(deliverable.hours_used,0), number_to_currency(deliverable.spent_by_members, :precision => 0) %> - - - - <% deliverable.members_spent.each do |person| %> - <%= row_with_double_data(h(person.user.name), person.hours.round, number_to_currency(person.spent, :precision => 0)) %> - <% end %> - <% end %> - <% end %> -
 
- - - - - <%= row_with_data(l(:field_budget), number_to_currency(deliverable.budget, :precision => 0)) -%> - <% if allowed_management? %> - <% base_price_label = deliverable.hourly? ? l(:label_labor) : l(:label_fixed_amount) %> - <%= row_with_data(base_price_label, number_to_currency(deliverable.labor_budget || 0.0, :precision => 0)) -%> - <%= row_with_data(l(:label_overhead), number_or_percent(deliverable.overhead, deliverable.overhead_percent)) -%> - <%= row_with_data(l(:label_materials), number_or_percent(deliverable.materials, deliverable.materials_percent)) -%> - <%= row_with_data(l(:label_potential_profit), number_or_percent(deliverable.profit, deliverable.profit_percent)) -%> - <% end %> -
- - - - - <%= row_with_data(l(:label_issue_plural), deliverable.issues.size, 'issue-totals') -%> - - <% deliverable.issues_with_trackers.each do |tracker_name, count| %> - <%= row_with_data(h(tracker_name), count,'issue-totals') -%> - <% end %> -
- - <%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_details_row, { :deliverable => deliverable }) %> - - - - <%= l(:field_description) %>: <%= textilizable deliverable.description %> - - <%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_description_row, { :deliverable => deliverable }) %> - +<%= render :partial => 'deliverable_summary_row', :locals => {:deliverable => deliverable, :css => css} %> +<%= render :partial => 'deliverable_details_row', :locals => {:deliverable => deliverable, :css => css} %> +<%= render :partial => 'deliverable_description_row', :locals => {:deliverable => deliverable, :css => css} %> diff --git a/app/views/deliverables/_deliverable_description_row.html.erb b/app/views/deliverables/_deliverable_description_row.html.erb new file mode 100644 index 0000000..160aa20 --- /dev/null +++ b/app/views/deliverables/_deliverable_description_row.html.erb @@ -0,0 +1,6 @@ + + + <%= l(:field_description) %>: <%= textilizable deliverable.description %> + + <%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_description_row, { :deliverable => deliverable }) %> + diff --git a/app/views/deliverables/_deliverable_details_row.html.erb b/app/views/deliverables/_deliverable_details_row.html.erb new file mode 100644 index 0000000..1322dbf --- /dev/null +++ b/app/views/deliverables/_deliverable_details_row.html.erb @@ -0,0 +1,65 @@ + + + <%= content_tag(:p,link_to(l(:button_edit), :action => 'edit', :id => @project.id, :deliverable_id => deliverable.id)) if allowed_management? -%> + <%= content_tag(:p,link_to(l(:button_delete), { :action => 'destroy', :id => @project.id, :deliverable_id => deliverable.id}, :confirm => l(:text_are_you_sure))) if allowed_management? %> + <%= content_tag(:p,link_to(l(:label_issue_plural), :action => 'issues', :id => @project.id, :deliverable_id => deliverable.id)) -%> + <% if allowed_management? && @project.versions.size > 0 %> +
+ <% form_for :deliverable, deliverable, :url => { :action => "bulk_assign_issues", :id => @project.id, :deliverable_id => deliverable.id} do |f| %> + + <%= select("version", "id", @project.versions.sort.collect {|v| [v.name, v.id ] }, { :prompt => '-- Version --' }) %>
+ <%= submit_tag(l(:label_bulk_assign)) %> + <% end %> +
+ <% end %> + + + + + <%= row_with_double_data l(:label_progress), number_to_percentage(deliverable.progress, :precision => 0), '' %> + <% if allowed_management? %> + + <% if deliverable.hourly? %> + <%= row_with_double_data l(:label_hours_estimated), number_with_precision(deliverable.total_hours, 0), '' %> + <% end %> + <% if deliverable.fixed? %> + <%= row_with_double_data l(:label_fixed_amount), '', number_to_currency(deliverable.fixed_cost, :precision => 0) %> + <% end %> + + <% if deliverable.hours_used > 0 %> + <%= row_with_double_data l(:label_hours_used), number_with_precision(deliverable.hours_used,0), number_to_currency(deliverable.spent_by_members, :precision => 0) %> + + + + <% deliverable.members_spent.each do |person| %> + <%= row_with_double_data(h(person.user.name), person.hours.round, number_to_currency(person.spent, :precision => 0)) %> + <% end %> + <% end %> + <% end %> +
 
+ + + + + <%= row_with_data(l(:field_budget), number_to_currency(deliverable.budget, :precision => 0)) -%> + <% if allowed_management? %> + <% base_price_label = deliverable.hourly? ? l(:label_labor) : l(:label_fixed_amount) %> + <%= row_with_data(base_price_label, number_to_currency(deliverable.labor_budget || 0.0, :precision => 0)) -%> + <%= row_with_data(l(:label_overhead), number_or_percent(deliverable.overhead, deliverable.overhead_percent)) -%> + <%= row_with_data(l(:label_materials), number_or_percent(deliverable.materials, deliverable.materials_percent)) -%> + <%= row_with_data(l(:label_potential_profit), number_or_percent(deliverable.profit, deliverable.profit_percent)) -%> + <% end %> +
+ + + + + <%= row_with_data(l(:label_issue_plural), deliverable.issues.size, 'issue-totals') -%> + + <% deliverable.issues_with_trackers.each do |tracker_name, count| %> + <%= row_with_data(h(tracker_name), count,'issue-totals') -%> + <% end %> +
+ + <%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_details_row, { :deliverable => deliverable }) %> + diff --git a/app/views/deliverables/_deliverable_summary_row.html.erb b/app/views/deliverables/_deliverable_summary_row.html.erb new file mode 100644 index 0000000..b700b2c --- /dev/null +++ b/app/views/deliverables/_deliverable_summary_row.html.erb @@ -0,0 +1,15 @@ + + + <%= toggle_arrows(deliverable.id) %> + + + <%= content_tag(:td, deliverable.id) %> + <%= content_tag(:td, h(deliverable.score.to_i), :class => 'score') if allowed_management? %> + <%= content_tag(:td, h(deliverable.subject), :class => 'subject') %> + <%= content_tag(:td, number_to_currency(deliverable.budget || 0.0, :precision => 0), :class => 'budget') if allowed_management? %> + <%= content_tag(:td, number_to_currency(deliverable.labor_budget || 0.0, :precision => 0), :class => 'budget') if allowed_management? %> + <%= content_tag(:td, number_to_currency(deliverable.spent, :precision => 0), :class => 'spent') if allowed_management? %> + <%= content_tag(:td, format_date(deliverable.due), :class => 'due_date') %> + <%= content_tag(:td, progress_bar(deliverable.progress, :width => '100%', :class => 'done_ratio')) %> + <%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_summary_row, { :deliverable => deliverable }) %> + \ No newline at end of file