Module: PhantomHelpers::ViewHelpers::ExtrasHelper

Defined in:
lib/phantom_helpers/view_helpers/extras_helper.rb

Instance Method Summary collapse

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)
   :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_fieldObject



5
6
7
8
9
# File 'lib/phantom_helpers/view_helpers/extras_helper.rb', line 5

def drag_field
   :td, class: 'sort-handler' do
     :i, nil, class: 'icon-move'
  end
end

#required_fieldObject



11
12
13
# File 'lib/phantom_helpers/view_helpers/extras_helper.rb', line 11

def required_field
   :span, t(:required), class: 'label label-important pull-right'
end