Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan committed Nov 14, 2024
1 parent 5a0d966 commit d7f75ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/views/datagrid/_range_filter.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%= form.datagrid_filter_input(filter, class: 'datagrid-range-from', **from_options) %>
<span class="datagrid-range-separator"><%= I18n.t('datagrid.filters.range.separator') %></span>
<%# Generating id only for "from" input to make sure -%>
<%# there is no duplicate id in DOM and click on label focuses the first input -%> <%= form.datagrid_filter_input(filter, class: 'datagrid-range-to', **to_options, id: nil) %>
<%# there is no duplicate id in DOM and click on label focuses the first input -%>
<%= form.datagrid_filter_input(filter, class: 'datagrid-range-to', **to_options, id: nil) %>
2 changes: 0 additions & 2 deletions lib/datagrid/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ def parse_datetime(value)
def format_date_as_timestamp(value)
if !value
value
# elsif value.is_a?(Array)
# value.first&.beginning_of_day..value.last&.end_of_day
elsif value.is_a?(Range)
value.begin&.beginning_of_day..value.end&.end_of_day
else
Expand Down
7 changes: 4 additions & 3 deletions version-2/views.diff
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ index e939128..b355528 100644
<% end %>
</tr>
diff --git a/app/views/datagrid/_range_filter.html.erb b/app/views/datagrid/_range_filter.html.erb
index 7a8a123..3b8ca85 100644
index 7a8a123..ffbb0f8 100644
--- a/app/views/datagrid/_range_filter.html.erb
+++ b/app/views/datagrid/_range_filter.html.erb
@@ -1,3 +1,3 @@
@@ -1,3 +1,4 @@
-<%= form.datagrid_filter_input(filter, **from_options) %>
-<span class="separator <%= filter.type %>"><%= I18n.t('datagrid.filters.range.separator') %></span>
-<%= form.datagrid_filter_input(filter, **to_options) %>
+<%= form.datagrid_filter_input(filter, class: 'datagrid-range-from', **from_options) %>
+<span class="datagrid-range-separator"><%= I18n.t('datagrid.filters.range.separator') %></span>
+<%= form.datagrid_filter_input(filter, class: 'datagrid-range-to', **to_options) %>
+<%# Generating id only for "from" input to make sure -%>
+<%# there is no duplicate id in DOM and click on label focuses the first input -%> <%= form.datagrid_filter_input(filter, class: 'datagrid-range-to', **to_options, id: nil) %>
diff --git a/app/views/datagrid/_row.html.erb b/app/views/datagrid/_row.html.erb
index f54d21c..340aea6 100644
--- a/app/views/datagrid/_row.html.erb
Expand Down

0 comments on commit d7f75ba

Please sign in to comment.