[#4183] Show budget fields on a single line: one for spent, one for budget.
This commit is contained in:
1 parent
44664edf30
commit
3d4e71ff93
4 files changed
+49
-44
No files matched your search
@@ -39,6 +39,21 @@ module ContractsHelper
|
|||||||
html_options)
|
html_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_budget_field(object, spent_field, total_field, options={})
|
||||||
|
html_options = options[:html_options] || {}
|
||||||
|
label = content_tag(:span, l(("field_" + spent_field.to_s.gsub(/\_id$/, "")).to_sym) + ": ")
|
||||||
|
|
||||||
|
spent_content = number_to_currency(object.send(spent_field))
|
||||||
|
total_content = number_to_currency(object.send(total_field))
|
||||||
|
|
||||||
|
content_tag(:p,
|
||||||
|
label +
|
||||||
|
content_tag(:span, h(spent_content), :class => 'spent') +
|
||||||
|
content_tag(:span, h(total_content), :class => 'budget'),
|
||||||
|
html_options)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def format_hourly_rate(decimal)
|
def format_hourly_rate(decimal)
|
||||||
number_to_currency(decimal) + "/hr" if decimal
|
number_to_currency(decimal) + "/hr" if decimal
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,12 +8,9 @@
|
|||||||
<%= show_field(resource, :start_date, :format => :format_date, :html_options => {:class => 'contract-start-date'}) %>
|
<%= show_field(resource, :start_date, :format => :format_date, :html_options => {:class => 'contract-start-date'}) %>
|
||||||
<%= show_field(resource, :end_date, :format => :format_date, :html_options => {:class => 'contract-end-date'}) %>
|
<%= show_field(resource, :end_date, :format => :format_date, :html_options => {:class => 'contract-end-date'}) %>
|
||||||
|
|
||||||
<%= show_field(resource, :labor_spent, :html_options => {:class => 'contract-labor-spent'}) %>
|
<%= show_budget_field(resource, :labor_spent, :labor_budget, :html_options => {:class => 'contract-labor'}) %>
|
||||||
<%= show_field(resource, :labor_budget, :html_options => {:class => 'contract-labor-budget'}) %>
|
<%= show_budget_field(resource, :overhead_spent, :overhead_budget, :html_options => {:class => 'contract-overhead'}) %>
|
||||||
<%= show_field(resource, :overhead_spent, :html_options => {:class => 'contract-overhead-spent'}) %>
|
<%= show_budget_field(resource, :total_spent, :total_budget, :html_options => {:class => 'contract-total'}) %>
|
||||||
<%= show_field(resource, :overhead_budget, :html_options => {:class => 'contract-overhead-budget'}) %>
|
|
||||||
<%= show_field(resource, :total_spent, :html_options => {:class => 'contract-total-spent'}) %>
|
|
||||||
<%= show_field(resource, :total_budget, :html_options => {:class => 'contract-total-budget'}) %>
|
|
||||||
|
|
||||||
<div id="contract-terms">
|
<div id="contract-terms">
|
||||||
<%= show_field(resource, :client_point_of_contact, :html_options => {:class => 'contract-client-point-of-contact'}) %>
|
<%= show_field(resource, :client_point_of_contact, :html_options => {:class => 'contract-client-point-of-contact'}) %>
|
||||||
@@ -24,24 +21,16 @@
|
|||||||
<%= show_field(resource, :po_number, :html_options => {:class => 'contract-po-number'}) %>
|
<%= show_field(resource, :po_number, :html_options => {:class => 'contract-po-number'}) %>
|
||||||
<%= show_field(resource, :details, :html_options => {:class => 'contract-details'}) %>
|
<%= show_field(resource, :details, :html_options => {:class => 'contract-details'}) %>
|
||||||
|
|
||||||
<%= show_field(resource, :labor_spent, :html_options => {:class => 'contract-labor-spent'}) %>
|
<%= show_budget_field(resource, :labor_spent, :labor_budget, :html_options => {:class => 'contract-labor'}) %>
|
||||||
<%= show_field(resource, :labor_budget, :html_options => {:class => 'contract-labor-budget'}) %>
|
<%= show_budget_field(resource, :overhead_spent, :overhead_budget, :html_options => {:class => 'contract-overhead'}) %>
|
||||||
<%= show_field(resource, :overhead_spent, :html_options => {:class => 'contract-overhead-spent'}) %>
|
<%= show_budget_field(resource, :fixed_spent, :fixed_budget, :html_options => {:class => 'contract-fixed'}) %>
|
||||||
<%= show_field(resource, :overhead_budget, :html_options => {:class => 'contract-overhead-budget'}) %>
|
<%= show_budget_field(resource, :markup_spent, :markup_budget, :html_options => {:class => 'contract-markup'}) %>
|
||||||
<%= show_field(resource, :fixed_spent, :html_options => {:class => 'contract-fixed-spent'}) %>
|
<%= show_budget_field(resource, :profit_spent, :profit_budget, :html_options => {:class => 'contract-profit'}) %>
|
||||||
<%= show_field(resource, :fixed_budget, :html_options => {:class => 'contract-fixed-budget'}) %>
|
<%= show_budget_field(resource, :discount_spent, :discount_budget, :html_options => {:class => 'contract-discount'}) %>
|
||||||
<%= show_field(resource, :markup_spent, :html_options => {:class => 'contract-markup-spent'}) %>
|
<%= show_budget_field(resource, :total_spent, :total_budget, :html_options => {:class => 'contract-total'}) %>
|
||||||
<%= show_field(resource, :markup_budget, :html_options => {:class => 'contract-markup-budget'}) %>
|
|
||||||
<%= show_field(resource, :profit_spent, :html_options => {:class => 'contract-profit-spent'}) %>
|
|
||||||
<%= show_field(resource, :profit_budget, :html_options => {:class => 'contract-profit-budget'}) %>
|
|
||||||
<%= show_field(resource, :discount_spent, :html_options => {:class => 'contract-discount-spent'}) %>
|
|
||||||
<%= show_field(resource, :discount_budget, :html_options => {:class => 'contract-discount-budget'}) %>
|
|
||||||
<%= show_field(resource, :total_spent, :html_options => {:class => 'contract-total-spent'}) %>
|
|
||||||
<%= show_field(resource, :total_budget, :html_options => {:class => 'contract-total-budget'}) %>
|
|
||||||
|
|
||||||
<%= show_field(resource, :billable_rate, :format => :format_hourly_rate, :html_options => {:class => 'contract-billable-rate'}) %>
|
<%= show_field(resource, :billable_rate, :format => :format_hourly_rate, :html_options => {:class => 'contract-billable-rate'}) %>
|
||||||
<%= show_field(resource, :estimated_hour_spent, :html_options => {:class => 'contract-estimated-hour-spent'}) %>
|
<%= show_budget_field(resource, :estimated_hour_spent, :estimated_hour_budget, :html_options => {:class => 'contract-estimated-hour'}) %>
|
||||||
<%= show_field(resource, :estimated_hour_budget, :html_options => {:class => 'contract-estimated-hour-budget'}) %>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -26,3 +26,4 @@ a.contract-delete {color: red; }
|
|||||||
|
|
||||||
#deliverables td.labor, #deliverables td.overhead, #deliverables td.fixed { text-align: center; }
|
#deliverables td.labor, #deliverables td.overhead, #deliverables td.fixed { text-align: center; }
|
||||||
#deliverables td.labor div, #deliverables td.overhead div, #deliverables td.fixed div { text-align: right; display: inline; padding: 0 5px; width: 50%; }
|
#deliverables td.labor div, #deliverables td.overhead div, #deliverables td.fixed div { text-align: right; display: inline; padding: 0 5px; width: 50%; }
|
||||||
|
.spent, .budget { text-align: right; padding: 0 5px; }
|
||||||
@@ -30,12 +30,12 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
assert_select '.contract-start-date'
|
assert_select '.contract-start-date'
|
||||||
assert_select '.contract-end-date'
|
assert_select '.contract-end-date'
|
||||||
|
|
||||||
assert_select '.contract-labor-spent'
|
assert_select '.contract-labor .spent'
|
||||||
assert_select '.contract-labor-budget'
|
assert_select '.contract-labor .budget'
|
||||||
assert_select '.contract-overhead-spent'
|
assert_select '.contract-overhead .spent'
|
||||||
assert_select '.contract-overhead-budget'
|
assert_select '.contract-overhead .budget'
|
||||||
assert_select '.contract-total-spent'
|
assert_select '.contract-total .spent'
|
||||||
assert_select '.contract-total-budget'
|
assert_select '.contract-total .budget'
|
||||||
|
|
||||||
assert_select '#contract-terms' do
|
assert_select '#contract-terms' do
|
||||||
assert_select '.contract-client-point-of-contact'
|
assert_select '.contract-client-point-of-contact'
|
||||||
@@ -46,25 +46,25 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
assert_select '.contract-po-number'
|
assert_select '.contract-po-number'
|
||||||
assert_select '.contract-details'
|
assert_select '.contract-details'
|
||||||
|
|
||||||
assert_select '.contract-labor-spent'
|
assert_select '.contract-labor .spent'
|
||||||
assert_select '.contract-labor-budget'
|
assert_select '.contract-labor .budget'
|
||||||
assert_select '.contract-overhead-spent'
|
assert_select '.contract-overhead .spent'
|
||||||
assert_select '.contract-overhead-budget'
|
assert_select '.contract-overhead .budget'
|
||||||
assert_select '.contract-fixed-spent'
|
assert_select '.contract-fixed .spent'
|
||||||
assert_select '.contract-fixed-budget'
|
assert_select '.contract-fixed .budget'
|
||||||
assert_select '.contract-markup-spent'
|
assert_select '.contract-markup .spent'
|
||||||
assert_select '.contract-markup-budget'
|
assert_select '.contract-markup .budget'
|
||||||
assert_select '.contract-profit-spent'
|
assert_select '.contract-profit .spent'
|
||||||
assert_select '.contract-profit-budget'
|
assert_select '.contract-profit .budget'
|
||||||
assert_select '.contract-discount-spent'
|
assert_select '.contract-discount .spent'
|
||||||
assert_select '.contract-discount-budget'
|
assert_select '.contract-discount .budget'
|
||||||
assert_select '.contract-total-spent'
|
assert_select '.contract-total .spent'
|
||||||
assert_select '.contract-total-budget'
|
assert_select '.contract-total .budget'
|
||||||
|
|
||||||
assert_select '.contract-billable-rate'
|
assert_select '.contract-billable-rate'
|
||||||
|
|
||||||
assert_select '.contract-estimated-hour-spent'
|
assert_select '.contract-estimated-hour .spent'
|
||||||
assert_select '.contract-estimated-hour-budget'
|
assert_select '.contract-estimated-hour .budget'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user