Skip to content

Commit

Permalink
Document and collection tools should be view type specific
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Mar 12, 2015
1 parent d8cdb3d commit e64eef0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helpers/blacklight/component_helper_behavior.rb
Expand Up @@ -29,7 +29,7 @@ def render_nav_actions(options={}, &block)
# @return [String]
def render_index_doc_actions(document, options={})
wrapping_class = options.delete(:wrapping_class) || "index-document-functions"
rendered = render_filtered_partials(blacklight_config.index.document_actions, { document: document }.merge(options))
rendered = render_filtered_partials(blacklight_config.view_config(document_index_view_type).document_actions, { document: document }.merge(options))
content_tag("div", rendered, class: wrapping_class) unless rendered.blank?
end

Expand All @@ -42,7 +42,7 @@ def render_index_doc_actions(document, options={})
# @return [String]
def render_results_collection_tools(options = {})
wrapping_class = options.delete(:wrapping_class) || "search-widgets"
rendered = render_filtered_partials(blacklight_config.index.collection_actions, options)
rendered = render_filtered_partials(blacklight_config.view_config(document_index_view_type).collection_actions, options)
content_tag("div", rendered, class: wrapping_class) unless rendered.blank?
end

Expand Down
6 changes: 6 additions & 0 deletions spec/helpers/blacklight_helper_spec.rb
Expand Up @@ -149,6 +149,12 @@ def mock_document_app_helper_url *args
allow(helper).to receive(:render_bookmarks_control?).and_return(false)
expect(helper.render_index_doc_actions(document)).to be_blank
end

it "should render view type specific actions" do
allow(helper).to receive(:document_index_view_type).and_return(:custom)
config.view.custom.document_actions = []
expect(helper.render_index_doc_actions(document)).to be_blank
end
end

describe "render_show_doc_actions" do
Expand Down

0 comments on commit e64eef0

Please sign in to comment.