Skip to content

Commit

Permalink
preserve repository id as site slug value (DLC-1157)
Browse files Browse the repository at this point in the history
  • Loading branch information
barmintor committed Sep 25, 2024
1 parent 5f1a94d commit d807049
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions app/controllers/concerns/dcv/sites/reading_rooms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ def repository_ids_for_client(remote_ip = request.remote_ip)
end

def subsite_key
return unless params[:repository_id]
key = params[:repository_id].dup
key.downcase!
key.gsub!('-','')
key
params[:repository_id]
end

def load_subsite
@subsite ||= Site.find_by(slug: subsite_key) if params[:repository_id]
@subsite ||= Site.find_by(slug: params[:repository_id]) if params[:repository_id]
super
@subsite
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/repositories/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Repositories::CatalogController, type: :controller do
let(:default_catalog_styles) { ["gallery-#{Dcv::Sites::Constants.default_palette}", "catalog"] }
let(:view_context) { controller.view_context }
let(:site_attr) { { slug: 'nncrb', layout: 'default', palette: 'monochrome' } }
let(:site_attr) { { slug: 'NNC-RB', layout: 'default', palette: 'monochrome' } }
let(:search_service) { instance_double(Blacklight::SearchService) }
let(:subsite) { FactoryBot.create(:site, **site_attr) }

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/repositories_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe RepositoriesController, type: :controller do
let(:default_catalog_styles) { ["gallery-#{Dcv::Sites::Constants.default_palette}", "catalog"] }
let(:view_context) { controller.view_context }
let(:site_attr) { { slug: 'nncrb', layout: 'default', palette: 'monochrome' } }
let(:site_attr) { { slug: 'NNC-RB', layout: 'default', palette: 'monochrome' } }
let(:subsite) { FactoryBot.create(:site, **site_attr) }

before do
Expand Down

0 comments on commit d807049

Please sign in to comment.