Class: Alchemy::Ingredients::BooleanEditor

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

Instance Attribute Summary

Attributes inherited from BaseEditor

#html_options, #ingredient

Instance Method Summary collapse

Methods inherited from BaseEditor

#form_field_id, #form_field_name, #initialize

Constructor Details

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

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/components/alchemy/ingredients/boolean_editor.rb', line 6

def call
  tag.div(class: css_classes, data: data_attributes, id: dom_id(ingredient)) do
    concat ingredient_id_field
    concat label_tag(nil, for: form_field_id) {
      safe_join([
        hidden_field_tag(form_field_name, "0", id: nil),
        check_box_tag(form_field_name, "1", value, id: form_field_id, disabled: !editable?),
        ingredient_role,
        render_hint_for(ingredient, size: "1x", fixed_width: false)
      ])
    }
  end
end