Skip to content

Commit

Permalink
[#4692] Create range_form_component to override the html and remove t…
Browse files Browse the repository at this point in the history
…he Apply submit button
  • Loading branch information
christinach committed Jan 24, 2025
1 parent a299fca commit 268082c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
11 changes: 0 additions & 11 deletions app/assets/javascripts/custom_range_limit.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/components/numismatics_search_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="mb-3 advanced-search-facet row">
<%= label_tag pub_date_field.parameterize, :class => "col-sm-4 control-label advanced-facet-label" do %>Year<% end %>
<div class="col-sm-8">
<%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %>
<%= render RangeFormComponent.new(facet_field: pub_date_presenter) %>
</div>
</div>
<div class="mb-3 advanced-search-facet row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="mb-3 advanced-search-facet row">
<%= label_tag pub_date_field.parameterize, :class => "col-sm-4 control-label advanced-facet-label" do %>Publication year<% end %>
<div class="col-sm-8">
<%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %>
<%= render RangeFormComponent.new(facet_field: pub_date_presenter) %>
</div>
</div>
</div>
Expand Down
27 changes: 27 additions & 0 deletions app/components/range_form_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<%= form_tag search_action_path, method: :get, class: [@classes[:form], "range_#{@facet_field.key} d-flex justify-content-center"].join(' ') do %>
<%= render hidden_search_state %>

<div class="range-limit-input-group">
<div class="d-flex justify-content-between align-items-end">
<div class="d-flex flex-column mr-1 me-1">
<%= label_tag(begin_input_name, t("blacklight.range_limit.range_begin_short"), class: 'text-muted small mb-1') %>
<%= number_field_tag(begin_input_name,
begin_value_default,
min: range_config[:min_value],
max: range_config[:max_value],
class: "form-control form-control-sm range_begin")
%>
</div>

<div class="d-flex flex-column ml-1 ms-1">
<%= label_tag(end_input_name, t("blacklight.range_limit.range_end_short"), class: 'text-muted small mb-1') %>
<%= number_field_tag(end_input_name,
end_value_default,
min: range_config[:min_value],
max: range_config[:max_value],
class: "form-control form-control-sm range_end")
%>
</div>
</div>
</div>
<% end %>
6 changes: 6 additions & 0 deletions app/components/range_form_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

# An override of the RangeFormComponent html to remove the Apply submit button
# from the advanced search and the numismatics form
class RangeFormComponent < BlacklightRangeLimit::RangeFormComponent
end

0 comments on commit 268082c

Please sign in to comment.