Skip to content

Commit

Permalink
use blacklight document show actions framework
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Jan 6, 2015
1 parent 7e7b576 commit 756ff2d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 67 deletions.
4 changes: 0 additions & 4 deletions app/assets/stylesheets/geoblacklight/_styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
overflow:scroll;
max-height: 450px;
}

.show-tools .bookmark_toggle {
padding: 0px 0px;
}
63 changes: 0 additions & 63 deletions app/views/catalog/_show_sidebar.html.erb

This file was deleted.

63 changes: 63 additions & 0 deletions app/views/catalog/_show_tools.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<% document ||= @document %>
<div class="panel panel-default show-tools">
<div class="panel-heading">
<%= t('blacklight.tools.title') %>
</div>

<div class="panel-body">
<ul class="nav">
<%= render_show_doc_actions @document do |config, inner| %>
<li class="<%= config.key %>">
<%= inner %>
</li>
<% end %>
</ul>
</div>
<% 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 %>
</div>

0 comments on commit 756ff2d

Please sign in to comment.