Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

Commit

Permalink
Merge pull request #9 from projectblacklight/routing_fix
Browse files Browse the repository at this point in the history
Update routes for each language. Fixes #5
  • Loading branch information
Jessie Keck authored Oct 16, 2017
2 parents d99882c + c5ca43e commit baf0f60
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class CatalogController < ApplicationController
rows: 10
}

config.document_pagination_params = {
fl: 'id language_facet'
}

# solr path which will be added to solr base url before the other solr params.
#config.solr_path = 'select'
#config.document_solr_path = 'get'
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
module ApplicationHelper

end
11 changes: 11 additions & 0 deletions app/helpers/blacklight_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module BlacklightHelper
include Blacklight::BlacklightHelperBehavior

# Override Blacklight
def url_for_document(document, options = {})
{ lang: document.fetch(:language_facet),
controller: :catalog,
action: :show,
id: document.id }
end
end
6 changes: 4 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do

mount Blacklight::Engine => '/'
root to: "catalog#index"
concern :searchable, Blacklight::Routes::Searchable.new
Expand All @@ -10,7 +10,7 @@

concern :exportable, Blacklight::Routes::Exportable.new

resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do
resources :solr_documents, only: [:show], path: '/:lang', controller: 'catalog', defaults: { lang: 'Tibetan' } do
concerns :exportable
end

Expand All @@ -22,5 +22,7 @@
end
end



# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end

0 comments on commit baf0f60

Please sign in to comment.