Skip to content

Commit

Permalink
[#4692] Pass a valid display_facet in the pub_date_presenter method
Browse files Browse the repository at this point in the history
Co-authored-by: Jane Sandberg <[email protected]>
  • Loading branch information
christinach and sandbergja committed Jan 23, 2025
1 parent fa06570 commit 352e325
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
5 changes: 0 additions & 5 deletions app/assets/stylesheets/components/search--advanced.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@
white-space: normal;
}

.row .range_limit input.range_begin,
.row .range_limit input.range_end {
width: 5em;
}

@include media-breakpoint-up(md) {
.two-columns-md {
display: flex;
Expand Down
5 changes: 1 addition & 4 deletions app/components/numismatics_search_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
<% end %>
<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 range_limit">
<label for="range_pub_date_start_sort_begin" class="visually-hidden">date range (starting year)</label>
<div class="col-sm-8">
<%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %>
<label for="range_pub_date_start_sort_end" class="visually-hidden">date range (ending year)</label>
<%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %>
</div>
</div>
<div class="mb-3 advanced-search-facet row">
Expand Down
6 changes: 5 additions & 1 deletion app/components/numismatics_search_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ def pub_date_field
blacklight_config.facet_fields['pub_date_start_sort']
end

def pub_date_field_display_facet
@response.aggregations[pub_date_field]
end

def pub_date_presenter
view_context.facet_field_presenter(pub_date_field, {})
view_context.facet_field_presenter(pub_date_field, pub_date_field_display_facet)
end

def initialize_constraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
<% end %>
<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 range_limit">
<label for="range_pub_date_start_sort_begin" class="visually-hidden">Publication date range (starting year)</label>
<%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %>
<label for="range_pub_date_start_sort_end" class="visually-hidden">Publication date range (ending year)</label>
<div class="col-sm-8">
<%= render BlacklightRangeLimit::RangeFormComponent.new(facet_field: pub_date_presenter) %>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion app/components/orangelight/advanced_search_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ def pub_date_field
blacklight_config.facet_fields['pub_date_start_sort']
end

def pub_date_field_display_facet
@response.aggregations[pub_date_field]
end

def pub_date_presenter
view_context.facet_field_presenter(pub_date_field, {})
view_context.facet_field_presenter(pub_date_field, pub_date_field_display_facet)
end

def initialize_search_field_controls
Expand Down
1 change: 0 additions & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class CatalogController < ApplicationController
segments: true,
chart_segment_border_color: 'rgb(255, 217, 96)',
chart_segment_bg_color: 'rgba(255, 217, 96, 0.5)',
chart_segment_bg_color: 'rgba(255, 217, 96, 0.5)',
show_missing_link: false
}
config.add_facet_field 'language_facet', label: 'Language', limit: true, include_in_advanced_search: true
Expand Down

0 comments on commit 352e325

Please sign in to comment.