Skip to content

Commit

Permalink
move downloads to document actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Feb 27, 2015
1 parent 222d528 commit 4b0f275
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 63 deletions.
48 changes: 48 additions & 0 deletions app/views/catalog/_downloads.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<% document ||= @document %>
<% if document_downloadable? %>
<div class='panel-body'>
<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], 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: '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])}", 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>
<span class='sr-only'>Toggle Download Dropdown</span>
</button>
<ul class='dropdown-menu' role='menu'>
<% if document.hgl_download.present? %>
<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: '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], 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])}", download: 'trigger', download_type: type[0], download_id: document[:layer_slug_s] }) %>
<% end %>
<% end %>
<% end %>
<% end %>
</ul>
</div>
</div>
<% elsif document.restricted? && document.same_institution? %>
<div class='panel-body'>
<%= link_to t('geoblacklight.tools.login_to_view'), new_user_session_path(referrer: request.original_url) %>
</div>
<% end %>
63 changes: 0 additions & 63 deletions app/views/catalog/_show_tools.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class CatalogController < ApplicationController
# Custom tools for GeoBlacklight
config.add_show_tools_partial :web_services, if: proc { |_context, _config, options| (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? }
config.add_show_tools_partial :metadata, if: proc { |_context, _config, options| (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? }
config.add_show_tools_partial :downloads, partial: 'downloads'
end


Expand Down

0 comments on commit 4b0f275

Please sign in to comment.