Module: Iron::FieldDefinitionsHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/iron/field_definitions_helper.rb

Instance Method Summary collapse

Instance Method Details

#field_definition_color(field_definition) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/iron/field_definitions_helper.rb', line 22

def field_definition_color(field_definition)
  case field_definition.type_handle
  when "text_field", "text_area"     then "stone"
  when "rich_text_area"              then "indigo"
  when "number"                      then "amber"
  when "file"                        then "sky"
  when "boolean"                     then "green"
  when "date"                        then "orange"
  when "block", "block_list"         then "violet"
  when "reference", "reference_list" then "cyan"
  else "stone"
  end
end

#field_definition_icon(field_definition) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/iron/field_definitions_helper.rb', line 6

def field_definition_icon(field_definition)
  case field_definition.type_handle
  when "text_field"     then "type"
  when "text_area"      then "text"
  when "rich_text_area" then "text-quote"
  when "number"         then "hash"
  when "file"           then "file"
  when "boolean"        then "toggle-right"
  when "date"           then "calendar"
  when "block"          then "blocks"
  when "block_list"     then "list"
  when "reference", "reference_list" then "link"
  else "circle-help"
  end
end

#field_definition_type_optionsObject



2
3
4
# File 'app/helpers/iron/field_definitions_helper.rb', line 2

def field_definition_type_options
  Iron::FieldDefinition::TYPES.map { |type| [ type.humanize, type ] }
end