Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary conditional #1766

Merged
merged 1 commit into from
Nov 17, 2023
Merged
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
4 changes: 2 additions & 2 deletions app/components/embed/footer_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
class='sul-embed-footer-tool sul-embed-btn sul-em bed-btn-toolbar sul-embed-btn-default sul-i-download-3'
aria-expanded='false' aria-label='open download panel'
data-sul-embed-toggle='sul-embed-download-panel'>
<% file_count = viewer.purl_object.downloadable_files.length if viewer.show_download_count? %>
<% if viewer.show_download_count? && file_count > 0 %>
<% file_count = viewer.purl_object.downloadable_files.length %>
<% if file_count > 0 %>
<span class='sul-embed-footer-tool sul-embed-download-count'
aria-label='number of downloadable files'><%= file_count %></span>
<% end %>
Expand Down
10 changes: 0 additions & 10 deletions app/viewers/embed/viewer/common_viewer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,10 @@ def show_download?
self.class.show_download? && !@request.hide_download?
end

# Should the download file count be shown (when download toolbar is shown)?
def show_download_count?
self.class.show_download_count?
end

def self.show_download?
false
end

# default is to show the download file count (when download toolbar is shown)
def self.show_download_count?
true
end

def tooltip_text(file)
return unless file.stanford_only?

Expand Down
9 changes: 0 additions & 9 deletions spec/lib/embed/viewer/common_viewer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@
end
end

describe '#show_download_count?' do
it 'true for non-image viewers' do
expect(file_viewer).to be_show_download_count
expect(geo_viewer).to be_show_download_count
expect(media_viewer).to be_show_download_count
expect(was_seed_viewer).to be_show_download_count
end
end

describe '#iframe_title' do
it 'determines the title from the class name' do
expect(file_viewer.iframe_title).to eq 'File viewer'
Expand Down