Module: PhantomHelpers::ViewHelpers::ExtrasHelper
- Defined in:
- lib/phantom_helpers/view_helpers/extras_helper.rb
Instance Method Summary collapse
- #color_code(color) ⇒ Object
- #comma_separated_list(objects, &block) ⇒ Object
- #datepicker_date_format(date) ⇒ Object
- #drag_field ⇒ Object
- #required_field ⇒ Object
Instance Method Details
#color_code(color) ⇒ Object
15 16 17 |
# File 'lib/phantom_helpers/view_helpers/extras_helper.rb', line 15 def color_code(color) content_tag :div, nil, style: "width:100px;height:20px;background-color:#{color}" end |
#comma_separated_list(objects, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/phantom_helpers/view_helpers/extras_helper.rb', line 23 def comma_separated_list(objects, &block) if objects.any? objects.map do |object| block_given? ? block.call(object) : object end.join(', ').html_safe else t(:empty) end end |
#datepicker_date_format(date) ⇒ Object
19 20 21 |
# File 'lib/phantom_helpers/view_helpers/extras_helper.rb', line 19 def datepicker_date_format(date) date ? date.strftime('%Y-%m-%d') : Time.now.strftime('%Y-%m-%d') end |
#drag_field ⇒ Object
5 6 7 8 9 |
# File 'lib/phantom_helpers/view_helpers/extras_helper.rb', line 5 def drag_field content_tag :td, class: 'sort-handler' do content_tag :i, nil, class: 'icon-move' end end |
#required_field ⇒ Object
11 12 13 |
# File 'lib/phantom_helpers/view_helpers/extras_helper.rb', line 11 def required_field content_tag :span, t(:required), class: 'label label-important pull-right' end |