Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/helpers/blacklight/catalog_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ def document_index_view_type query_params = params || {}
end
end

# Should we display special "home" splash screen content, instead of search results?
def display_splash_content?
!has_search_parameters?
end

private

# @param [String] format
Expand Down
2 changes: 1 addition & 1 deletion app/views/catalog/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
view_config: conf) %>
<% end %>

<% unless has_search_parameters? %>
<% if display_splash_content? %>
<%# if there are no input/search related params, display the "home" partial -%>
<%= render 'home' %>
<%= render 'shared/sitelinks_search_box' %>
Expand Down
8 changes: 4 additions & 4 deletions spec/views/catalog/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

RSpec.describe "catalog/index.html.erb" do
describe "with no search parameters" do
describe "with splash content (no search parameters)" do
before do
allow(view).to receive(:has_search_parameters?).and_return(false)
allow(view).to receive(:display_splash_content?).and_return(true)
allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
@response = instance_double(Blacklight::Solr::Response, empty?: true, total: 11, start: 1, limit_value: 10, aggregations: {})
end
Expand All @@ -17,9 +17,9 @@
end
end

describe "with search parameters" do
describe "with results (search parameters)" do
before do
allow(view).to receive(:has_search_parameters?).and_return(true)
allow(view).to receive(:display_splash_content?).and_return(false)
stub_template "catalog/_results_pagination.html.erb" => ""
stub_template "catalog/_search_header.html.erb" => "header_content"
allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
Expand Down