Skip to content

Commit

Permalink
adds more information to download data attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Dec 19, 2014
1 parent 4f76e69 commit 516c866
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/download_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def validate(response)
if response.nil?
flash[:danger] = t 'geoblacklight.download.error'
else
flash[:success] = view_context.link_to(t('geoblacklight.download.success', title: response), download_file_path(response))
flash[:success] = view_context.link_to(t('geoblacklight.download.success', title: response), download_file_path(response), data: { download: 'trigger', download_id: params[:id], download_type: "generated-#{params[:type]}"})
end
end

Expand Down
12 changes: 6 additions & 6 deletions app/views/catalog/_show_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
<% if document_downloadable? %>
<div class='btn-group' itemprop='distribution' itemscope='itemscope' itemtype='http://schema.org/DataDownload'>
<% if document.direct_download.present? %>
<%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], class: 'btn btn-default', 'contentUrl' => document.direct_download[:download]) %>
<%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], class: 'btn btn-default', 'contentUrl' => document.direct_download[:download], data: { download: 'trigger', download_type: 'direct', download_id: document[:layer_slug_s] }) %>
<% elsif document.hgl_download.present? %>
<%= link_to(download_text(document.download_types.first[0]),
download_hgl_path(id: document), data: {ajax_modal: 'trigger'},
download_hgl_path(id: document), data: {ajax_modal: 'trigger', download: 'trigger', download_type: 'harvard-hgl', download_id: document[:layer_slug_s] },
class: 'btn btn-default') %>
<% else %>
<%= link_to(download_text(document.download_types.first[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: document.download_types.first[0])}"}, class: 'btn btn-default') %>
<%= link_to(download_text(document.download_types.first[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: document.download_types.first[0])}", download: 'trigger', download_type: document.download_types.first[0], download_id: document[:layer_slug_s] }, class: 'btn btn-default') %>
<% end %>
<button type='button' class='btn btn-default dropdown-toggle download-dropdown-toggle' data-toggle='dropdown' aria-expanded='false'>
<span class='caret'></span>
Expand All @@ -35,20 +35,20 @@
<li role="presentation" class="dropdown-header">Original</li>
<li>
<%= link_to(download_text(document.download_types.first[0]),
download_hgl_path(id: document), data: {ajax_modal: 'trigger'}) %>
download_hgl_path(id: document), data: {ajax_modal: 'trigger', download: 'trigger', download_type: 'harvard-hgl', download_id: document[:layer_slug_s] }) %>
</li>
<% else %>
<% if document.direct_download.present? %>
<li role="presentation" class="dropdown-header">Original</li>
<li>
<%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], 'contentUrl' => document.direct_download[:download]) %>
<%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], 'contentUrl' => document.direct_download[:download], data: { download: 'trigger', download_type: 'direct', download_id: document[:layer_slug_s] }) %>
</li>
<% end %>
<% if document.download_types.present? %>
<li role="presentation" class="dropdown-header">Generated</li>
<% document.download_types.each do |type| %>
<%= content_tag(:li) do %>
<% link_to(download_text(type[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: type[0])}" }) %>
<% link_to(download_text(type[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: type[0])}", download: 'trigger', download_type: type[0], download_id: document[:layer_slug_s] }) %>
<% end %>
<% end %>
<% end %>
Expand Down

0 comments on commit 516c866

Please sign in to comment.