Skip to content

Commit

Permalink
Merge pull request #752 from sul-dlss/694-date-range
Browse files Browse the repository at this point in the history
Configure the blacklight date range widget
  • Loading branch information
mejackreed authored Nov 27, 2019
2 parents 1c2e7ce + 0956bd4 commit 2abf688
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ gem 'sitemap_generator'
gem 'blacklight-gallery', '>= 0.3.0'
gem 'blacklight-hierarchy'
gem 'blacklight-oembed', '>= 0.1.0'
gem 'blacklight_range_limit', '~> 7.2'
gem 'blacklight_range_limit', '~> 7.3'
gem 'jquery-rails'
gem 'rails_autolink'
gem 'rsolr', '>= 1.0'
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/projectblacklight/spotlight.git
revision: cce919304cd24c504959ea0904eef7887421cd26
revision: b7da8ed75029f9beb4817ca91501489649bad7ac
specs:
blacklight-spotlight (3.0.0.alpha)
acts-as-taggable-on (>= 5.0, < 7)
Expand Down Expand Up @@ -94,7 +94,7 @@ GEM
autoprefixer-rails (9.7.2)
execjs
aws-eventstream (1.0.3)
aws-partitions (1.245.0)
aws-partitions (1.246.0)
aws-sdk-core (3.82.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
Expand Down Expand Up @@ -137,7 +137,7 @@ GEM
blacklight (~> 7.0)
rails
ruby-oembed
blacklight_range_limit (7.2.0)
blacklight_range_limit (7.3.1)
blacklight (>= 7.0)
bootsnap (1.4.5)
msgpack (~> 1.0)
Expand Down Expand Up @@ -591,7 +591,7 @@ DEPENDENCIES
blacklight-hierarchy
blacklight-oembed (>= 0.1.0)
blacklight-spotlight!
blacklight_range_limit (~> 7.2)
blacklight_range_limit (~> 7.3)
bootsnap (>= 1.1.0)
bootstrap (~> 4.0)
byebug
Expand Down
10 changes: 9 additions & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,15 @@ class CatalogController < ApplicationController
config.add_facet_field 'spatial', field: 'cho_spatial_ssim', limit: true
config.add_facet_field 'temporal', field: 'cho_temporal_ssim', limit: true
config.add_facet_field 'source_date', field: 'cho_date_ssim', limit: true
config.add_facet_field 'cho_date_range_norm_isim', field: 'cho_date_range_norm_isim', range: true
# Using an explicit partial for the date ranges so the configuration works for the home page
config.add_facet_field 'cho_date_range_norm_isim',
field: 'cho_date_range_norm_isim',
range: true,
partial: 'blacklight_range_limit/range_limit_panel'
config.add_facet_field 'cho_date_range_hijri_isim',
field: 'cho_date_range_hijri_isim',
range: true,
partial: 'blacklight_range_limit/range_limit_panel'
config.add_facet_field 'creator', field: 'cho_creator_ssim', limit: true
config.add_facet_field 'contributor', field: 'cho_contributor_ssim', limit: true
config.add_facet_field 'medium', field: 'cho_medium_ssim', limit: true
Expand Down
14 changes: 14 additions & 0 deletions app/controllers/spotlight/home_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# This unpleasantness allows us to include the upstream controller before overriding it
# rubocop:disable Rails/DynamicFindBy
spotlight_path = Gem::Specification.find_by_name('blacklight-spotlight').full_gem_path
require_dependency File.join(spotlight_path, 'app/controllers/spotlight/home_pages_controller')
# rubocop:enable Rails/DynamicFindBy

module Spotlight
# Override the upstream HomePagesController in order to inject range limit behaviors
class HomePagesController
include BlacklightRangeLimit::ControllerOverride
end
end
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
resource :statistics, only: :show

get "catalog/range_limit" => "spotlight/catalog#range_limit"
get "home/range_limit" => "spotlight/home_pages#range_limit"
get "catalog/range_limit_panel/:id" => "spotlight/catalog#range_limit_panel"
get "home/range_limit_panel/:id" => "spotlight/home_pages#range_limit_panel"
end

resource :transform, only: [:show, :create]
Expand Down

0 comments on commit 2abf688

Please sign in to comment.