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
- #duration_column(record) ⇒ Object
- #slimtimer_task_form_column(record, input_name) ⇒ Object
- #to_money(val) ⇒ Object
Methods included from ExtensibleObjectHelper
Instance Method Details
#duration_column(record) ⇒ Object
5 6 7 |
# File 'app/helpers/admin/labors_helper.rb', line 5 def duration_column(record) h record.friendly_duration end |
#slimtimer_task_form_column(record, input_name) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/admin/labors_helper/slimtimer_helper.rb', line 3 def slimtimer_task_form_column(record, input_name) 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
9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/admin/labors_helper.rb', line 9 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 |