Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #301 from ucsdlib/feature/file_download
Browse files Browse the repository at this point in the history
Add nofollow link to file download
  • Loading branch information
lsitu authored Apr 26, 2017
2 parents 7dc9e2c + 1254805 commit c28ef03
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/views/dams_objects/_admin_download.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<% adl_class = 'adl pull-right' %>
<% if can? :update, @document then %>
<%= link_to adl_glyph, downloadFilePath, class:adl_class, title:adl_title %>
<%= link_to adl_glyph, downloadFilePath, :rel => 'nofollow', class:adl_class, title:adl_title %>
<% elsif ucsd_local_display == 'false' && !downloadDerivativePath.nil?%>
<%= link_to adl_glyph, downloadDerivativePath, class:adl_class, title:adl_title %>
<%= link_to adl_glyph, downloadDerivativePath, :rel => 'nofollow', class:adl_class, title:adl_title %>
<% end %>

</div>
8 changes: 4 additions & 4 deletions app/views/dams_objects/_data_viewer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

<div class="form-actions dams-download-button">
<a id="data-view-file" class="btn <%=btnColor%> pull-right" href="<%= viewFilePath %>"><i class="glyphicon glyphicon-eye-open icon-white"></i> View file</a>
<a id="data-download-file" class="btn btn-link pull-left btn-mini hidden-phone" href="<%= filePath %>"><i class="glyphicon glyphicon-download-alt"></i> Download file</a>
<a id="data-download-file-phone" class="btn pull-left btn-mini visible-phone" href="<%= filePath %>"><i class="glyphicon glyphicon-download-alt"></i> Download file</a>
<a id="data-download-file" class="btn btn-link pull-left btn-mini hidden-phone" href="<%= filePath %>" rel="nofollow"><i class="glyphicon glyphicon-download-alt"></i> Download file</a>
<a id="data-download-file-phone" class="btn pull-left btn-mini visible-phone" href="<%= filePath %>" rel="nofollow"><i class="glyphicon glyphicon-download-alt"></i> Download file</a>
<% if can? :update, @document%>
<% if (defined?(sourcefilePath) && !sourcefilePath.nil? && sourcefilePath != filePath)%>
<a class="btn btn-link pull-left btn-mini hidden-phone" href="<%= sourcefilePath %>"><i class="glyphicon glyphicon-download-alt"></i> Download <%= File.extname(sourcefilePath.gsub('/download','')).upcase.gsub('.','')%> source</a>
<a class="btn pull-left btn-mini visible-phone" href="<%= sourcefilePath %>"><i class="glyphicon glyphicon-download-alt"></i> Download <%= File.extname(sourcefilePath.gsub('/download','')).upcase.gsub('.','')%> source</a>
<a class="btn btn-link pull-left btn-mini hidden-phone" href="<%= sourcefilePath %>" rel="nofollow"><i class="glyphicon glyphicon-download-alt"></i> Download <%= File.extname(sourcefilePath.gsub('/download','')).upcase.gsub('.','')%> source</a>
<a class="btn pull-left btn-mini visible-phone" href="<%= sourcefilePath %>" rel="nofollow"><i class="glyphicon glyphicon-download-alt"></i> Download <%= File.extname(sourcefilePath.gsub('/download','')).upcase.gsub('.','')%> source</a>
<% end %>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/dams_objects/_pdf_viewer.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="well dams-download-button">
<a class="btn btn-large btn-block btn-primary" href="<%= source %>" target="_blank">
<a class="btn btn-large btn-block btn-primary" href="<%= source %>" target="_blank" rel="nofollow">
<i class="icon-download-alt icon-white"></i>
Download PDF
</a>
Expand Down
7 changes: 6 additions & 1 deletion spec/features/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@
visit catalog_index_path( {:q => @obj2.id} )
expect(page).to have_selector('a', :text => 'MP3 Test')
expect(page).to have_css('i.glyphicon-volume-up')
end
end
scenario 'should have rel=nofollow for the download link' do
sign_in_developer
visit dams_object_path @obj2
expect(page).to have_css('a[title="Download File"][rel="nofollow"]')
end
end

describe "Download more than one master file" do
Expand Down

0 comments on commit c28ef03

Please sign in to comment.