Skip to content

Commit

Permalink
Render controls navbar in work and collection show views
Browse files Browse the repository at this point in the history
Set the (overrideable) theme to be used in the work and collection controlers, and use the 1_column layout to pick up the controls navbar.

Fixes samvera-labs/nurax-pre2023#71
  • Loading branch information
mjgiarlo authored and jcoyne committed Nov 9, 2017
1 parent 9df8957 commit 690c41b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module WorksControllerBehavior

included do
layout :decide_layout

copy_blacklight_config_from(::CatalogController)
class_attribute :show_presenter, :search_builder_class
self.show_presenter = Hyrax::WorkShowPresenter
Expand All @@ -17,6 +16,7 @@ module WorksControllerBehavior
storage_adapter: Valkyrie.config.storage_adapter
)

self.theme = 'hyrax/1_column'
attr_accessor :curation_concern
helper_method :curation_concern, :contextual_path

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/hyrax/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class CollectionsController < ApplicationController
layout :decide_layout
load_and_authorize_resource except: [:index, :show, :create], instance_name: :collection

self.theme = 'hyrax/1_column'

# Renders a JSON response with a list of files in this collection
# This is used by the edit form to populate the thumbnail_id dropdown
def files
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/hyrax/citations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
expect(controller).to receive(:add_breadcrumb).with('My Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
get :work, params: { id: work }
expect(response).to be_successful
expect(response).to render_template('layouts/hyrax')
expect(response).to render_template('layouts/hyrax/1_column')
expect(assigns(:presenter)).to be_kind_of Hyrax::WorkShowPresenter
end
end
Expand Down Expand Up @@ -42,7 +42,7 @@
expect(controller).to receive(:add_breadcrumb).with('My Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
get :file, params: { id: file_set }
expect(response).to be_successful
expect(response).to render_template('layouts/hyrax')
expect(response).to render_template('layouts/hyrax/1_column')
expect(assigns(:presenter)).to be_kind_of Hyrax::FileSetPresenter
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/hyrax/collections_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
expect(controller).to receive(:add_breadcrumb).with(I18n.t('hyrax.dashboard.title'), Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
get :show, params: { id: collection }
expect(response).to be_successful
expect(response).to render_template("layouts/hyrax/1_column")
expect(assigns[:presenter]).to be_kind_of Hyrax::CollectionPresenter
expect(assigns[:presenter].title).to match_array collection.title
expect(assigns[:member_docs].map(&:id)).to match_array [asset1, asset2, asset3].map { |asset| asset.id.to_s }
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/hyrax/generic_works_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
expect(controller).to receive(:add_breadcrumb).with('test title', main_app.hyrax_generic_work_path(work.id, locale: 'en'))
get :show, params: { id: work }
expect(response).to be_successful
expect(response).to render_template("layouts/hyrax")
expect(response).to render_template("layouts/hyrax/1_column")
end
end

Expand Down

0 comments on commit 690c41b

Please sign in to comment.