Skip to content

Commit

Permalink
Remove datagrid-enum-checkbox-label css class as styling by tag name …
Browse files Browse the repository at this point in the history
…is good enough
  • Loading branch information
bogdan committed Nov 16, 2024
1 parent 14452df commit 757fd56
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/views/datagrid/_enum_checkboxes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ You can add indent if whitespace doesn't matter for you
<div class="datagrid-enum-checkboxes">
<%- elements.each do |value, text, checked| -%>
<%- id = [form.object_name, filter.name, value].join('_').underscore -%>
<%= form.datagrid_label(filter.name, for: id, class: 'datagrid-enum-checkbox-label', **options) do -%>
<%= form.datagrid_label(filter.name, for: id, **options) do -%>
<%= form.datagrid_filter_input(filter.name, id: id, value: value) -%>
<%= text -%>
<%- end -%>
Expand Down
10 changes: 5 additions & 5 deletions spec/datagrid/form_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@ class MyTemplate
should equal_to_dom(
<<~HTML,
<div class="datagrid-enum-checkboxes">
<label for="report_category_first" class="datagrid-enum-checkbox-label">
<label for="report_category_first">
<input type="checkbox" id="report_category_first"
value="first" name="report[category][]" />
first
</label>
<label for="report_category_second" class="datagrid-enum-checkbox-label">
<label for="report_category_second">
<input type="checkbox" id="report_category_second"
value="second" name="report[category][]" />
second
Expand Down Expand Up @@ -643,15 +643,15 @@ class MyTemplate
let(:expected_html) do
<<~DOM
<div class="datagrid-enum-checkboxes">
<label for="report_column_names_id" class="datagrid-enum-checkbox-label">
<label for="report_column_names_id">
<input id="report_column_names_id" type="checkbox" value="id" checked name="report[column_names][]">
Id
</label>
<label for="report_column_names_name" class="datagrid-enum-checkbox-label">
<label for="report_column_names_name">
<input id="report_column_names_name" type="checkbox" value="name" checked name="report[column_names][]"/>
Name
</label>
<label for="report_column_names_category" class="datagrid-enum-checkbox-label">
<label for="report_column_names_category">
<input id="report_column_names_category" type="checkbox" value="category" name="report[column_names][]">
Category
</label>
Expand Down
4 changes: 2 additions & 2 deletions version-2/Readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ Version 2 layout:
<div class="datagrid-filter" data-filter="group_id" data-type="enum">
<label>Group</label>
<div class="datagrid-enum-checkboxes">
<label for="g_group_id_1" class="datagrid-enum-checkbox-label">
<label for="g_group_id_1">
<input id="g_group_id_1" value="1" type="checkbox" name="g[group_id][]" />1
</label>
<label for="g_group_id_2" class="datagrid-enum-checkbox-label">
<label for="g_group_id_2">
<input id="g_group_id_2" value="2" type="checkbox" name="g[group_id][]" />2
</label>
</div>
Expand Down
4 changes: 2 additions & 2 deletions version-2/form-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<div class="datagrid-filter" data-filter="group_id" data-type="enum">
<label for="g_group_id">Group</label>
<div class="datagrid-enum-checkboxes">
<label class="datagrid-enum-checkbox-label" for="g_group_id_1">
<label for="g_group_id_1">
<input id="g_group_id_1" value="1" type="checkbox" name="g[group_id][]" />1
</label>
<label class="datagrid-enum-checkbox-label" for="g_group_id_2">
<label for="g_group_id_2">
<input id="g_group_id_2" type="checkbox" value="2" name="g[group_id][]" />2
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion version-2/views.diff
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ index 9f48319..f225cc6 100644
<%- id = [form.object_name, filter.name, value].join('_').underscore -%>
-<%= form.label filter.name, options.merge(for: id) do -%>
-<%= form.check_box(filter.name, {multiple: true, id: id, checked: checked, include_hidden: false}, value.to_s, nil) -%>
+<%= form.datagrid_label(filter.name, **options, for: id, class: 'datagrid-enum-checkbox-label') do -%>
+<%= form.datagrid_label(filter.name, **options, for: id) do -%>
+<%= form.datagrid_filter_input(filter.name, id: id, value: value) -%>
<%= text -%>
<%- end -%>
Expand Down

0 comments on commit 757fd56

Please sign in to comment.