Module: Admin::ActivitiesHelper
- Includes:
- ActivityTaxFieldHelper, ExtensibleObjectHelper
- Defined in:
- app/helpers/admin/activities_helper/slimtimer_helper.rb,
app/helpers/admin/activities_helper/proposal_helper.rb,
app/helpers/admin/activities_helper/labor_helper.rb,
app/helpers/admin/activities_helper.rb
Instance Method Summary collapse
-
#active_scaffold_input_for(column, scope = nil) ⇒ Object
Form Helper Routing:.
- #active_scaffold_observe_field(col_name, observation) ⇒ Object
- #activity_client_id_form_column(record, options) ⇒ Object
- #activity_comments_form_column(record, options) ⇒ Object
- #activity_cost_column(record) ⇒ Object
-
#activity_cost_form_column(record, options) ⇒ Object
Generic helpers:.
- #activity_duration_form_column(record, input_name) ⇒ Object
- #activity_employee_id_form_column(record, input_name) ⇒ Object
- #activity_label_form_column(record, options) ⇒ Object
- #activity_proposed_on_form_column(record, options) ⇒ Object
- #activity_slimtimer_task_form_column(record, input_name) ⇒ Object
- #activity_tax_column(record) ⇒ Object
- #column_class(column, column_value) ⇒ Object
- #get_column_value(record, column) ⇒ Object
- #override_form_field(column) ⇒ Object
-
#render_list_column(text, column, record) ⇒ Object
List Helpers:.
- #submit_tag(*args) ⇒ Object
Methods included from ExtensibleObjectHelper
Instance Method Details
#active_scaffold_input_for(column, scope = nil) ⇒ Object
Form Helper Routing:
55 56 57 |
# File 'app/helpers/admin/activities_helper.rb', line 55 def active_scaffold_input_for(column, scope = nil) super column, scope unless column.name == :activity end |
#active_scaffold_observe_field(col_name, observation) ⇒ Object
8 9 10 11 12 13 |
# File 'app/helpers/admin/activities_helper.rb', line 8 def active_scaffold_observe_field(col_name, observation) # This is slightly hackish - but it should work # We Make sure we're supposed to be rendering here based on the :for_activities option (observation[:for_activities].include? @record.activity_type) ? super(col_name, observation) : String.new end |
#activity_client_id_form_column(record, options) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/helpers/admin/activities_helper.rb', line 71 def activity_client_id_form_column(record, ) select_tag( [:name], ( # NOTE: We don't do a find_active here, but see the conditions... [ ['(Unknown)', nil] ]+Client.find( :all, :select => 'id, company_name', :order => 'company_name ASC', :conditions => ['is_active = ? OR id = ?', true, @record.client_id] ).collect {|c| [ c.company_name, c.id ] }, @record.client_id ), ('client_id') ) end |
#activity_comments_form_column(record, options) ⇒ Object
24 25 26 |
# File 'app/helpers/admin/activities_helper/labor_helper.rb', line 24 def activity_comments_form_column(record, input_name) text_area_tag input_name, @record.sub_activity.comments, ('comments').merge({:cols => 72, :rows => 20}) end |
#activity_cost_column(record) ⇒ Object
46 47 48 |
# File 'app/helpers/admin/activities_helper.rb', line 46 def activity_cost_column(record) h_money record.cost end |
#activity_cost_form_column(record, options) ⇒ Object
Generic helpers:
67 68 69 |
# File 'app/helpers/admin/activities_helper.rb', line 67 def activity_cost_form_column(record, ) text_field_tag [:name], money_for_input(@record.cost), ('cost').merge({:size => 10 }) end |
#activity_duration_form_column(record, input_name) ⇒ Object
20 21 22 |
# File 'app/helpers/admin/activities_helper/labor_helper.rb', line 20 def activity_duration_form_column(record, input_name) text_field_tag input_name, @record.labor.clock_duration, ('duration').merge({:size => 10}) end |
#activity_employee_id_form_column(record, input_name) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/helpers/admin/activities_helper/labor_helper.rb', line 3 def activity_employee_id_form_column(record, input_name) select_tag( input_name, ( # NOTE: We don't do a find_active here, but see the conditions... Employee.find( :all, :select => 'id, first_name, last_name', :order => 'last_name ASC, last_name ASC', :conditions => ['is_active = ? OR id = ?', true, @record.labor.employee_id] ).collect {|e| [ e.name, e.id ] }, @record.labor.employee_id ), ('employee_id') ) end |
#activity_label_form_column(record, options) ⇒ Object
88 89 90 91 92 |
# File 'app/helpers/admin/activities_helper.rb', line 88 def activity_label_form_column(record, ) label_value = (@record.respond_to?(@record.activity_type)) ? @record.send("#{@record.activity_type}").label : nil text_field_tag [:name], label_value, ('label').merge({:size => 30 }) end |
#activity_proposed_on_form_column(record, options) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/admin/activities_helper/proposal_helper.rb', line 3 def activity_proposed_on_form_column(record, ) # Super-ghetto hack @proposal = record.proposal input(:proposal,'proposed_on').gsub(/proposal(\[proposed_on\([\d]+i\)\])/m, 'record\1') #/Super Ghetto end |
#activity_slimtimer_task_form_column(record, input_name) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/admin/activities_helper/slimtimer_helper.rb', line 3 def activity_slimtimer_task_form_column(record, input_name) begin slimtimer_task_name = @record.labor.slimtimer_time_entry.slimtimer_task.name rescue slimtimer_task_name = 'None' end '<span class="slimtimer_task">('+h(slimtimer_task_name)+')</span>' end |
#activity_tax_column(record) ⇒ Object
50 51 52 |
# File 'app/helpers/admin/activities_helper.rb', line 50 def activity_tax_column(record) h_money record.tax end |
#column_class(column, column_value) ⇒ Object
40 41 42 43 44 |
# File 'app/helpers/admin/activities_helper.rb', line 40 def column_class(column, column_value) return super unless column.name == :activity "#{column.name}-column" end |
#get_column_value(record, column) ⇒ Object
34 35 36 37 38 |
# File 'app/helpers/admin/activities_helper.rb', line 34 def get_column_value(record, column) return super unless column.name == :activity nil end |
#override_form_field(column) ⇒ Object
15 16 17 18 19 |
# File 'app/helpers/admin/activities_helper.rb', line 15 def override_form_field(*args) ret = super(*args) ret end |
#render_list_column(text, column, record) ⇒ Object
List Helpers:
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/admin/activities_helper.rb', line 22 def render_list_column(text, column, record) return super unless column.name == :activity activity_partial = "#{record.activity_type}_column" if FileTest.exists? "#{activity_partial_path}/_#{activity_partial}.html.erb" render :partial => activity_partial, :locals => { :record => record } else '-' end end |
#submit_tag(*args) ⇒ Object
100 101 102 103 |
# File 'app/helpers/admin/activities_helper.rb', line 100 def submit_tag(*args) args[0] = 'Approve' if args[0] == 'Update' and (!params.has_key?(:nested) or params[:nested] == false) super(*args) end |