[#4183] Add all the fields for the Contract metadata with TODOs.

This commit is contained in:
Eric Davis
2010-07-07 14:57:05 -07:00
parent e199c77bae
commit 44664edf30
5 changed files with 147 additions and 11 deletions
+28
View File
@@ -14,4 +14,32 @@ module ContractsHelper
'---'
end
end
# Simple helper to show the values of a field on an object in a standard format
#
# <p>
# <span>Label: </span>
# Field value
# </p>
def show_field(object, field, options={})
html_options = options[:html_options] || {}
label = content_tag(:span, l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym) + ": ")
formatter = options[:format]
content = if formatter
send(formatter, object.send(field))
else
object.send(field)
end
content_tag(:p,
label +
h(content),
html_options)
end
def format_hourly_rate(decimal)
number_to_currency(decimal) + "/hr" if decimal
end
end
+9
View File
@@ -29,6 +29,15 @@ class Contract < ActiveRecord::Base
attr_accessible :po_number
attr_accessible :details
[:status, :contract_type, :labor_spent, :labor_budget, :overhead_spent,
:overhead_budget, :fixed_spent, :fixed_budget, :total_spent, :total_budget,
:markup_spent, :markup_budget, :profit_spent, :profit_budget,
:discount_spent, :discount_budget, :client_point_of_contact,
:estimated_hour_spent, :estimated_hour_budget
].each do |mthd|
define_method(mthd) { "TODO" }
end
PaymentTerms = {
:net_0 => :text_payment_terms_net_0,
:net_15 => :text_payment_terms_net_15,
+43 -11
View File
@@ -1,17 +1,49 @@
<%# TODO: Need skinning %>
<% div_for(resource) do %>
<%= content_tag(:h2, h(resource.name)) %>
<%= content_tag(:p, h(resource.account_executive)) %>
<%= content_tag(:p, h(resource.executed)) %>
<%= content_tag(:p, format_date(resource.start_date)) %>
<%= content_tag(:p, format_date(resource.end_date)) %>
<%= content_tag(:p, h(resource.billable_rate)) %>
<%= content_tag(:p, h(resource.discount)) %>
<%= content_tag(:p, h(resource.discount_note)) %>
<%= content_tag(:p, h(resource.payment_terms)) %>
<%= content_tag(:p, h(resource.client_ap_contact_information)) %>
<%= content_tag(:p, h(resource.po_number)) %>
<%= content_tag(:p, h(resource.details)) %>
<%= show_field(resource, :status, :html_options => {:class => 'contract-status'}) %>
<%= show_field(resource, :account_executive, :html_options => {:class => 'contract-account-manager'}) %>
<%= show_field(resource, :contract_type, :html_options => {:class => 'contract-type'}) %>
<%= 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, :labor_spent, :html_options => {:class => 'contract-labor-spent'}) %>
<%= show_field(resource, :labor_budget, :html_options => {:class => 'contract-labor-budget'}) %>
<%= show_field(resource, :overhead_spent, :html_options => {:class => 'contract-overhead-spent'}) %>
<%= 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">
<%= show_field(resource, :client_point_of_contact, :html_options => {:class => 'contract-client-point-of-contact'}) %>
<%= show_field(resource, :executed, :html_options => {:class => 'contract-executed'}) %>
<%= show_field(resource, :discount_note, :html_options => {:class => 'contract-discount-note'}) %>
<%= show_field(resource, :payment_terms, :html_options => {:class => 'contract-payment-terms'}) %>
<%= show_field(resource, :client_ap_contact_information, :html_options => {:class => 'contract-client-ap-contact-information'}) %>
<%= show_field(resource, :po_number, :html_options => {:class => 'contract-po-number'}) %>
<%= show_field(resource, :details, :html_options => {:class => 'contract-details'}) %>
<%= show_field(resource, :labor_spent, :html_options => {:class => 'contract-labor-spent'}) %>
<%= show_field(resource, :labor_budget, :html_options => {:class => 'contract-labor-budget'}) %>
<%= show_field(resource, :overhead_spent, :html_options => {:class => 'contract-overhead-spent'}) %>
<%= show_field(resource, :overhead_budget, :html_options => {:class => 'contract-overhead-budget'}) %>
<%= show_field(resource, :fixed_spent, :html_options => {:class => 'contract-fixed-spent'}) %>
<%= show_field(resource, :fixed_budget, :html_options => {:class => 'contract-fixed-budget'}) %>
<%= show_field(resource, :markup_spent, :html_options => {:class => 'contract-markup-spent'}) %>
<%= 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, :estimated_hour_spent, :html_options => {:class => 'contract-estimated-hour-spent'}) %>
<%= show_field(resource, :estimated_hour_budget, :html_options => {:class => 'contract-estimated-hour-budget'}) %>
</div>
<% end %>
<%= link_to(l(:button_update), edit_contract_path(@project, resource)) %>