From 268082c3b948d27de23cacb2cdde7176d97ee7e2 Mon Sep 17 00:00:00 2001 From: Christina Chortaria Date: Thu, 23 Jan 2025 15:44:40 -0500 Subject: [PATCH] [#4692] Create range_form_component to override the html and remove the Apply submit button --- app/assets/javascripts/custom_range_limit.js | 11 -------- ...numismatics_search_form_component.html.erb | 2 +- .../advanced_search_form_component.html.erb | 2 +- app/components/range_form_component.html.erb | 27 +++++++++++++++++++ app/components/range_form_component.rb | 6 +++++ 5 files changed, 35 insertions(+), 13 deletions(-) delete mode 100644 app/assets/javascripts/custom_range_limit.js create mode 100644 app/components/range_form_component.html.erb create mode 100644 app/components/range_form_component.rb diff --git a/app/assets/javascripts/custom_range_limit.js b/app/assets/javascripts/custom_range_limit.js deleted file mode 100644 index fd9f91142..000000000 --- a/app/assets/javascripts/custom_range_limit.js +++ /dev/null @@ -1,11 +0,0 @@ -// this doesn't really do anything -// because it doesn't load properly -// it's supposed to customize the look -// of the range limit plot - -$('.blacklight-pub_date').data('plot-config', { - selection: { color: '#C0FF83' }, - colors: ['#ffffff'], - series: { lines: { fillColor: 'rgba(255,255,255, 0.5)' } }, - grid: { color: '#aaaaaa', tickColor: '#aaaaaa', borderWidth: 0 }, -}) diff --git a/app/components/numismatics_search_form_component.html.erb b/app/components/numismatics_search_form_component.html.erb index dd2bff0cb..d3a707aec 100644 --- a/app/components/numismatics_search_form_component.html.erb +++ b/app/components/numismatics_search_form_component.html.erb @@ -16,7 +16,7 @@
<%= label_tag pub_date_field.parameterize, :class => "col-sm-4 control-label advanced-facet-label" do %>Year<% end %>
- <%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %> – + <%= render RangeFormComponent.new(facet_field: pub_date_presenter) %>
diff --git a/app/components/orangelight/advanced_search_form_component.html.erb b/app/components/orangelight/advanced_search_form_component.html.erb index 037501693..228e29f4b 100644 --- a/app/components/orangelight/advanced_search_form_component.html.erb +++ b/app/components/orangelight/advanced_search_form_component.html.erb @@ -38,7 +38,7 @@
<%= label_tag pub_date_field.parameterize, :class => "col-sm-4 control-label advanced-facet-label" do %>Publication year<% end %>
- <%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %> + <%= render RangeFormComponent.new(facet_field: pub_date_presenter) %>
diff --git a/app/components/range_form_component.html.erb b/app/components/range_form_component.html.erb new file mode 100644 index 000000000..9cbf4d434 --- /dev/null +++ b/app/components/range_form_component.html.erb @@ -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 %> + +
+
+
+ <%= 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") + %> +
+ +
+ <%= 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") + %> +
+
+
+<% end %> \ No newline at end of file diff --git a/app/components/range_form_component.rb b/app/components/range_form_component.rb new file mode 100644 index 000000000..d03c0042b --- /dev/null +++ b/app/components/range_form_component.rb @@ -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