Class: Components::SelectInputRow
- Inherits:
-
InputRow
- Object
- InputRow
- Components::SelectInputRow
- Defined in:
- app/components/select_input_row.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(form:, attribute:, label:, select_options:, help: nil, options: {}) ⇒ SelectInputRow
constructor
A new instance of SelectInputRow.
- #input_element ⇒ Object
Constructor Details
#initialize(form:, attribute:, label:, select_options:, help: nil, options: {}) ⇒ SelectInputRow
Returns a new instance of SelectInputRow.
2 3 4 5 |
# File 'app/components/select_input_row.rb', line 2 def initialize(form:, attribute:, label:, select_options:, help: nil, options: {}) @select_options = super(form: form, attribute: attribute, label: label, help: help, group: [:button].present?, options: ) end |
Instance Method Details
#input_element ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/select_input_row.rb', line 7 def input_element raw @form.select( # rubocop:disable Rails/OutputSafety @attribute, @select_options, @options.compact, { data: { controller: "searchable-select" }, class: "form-control form-select #{"is-invalid" if @form.object&.errors&.include?(@attribute_without_id) && !@form.object.errors[@attribute_without_id].empty?}" } ) if @options[:button] a href: @options[:button][:path], class: "btn btn-secondary" do @options[:button][:label] end end end |