Module: Admin::ActivityTypeFieldHelper

Includes:
IsActiveColumnHelper
Included in:
AdjustmentsHelper, LaborsHelper, MaterialsHelper, ProposalsHelper
Defined in:
app/helpers/admin/activity_type_field_helper.rb

Instance Method Summary collapse

Instance Method Details

#client_form_column(record, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/admin/activity_type_field_helper.rb', line 5

def client_form_column(record, options) 
  select_tag(
    options[:name], 
    options_for_select(
      (Client.find(
        :all, 
        :select => 'id, company_name', 
        :order => 'company_name ASC'
      ).collect {|c| [ c.company_name, c.id ] })+[['(Select Client)',nil]],
      record.activity.client_id
    ),
    options_for_column('client')
  )
end

#comments_form_column(record, options) ⇒ Object

Not all the activities have this, but many do:



41
42
43
# File 'app/helpers/admin/activity_type_field_helper.rb', line 41

def comments_form_column(record,options)
  text_area_tag options[:name], record.comments, :cols => 80, :rows => 22, :id => "record_comments_#{record.id}"
end

#cost_column(record) ⇒ Object



24
25
26
# File 'app/helpers/admin/activity_type_field_helper.rb', line 24

def cost_column(record)
  h_money (record.cost) ? record.cost : Money.new(0)
end

#cost_form_column(record, options) ⇒ Object



32
33
34
# File 'app/helpers/admin/activity_type_field_helper.rb', line 32

def cost_form_column(record,options)
  text_field_tag options[:name], (@record.cost.nil?) ? nil : ("%.2f" % @record.cost), :size => 10, :id => "record_cost_#{record.id}"
end

#occurred_on_form_column(record, options) ⇒ Object



20
21
22
# File 'app/helpers/admin/activity_type_field_helper.rb', line 20

def occurred_on_form_column(record, options)
  datetime_select "record", "occurred_on"
end

#tax_column(record) ⇒ Object



28
29
30
# File 'app/helpers/admin/activity_type_field_helper.rb', line 28

def tax_column(record)
  h_money (record.tax) ? record.tax : Money.new(0)
end

#tax_form_column(record, options) ⇒ Object



36
37
38
# File 'app/helpers/admin/activity_type_field_helper.rb', line 36

def tax_form_column(record,options)
  text_field_tag options[:name], (@record.tax.nil?) ? nil : ("%.2f" % @record.tax), :size => 10, :id => "record_tax_#{record.id}"
end