Class: Alchemy::Ingredients::SelectEditor

Inherits:
BaseEditor
  • Object
show all
Defined in:
app/components/alchemy/ingredients/select_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
25
26
27
28
29
30
# File 'app/components/alchemy/ingredients/select_editor.rb', line 6

def input_field
  if select_values.nil?
    warning(":select_values is nil",
      "        <strong>No select values given.</strong>\n        <br>Please provide <code>select_values</code> on the\n        ingredient definition <code>settings</code> in\n        <code>elements.yml</code>.\n      MSG\n    )\n  else\n    options_tags = if select_values.is_a?(Hash)\n      grouped_options_for_select(select_values, value)\n    else\n      options_for_select(select_values, value)\n    end\n    select_tag form_field_name, options_tags, {\n      id: form_field_id,\n      class: [\"ingredient-editor-select\"],\n      is: \"alchemy-select\",\n      multiple: settings[:multiple],\n      disabled: !editable?\n    }\n  end\nend\n".strip_heredoc