Skip to content

Commit

Permalink
Merge pull request #3453 from projectblacklight/search-header-partial
Browse files Browse the repository at this point in the history
Render search header component directly
  • Loading branch information
jcoyne authored Feb 21, 2025
2 parents c5b3935 + b96802b commit dff28e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/spotlight/catalog/admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= curation_page_title %>

<%= render 'admin_header' %>
<%= render 'search_header' %>
<%= render blacklight_config.view_config(document_index_view_type).search_header_component.new %>

<%- if @response.empty? %>
<%= render "zero_results" %>
Expand Down
8 changes: 7 additions & 1 deletion spec/views/spotlight/catalog/admin.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
RSpec.describe 'spotlight/catalog/admin.html.erb', type: :view do
let(:exhibit) { stub_model(Spotlight::Exhibit) }
let(:blacklight_config) { CatalogController.blacklight_config }
let(:search_header_component) { instance_double(Blacklight::SearchHeaderComponent, render_in: true) }

before do
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
Expand All @@ -15,9 +16,9 @@
allow(view).to receive(:monitor_exhibit_resources_path).and_return('')
assign(:exhibit, exhibit)
assign(:response, [])
stub_template '_search_header.html.erb' => 'header'
stub_template '_zero_results.html.erb' => 'nuffin'
stub_template '_results_pagination.html.erb' => '0'
allow(blacklight_config.view_config(:admin_table).search_header_component).to receive(:new).and_return(search_header_component)
allow(view).to receive(:can?).and_return(true)
end

Expand All @@ -26,6 +27,11 @@
expect(view.content_for(:sidebar)).to have_link 'Browse'
end

it 'renders the search header' do
expect(search_header_component).to receive(:render_in)
render
end

it "renders the 'add items' link if any repository sources are configured" do
allow(Spotlight::Engine.config).to receive(:resource_partials).and_return(['a'])
render
Expand Down

0 comments on commit dff28e6

Please sign in to comment.