Skip to content

Commit

Permalink
Tools and metadata beside one another
Browse files Browse the repository at this point in the history
  • Loading branch information
brittnylapierre committed Nov 6, 2023
1 parent 2df069f commit 00d90d3
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 17 deletions.
20 changes: 8 additions & 12 deletions app/components/blacklight/document/show_tools_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@

<div class="dropdown document-tools-btn">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<%= t('blacklight.tools.title') %>
</button>
<%= render Blacklight::Document::ActionsComponent.new(document: document,
tag: 'ul',
classes: 'dropdown-menu',
wrapping_tag: 'li',
wrapping_classes: 'dropdown-item',
actions: actions,
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h)) %>
</div>
<%= render Blacklight::Document::ActionsComponent.new(document: document,
tag: 'ul',
classes: 'list-group list-group-flush',
wrapping_tag: 'li',
wrapping_classes: 'list-group-item',
actions: actions,
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h)) %>

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

<div class="dropdown document-tools-btn">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<%= t('blacklight.tools.title') %>
</button>
<%= render Blacklight::Document::ActionsComponent.new(document: document,
tag: 'ul',
classes: 'dropdown-menu',
wrapping_tag: 'li',
wrapping_classes: 'dropdown-item',
actions: actions,
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h)) %>
</div>
23 changes: 23 additions & 0 deletions app/components/blacklight/document/tools_dropdown_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module Blacklight
module Document
# Render the tools that display on the sidebar of the show page
class ShowToolsComponent < Blacklight::Component
# @param [Blacklight::Document] document
def initialize(document:)
@document = document
end

attr_reader :document

def render?
helpers.show_doc_actions?
end

def actions
helpers.document_actions(document)
end
end
end
end
17 changes: 12 additions & 5 deletions app/components/blacklight/document_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,24 @@
<% else %>
<div class="document-main-section container-xxl">
<br/>
<%= render(Blacklight::Document::SidebarComponent.new(presenter: @presenter)) %>
<%= title %>
<% if @component.to_s == 'div' %>
<%= render(ViewerComponent.new(documentId: @document.id, prefix: 'oocihm')) %>
<% end %>
<%= embed %>
<%= content %>
<%= metadata %>
<% metadata_sections.each do |section| %>
<%= section %>
<% end %>

<div class="row gx-3 gy-1 align-items-center">
<div class="col-auto">
<%= metadata %>
<% metadata_sections.each do |section| %>
<%= section %>
<% end %>
</div>
<div class="col-sm-3">
<%= render(Blacklight::Document::SidebarComponent.new(presenter: @presenter)) %>
</div>
</div>

<% partials.each do |partial| %>
<%= partial %>
Expand Down

0 comments on commit 00d90d3

Please sign in to comment.