Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and configure blacklight_range_limit gem #529

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ gem 'rsolr', '>= 1.0', '< 3'
gem 'devise'
gem 'devise-guests', '~> 0.8'
gem 'blacklight-locale_picker'
gem 'blacklight_range_limit', '~> 8.5'

gem 'config'

Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ GEM
view_component (>= 2.66, < 4)
blacklight-locale_picker (1.1.0)
rails (>= 5.2.3, < 7.2)
blacklight_range_limit (8.5.0)
blacklight (>= 7.25.2, < 9)
deprecation
view_component (>= 2.54, < 4)
bootsnap (1.18.3)
msgpack (~> 1.2)
builder (3.2.4)
Expand Down Expand Up @@ -508,6 +512,7 @@ PLATFORMS
DEPENDENCIES
arclight (>= 1.1.0, < 2)
blacklight-locale_picker
blacklight_range_limit (~> 8.5)
bootsnap
capistrano (~> 3.0)
capistrano-bundler
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ $logo-height: 35px;
@import 'sulLanding';
@import 'sulCollection';
@import 'sulFooter';
@import 'sulFacets';
14 changes: 14 additions & 0 deletions app/assets/stylesheets/sulFacets.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Date Range Facet */

#facet-date_range {
// Hide some features that don't work or we don't want
.distribution, .more_facets, .facet-values.missing, .facet-count {
display: none;
}
p.range.subsection {
.facet-limit-active & {
// Don't show the complete date range if one is already applied
display: none;
}
}
}
7 changes: 6 additions & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Blacklight controller that handles searches and document requests
class CatalogController < ApplicationController
include Blacklight::Catalog
include BlacklightRangeLimit::ControllerOverride
include Arclight::Catalog

configure_blacklight do |config|
Expand Down Expand Up @@ -143,7 +144,11 @@ class CatalogController < ApplicationController
}
config.add_facet_field 'collection', field: 'collection_ssim', limit: 10
config.add_facet_field 'creators', field: 'creator_ssim', limit: 10
config.add_facet_field 'date_range', field: 'date_range_isim', range: true
config.add_facet_field 'date_range', field: 'date_range_isim',
range: {
chart_js: false,
slider_js: false
}
config.add_facet_field 'level', field: 'level_ssim', limit: 10
config.add_facet_field 'names', field: 'names_ssim', limit: 10
config.add_facet_field 'repository', field: 'repository_ssim', limit: 10
Expand Down
1 change: 1 addition & 0 deletions app/models/search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class SearchBuilder < Blacklight::SearchBuilder
include Blacklight::Solr::SearchBuilderBehavior
include BlacklightRangeLimit::RangeLimitBuilder
include Arclight::SearchBehavior

##
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'sidekiq/web'

Rails.application.routes.draw do
concern :range_searchable, BlacklightRangeLimit::Routes::RangeSearchable.new
mount Blacklight::Engine => '/'
mount Arclight::Engine => '/'
mount Sidekiq::Web => '/sidekiq'
Expand All @@ -12,6 +13,7 @@

resource :catalog, only: [:index], as: 'catalog', path: '/catalog', controller: 'catalog' do
concerns :searchable
concerns :range_searchable
end
devise_for :users

Expand Down