Class: Alchemy::Ingredients::ColorEditor

Inherits:
BaseEditor
  • Object
show all
Defined in:
app/components/alchemy/ingredients/color_editor.rb

Instance Attribute Summary

Attributes inherited from BaseEditor

#html_options, #ingredient

Instance Method Summary collapse

Methods inherited from BaseEditor

#call, #form_field_id, #form_field_name, #initialize

Constructor Details

This class inherits a constructor from Alchemy::Ingredients::BaseEditor

Instance Method Details

#input_fieldObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/components/alchemy/ingredients/color_editor.rb', line 6

def input_field
  ("alchemy-color-select") do
    if colors.none?
      concat text_field_tag(
        form_field_name,
        value,
        disabled: !editable?
      )
      concat color_field_tag(nil, value, disabled: disabled?)
    else
      concat select_tag(
        form_field_name,
        color_options.join.html_safe,
        disabled: !editable?
      )
      concat color_field_tag(form_field_name, value, disabled: disabled?)
    end
  end
end