Skip to content

Commit

Permalink
Remove unnecessary conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Nov 17, 2023
1 parent 1a83f2f commit be7b45b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
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

0 comments on commit be7b45b

Please sign in to comment.