Module: Admin::LaborsHelper

Includes:
ActivityTypeFieldHelper, ExtensibleObjectHelper
Defined in:
app/helpers/admin/labors_helper/slimtimer_helper.rb,
app/helpers/admin/labors_helper.rb

Instance Method Summary collapse

Methods included from ExtensibleObjectHelper

append_features

Instance Method Details

#activity_labor_duration_column(record) ⇒ Object



16
17
18
# File 'app/helpers/admin/labors_helper.rb', line 16

def activity_labor_duration_column(record)
  h record.friendly_duration
end

#activity_labor_slimtimer_task_form_column(record, options) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/helpers/admin/labors_helper/slimtimer_helper.rb', line 3

def activity_labor_slimtimer_task_form_column(record, options)
  begin
    slimtimer_task_name = @record.slimtimer_time_entry.slimtimer_task.name
  rescue
    slimtimer_task_name = 'None'
  end
  
  '<span class="slimtimer_task">('+h(slimtimer_task_name)+')</span>'
end

#to_money(val) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'app/helpers/admin/labors_helper.rb', line 20

def to_money(val)
  raise StandardError if nil
  raise StandardError if val.class.to_s == 'String' and !/^[\-]?(?:[\d]+|[\d]+\.[\d]+|\.[\d]+)$/.match(val)
  
  "%.2f" % val.to_f
  
  rescue
    nil
end