Module: DryAdmin::ResourcesHelper

Defined in:
app/helpers/dry_admin/resources_helper.rb

Instance Method Summary collapse

Instance Method Details

#input_field(f, name, type) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'app/helpers/dry_admin/resources_helper.rb', line 3

def input_field(f, name, type)
  fields = {:string => 'text_field', :text => 'text_area', :integer => 'number_field', :float => 'number_field', :decimal => 'number_field', :datetime => 'datetime_field',
            :timestamp => 'datetime_field', :time => 'time_field', :date => 'date_field', :binary => 'text_area', :boolean => 'check_box'}
  # CHECKBOX EXCEPTION
  if type == :boolean
    f.send(fields[type], name)
  else
    f.send(fields[type], name, :class=>"form-control", :placeholder => name.upcase.gsub("_"," "))
  end
end