Skip to content

Commit

Permalink
Merge pull request #318 from psu-stewardship/asset
Browse files Browse the repository at this point in the history
Removing hard coded asset paths, which do not work in production.  While...
  • Loading branch information
jcoyne committed Feb 7, 2014
2 parents cb9614d + 025a76a commit fbe0f78
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<% if document.image? || document.pdf? || document.video? %>
<% path = sufia.download_path(document.noid, {datastream_id: 'thumbnail'}) %>
<% elsif document.audio? %>
<% path = "/assets/audio.png" %>
<% path = "audio.png" %>
<% else %>
<% path = "/assets/default.png" %>
<% path = "default.png" %>
<% end %>
<%= link_to image_tag(path, {width: width}), sufia.generic_file_path(document) %>
6 changes: 3 additions & 3 deletions app/views/generic_files/_media_display.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if @generic_file.image? %>
<a href="<%= sufia.download_path(@generic_file) %>" target="_new" title="Download the full-sized image"><img src="<%= sufia.download_path(@generic_file, {:datastream_id => 'thumbnail'}) %>" width="338" alt="Download the full-sized image of <%= @generic_file.title.first %>"/>Download the full-sized image</a>
<%= link_to image_tag(sufia.download_path(@generic_file, datastream_id: 'thumbnail'),{width:"338", alt:"Download the full-sized image of #{@generic_file.title.first}"})+"Download the full-sized image", sufia.download_path(@generic_file), { target:"_new", title:"Download the full-sized image"}%>
<% elsif @generic_file.video? %>
<video controls="controls" class="video-js vjs-default-skin" data-setup="{}" preload="auto">
<source src="<%= sufia.download_path(@generic_file, datastream_id: 'webm') %>" type="video/webm" />
Expand All @@ -13,7 +13,7 @@
Your browser does not support the audio tag.
</audio>
<% elsif @generic_file.pdf?%>
<a href="<%= sufia.download_path(@generic_file) %>" target="_new" title="Download the full-sized PDF"><img src="<%= sufia.download_path(@generic_file, datastream_id: 'thumbnail') %>" width="338" alt="Download the full-sized PDF of <%= @generic_file.title.first %>"/>Download the full-sized PDF</a>
<%= link_to image_tag(sufia.download_path(@generic_file, datastream_id: 'thumbnail'),{width:"338", alt:"Download the full-sized PDF of #{@generic_file.title.first}"})+"Download the full-sized PDF", sufia.download_path(@generic_file), { target:"_new", title:"Download the full-sized PDF"}%>
<% else %>
<a href="<%= sufia.download_path(@generic_file) %>" target="_new"><img src="/assets/default.png" alt="No preview available" width="338" height="493" /></a>
<%= link_to image_tag("default.png", {alt:"No preview available", width:"338", height:"493"}), sufia.download_path(@generic_file), { target:"_new", title:"Download the document"} %>
<% end %>
48 changes: 20 additions & 28 deletions app/views/users/_contributions.html.erb
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
<div class="tab-pane active" id="contributions">
<i class="icon-trophy trophy-on" ></i> <strong>Highlighted Files</strong>
<% if @trophies.count > 0 %>
<table>
<% @trophies.each do |t| %>
<tr id="trophyrow_<%= Sufia::Noid.noidify(t.pid) %>">
<% if t.image? || t.pdf? %>
<% temp_thumbnail_path = sufia.download_path(t) + "?datastream_id=thumbnail" %>
<% temp_href = "<a href=\"" + sufia.download_path(t) + "\"> <img src=\"" + temp_thumbnail_path + "\" width=\"90\" alt=\"Download the full-sized image\"/></a>" %>
<% else %>
<% temp_href = "<a href=\"" + sufia.download_path(t) + "\"> <img src=\"/assets/default.png\" width=\"90\" alt=\"Download file\"/></a>" %>
<% end %>
<td>
<%= temp_href.html_safe() %>
</td>
<td>
<%= link_to display_title(t), sufia.generic_file_path(t) %>
<% if current_user == @user %>
<%= link_to raw("<i class='trophy-on icon-remove'></i>"),"", class: 'trophy-on trophy-class', title: "Click to remove from Highlighted files.", id: Sufia::Noid.noidify(t.pid), remote: true, data: {removerow: "true" } %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% else %>
<%= @user.name %> has no highlighted files.
<% end %>
</div>
<div class="tab-pane active" id="contributions">
<i class="icon-trophy trophy-on"></i> <strong>Highlighted Files</strong>
<% if @trophies.count > 0 %>
<table>
<% @trophies.each do |t| %>
<tr id="trophyrow_<%= Sufia::Noid.noidify(t.pid) %>">
<td>
<%= render partial: "dashboard/_index_partials/thumbnail_display", locals: {document: t, width: 90} %>
</td>
<td>
<%= link_to display_title(t), sufia.generic_file_path(t) %>
<%= link_to raw("<i class='trophy-on icon-remove'></i>"), "", class: 'trophy-on trophy-class', title: "Click to remove from Highlighted files.", id: Sufia::Noid.noidify(t.pid), remote: true, data: {removerow: "true"} if current_user == @user%>
</td>
</tr>
<% end %>
</table>
<% else %>
<%= @user.name %> has no highlighted files.
<% end %>
</div>

0 comments on commit fbe0f78

Please sign in to comment.