Skip to content

Commit 843705e

Browse files
author
Kirk Wang
authored
Merge pull request #2416 from samvera/adjust-show-pages
🧹 Adjust show pages
2 parents be514fc + b060289 commit 843705e

File tree

8 files changed

+127
-12
lines changed

8 files changed

+127
-12
lines changed

app/assets/stylesheets/themes/cultural_show.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
dl.work-show dd {
44
border-bottom: 1px solid #ddd;
55

6+
&:last-child {
7+
border-bottom: none; /* Removes border for the last dd element */
8+
}
9+
610
.tabular {
711
border-bottom: 0;
812
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<%# OVERRIDE Hyrax v5.0.1 Adjust permission checks for delete and add analytics button and add ENV to control turbolinks %>
2+
<div class="row show-actions button-row-top-two-column justify-content-start mt-1">
3+
<div class="pr-3">
4+
<% if Hyrax.config.analytics_reporting? %>
5+
<% # turbolinks needs to be turned off or the page will use the cache and the %>
6+
<% # analytics graph will not show unless the page is refreshed. %>
7+
<%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-secondary', data: { turbolinks: false } %>
8+
<% end %>
9+
<% if presenter.editor? && !workflow_restriction?(presenter) %>
10+
<%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-secondary', data: { turbolinks: block_valkyrie_redirect? } %>
11+
<% if presenter.member_count > 1 %>
12+
<%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-secondary' %>
13+
<% end %>
14+
<% if presenter.valid_child_concerns.length > 0 %>
15+
<div class="btn-group">
16+
<button type="button" class="btn btn-secondary dropdown-toggle" type="button" id="dropdown-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
17+
<%= t('.attach_child') %>
18+
</button>
19+
<div class="dropdown-menu">
20+
<% presenter.valid_child_concerns.each do |concern| %>
21+
<%= link_to "Attach #{concern.human_readable_type}", polymorphic_path([main_app, :new, :hyrax, :parent, concern.model_name.singular.to_sym], parent_id: presenter.id), class: "dropdown-item" %>
22+
<% end %>
23+
</div>
24+
</div>
25+
<% end %>
26+
<%# OVERRIDE to validate delete permission %>
27+
<% if current_ability.can?(:delete, presenter.solr_document) %>
28+
<%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %>
29+
<% end %>
30+
<% if !workflow_restriction?(presenter) %>
31+
<% if presenter.show_deposit_for?(collections: @user_collections) %>
32+
<input type="checkbox" aria-label="Batch Documents" style="display:none" name="batch_document_ids[]" id="batch_document_<%= presenter.id %>" value="<%= presenter.id %>" class="batch_document_selector" checked="checked" />
33+
<%= button_tag t('hyrax.dashboard.my.action.add_to_collection'),
34+
class: 'btn btn-secondary submits-batches submits-batches-add',
35+
data: { toggle: "modal", target: "#collection-list-container" } %>
36+
<% end %>
37+
<% if presenter.work_featurable? %>
38+
<%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json),
39+
data: { behavior: 'feature' },
40+
class: presenter.display_feature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>
41+
42+
<%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json),
43+
data: { behavior: 'unfeature' },
44+
class: presenter.display_unfeature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>
45+
<% end %>
46+
<% end %>
47+
<% end %>
48+
</div>
49+
</div>
50+
51+
<!-- COinS hook for Zotero -->
52+
<span class="Z3988" title="<%= export_as_openurl_ctx_kev(presenter) %>"></span>
53+
<!-- Render Modals -->
54+
<%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %>

app/views/themes/cultural_show/hyrax/base/_work_title.html.erb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<% presenter.title.each_with_index do |title, index| %>
22
<div class="row">
3-
<div class="col-12 text-show-title">
3+
<div class="col-12 text-show-title d-flex">
44
<% if index == 0 %>
5-
<h2><%= markdown(title) %>
6-
<small class="text-muted"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></small>
7-
</h2>
5+
<h2><%= markdown(title) %></h2><span class="ml-2 mt-2"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></span>
86
<% else %>
97
<h2><%= markdown(title) %></h2>
108
<% end %>

app/views/themes/cultural_show/hyrax/base/show.html.erb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
<div class="card-body">
1212
<div class="row">
1313
<%= render 'workflow_actions_widget', presenter: @presenter %>
14-
<div class="col-12">
15-
<%= render "show_actions", presenter: @presenter %>
16-
</div>
1714
<% if @presenter.video_embed_viewer? %>
1815
<%= render 'video_embed_viewer', presenter: @presenter %>
1916
<% elsif @presenter.iiif_viewer? %>
@@ -29,6 +26,9 @@
2926
<%= render 'representative_media', presenter: @presenter, viewer: false %>
3027
</div>
3128
<% end %>
29+
<div class="col-12">
30+
<%= render "show_actions", presenter: @presenter %>
31+
</div>
3232
<div class="col-md-8">
3333
<%= render 'work_description', presenter: @presenter %>
3434
<%= render 'metadata', presenter: @presenter %>
@@ -38,7 +38,9 @@
3838
<%= render 'relationships', presenter: @presenter %>
3939
</div>
4040
<%= render('download_pdf', presenter: @presenter, file_set_id: @presenter.file_set_presenters.first.id) if @presenter.show_pdf_download_button? %>
41+
<div class="d-flex justify-content-center">
4142
<%= render 'citations', presenter: @presenter %>
43+
</div>
4244
<!-- analytics_button is disabled until future fix -->
4345
<%#= render 'analytics_button', presenter: @presenter %>
4446
</div>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<%# OVERRIDE Hyrax v5.0.1 Adjust permission checks for delete and add analytics button and add ENV to control turbolinks %>
2+
<div class="row show-actions button-row-top-two-column justify-content-end">
3+
<div class="pr-3">
4+
<% if Hyrax.config.analytics_reporting? %>
5+
<% # turbolinks needs to be turned off or the page will use the cache and the %>
6+
<% # analytics graph will not show unless the page is refreshed. %>
7+
<%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-secondary', data: { turbolinks: false } %>
8+
<% end %>
9+
<% if presenter.editor? && !workflow_restriction?(presenter) %>
10+
<%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-secondary', data: { turbolinks: block_valkyrie_redirect? } %>
11+
<% if presenter.member_count > 1 %>
12+
<%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-secondary' %>
13+
<% end %>
14+
<% if presenter.valid_child_concerns.length > 0 %>
15+
<div class="btn-group">
16+
<button type="button" class="btn btn-secondary dropdown-toggle" type="button" id="dropdown-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
17+
<%= t('.attach_child') %>
18+
</button>
19+
<div class="dropdown-menu">
20+
<% presenter.valid_child_concerns.each do |concern| %>
21+
<%= link_to "Attach #{concern.human_readable_type}", polymorphic_path([main_app, :new, :hyrax, :parent, concern.model_name.singular.to_sym], parent_id: presenter.id), class: "dropdown-item" %>
22+
<% end %>
23+
</div>
24+
</div>
25+
<% end %>
26+
<%# OVERRIDE to validate delete permission %>
27+
<% if current_ability.can?(:delete, presenter.solr_document) %>
28+
<%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %>
29+
<% end %>
30+
<% if !workflow_restriction?(presenter) %>
31+
<% if presenter.show_deposit_for?(collections: @user_collections) %>
32+
<input type="checkbox" aria-label="Batch Documents" style="display:none" name="batch_document_ids[]" id="batch_document_<%= presenter.id %>" value="<%= presenter.id %>" class="batch_document_selector" checked="checked" />
33+
<%= button_tag t('hyrax.dashboard.my.action.add_to_collection'),
34+
class: 'btn btn-secondary submits-batches submits-batches-add',
35+
data: { toggle: "modal", target: "#collection-list-container" } %>
36+
<% end %>
37+
<% if presenter.work_featurable? %>
38+
<%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json),
39+
data: { behavior: 'feature' },
40+
class: presenter.display_feature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>
41+
42+
<%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json),
43+
data: { behavior: 'unfeature' },
44+
class: presenter.display_unfeature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>
45+
<% end %>
46+
<% end %>
47+
<% end %>
48+
</div>
49+
</div>
50+
51+
<!-- COinS hook for Zotero -->
52+
<span class="Z3988" title="<%= export_as_openurl_ctx_kev(presenter) %>"></span>
53+
<!-- Render Modals -->
54+
<%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %>

app/views/themes/scholarly_show/hyrax/base/_work_title.html.erb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
<div class="row">
33
<div class="col-md-6">
44
<% if index == 0 %>
5-
<h2><%= markdown(title) %>
6-
<small class="text-muted"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></small>
7-
</h2>
5+
<h2><%= markdown(title) %></h2><span class="ml-2 mt-2"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></span>
86
<% else %>
97
<h2><%= markdown(title) %></h2>
108
<% end %>

app/views/themes/scholarly_show/hyrax/base/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@
5454
<div class="col-sm-9 image-show-metadata">
5555
<%= render 'metadata', presenter: @presenter %>
5656
</div>
57-
<div class="col-sm-3">
57+
<div class="col-sm-3 text-center">
5858
<%= render('download_pdf', presenter: @presenter, file_set_id: @presenter.file_set_presenters.first.id) if @presenter.show_pdf_download_button? %>
5959
<%= render 'citations', presenter: @presenter %>
6060
<!-- analytics_button is disabled until future fix -->
6161
<%#= render 'analytics_button', presenter: @presenter %>
6262
</div>
6363
</div>
6464
<div class="row">
65-
<div class="col-sm-8">
65+
<div class="col-12 work-show-items">
6666
<%= render 'relationships', presenter: @presenter %>
6767
<% if @presenter.class == Hyrax::OerPresenter %>
6868
<%= render 'hyrax/oers/related_items', presenter: @presenter %>

spec/services/create_account_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
let(:account) { FactoryBot.build(:sign_up_account) }
77
let(:stubbed_admin_set) { double(AdminSetResource, id: "admin_set/id") }
88

9+
after do
10+
# Ensure we reset to the default tenant after each test
11+
Apartment::Tenant.switch!(Apartment.default_tenant)
12+
end
13+
914
describe '#create_tenant' do
1015
it 'creates a new apartment tenant' do
1116
expect(Apartment::Tenant).to receive(:create).with(account.tenant)

0 commit comments

Comments
 (0)