diff --git a/app/views/datagrid/_enum_checkboxes.html.erb b/app/views/datagrid/_enum_checkboxes.html.erb index f225cc6..a5d4dcb 100644 --- a/app/views/datagrid/_enum_checkboxes.html.erb +++ b/app/views/datagrid/_enum_checkboxes.html.erb @@ -5,7 +5,7 @@ You can add indent if whitespace doesn't matter for you
<%- elements.each do |value, text, checked| -%> <%- id = [form.object_name, filter.name, value].join('_').underscore -%> -<%= form.datagrid_label(filter.name, **options, for: id, class: 'datagrid-enum-checkbox-label') do -%> +<%= form.datagrid_label(filter.name, for: id, class: 'datagrid-enum-checkbox-label', **options) do -%> <%= form.datagrid_filter_input(filter.name, id: id, value: value) -%> <%= text -%> <%- end -%> diff --git a/spec/datagrid/form_builder_spec.rb b/spec/datagrid/form_builder_spec.rb index a1a42d4..947749c 100644 --- a/spec/datagrid/form_builder_spec.rb +++ b/spec/datagrid/form_builder_spec.rb @@ -474,6 +474,21 @@ class MyTemplate let(:view_options) { { partials: "custom_checkboxes" } } it { should equal_to_dom("custom_enum_checkboxes") } end + + context "when inline class attribute specified" do + let(:_filter_options) { {for: nil, class: 'custom-class'} } + + it { should equal_to_dom(<<~HTML) } +
+ + +
+ HTML + end end end