-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3164 - Collection Thumbnails don't show in search results
Updating tests for thumbnail_list_collection.#3291
- Loading branch information
Showing
3 changed files
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
<div class="col-md-2"> | ||
<span class="<%= Hyrax::ModelIcon.css_class_for(Collection) %> collection-icon-search" aria-hidden="true"></span> | ||
<% collection_presenter = Hyrax::CollectionPresenter.new(document, current_ability) %> | ||
<% if (collection_presenter.thumbnail_path == nil) %> | ||
<span class="<%= Hyrax::ModelIcon.css_class_for(Collection) %> collection-icon-search" aria-hidden="true"></span> | ||
<% else %> | ||
<%= image_tag(collection_presenter.thumbnail_path) %> | ||
<% end %> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 14 additions & 4 deletions
18
spec/views/catalog/_thumbnail_list_collection.html.erb_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
RSpec.describe 'catalog/_thumbnail_list_collection.html.erb', type: :view do | ||
let(:attributes) do | ||
{ id: "xxx", | ||
"has_model_ssim": ["Collection"], | ||
"title_tesim": ["Collection Title"], | ||
"description_tesim": ["Collection Description"], | ||
"system_modified_dtsi": 'a date', | ||
"thumbnail_path_ss": '/xxx/yyy?file=thumbnail' } | ||
end | ||
let(:doc) { SolrDocument.new(attributes) } | ||
let(:current_ability) { Ability.new(build(:user)) } | ||
|
||
before do | ||
stub_template 'catalog/_thumbnail_list_collection.html.erb' => '<div class="col-sm-3"><span class="fa fa-cubes collection-icon-search"></span></div>' | ||
render | ||
render 'catalog/thumbnail_list_collection', document: doc, current_ability: current_ability | ||
end | ||
|
||
it 'displays the collection icon in the search results' do | ||
expect(rendered).to match '<div class="col-sm-3"><span class="fa fa-cubes collection-icon-search"></span></div>' | ||
it 'displays the collection thumbnail in the search results' do | ||
expect(rendered).to include '/xxx/yyy?file=thumbnail' | ||
end | ||
end |