Skip to content

Commit

Permalink
🧹 Adjust show pages
Browse files Browse the repository at this point in the history
This commit will adjust the show pages of various themes and make them
look better.
  • Loading branch information
kirkkwang committed Jan 15, 2025
1 parent d1c5331 commit 7223dbb
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 13 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/themes/cultural_show.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
dl.work-show dd {
border-bottom: 1px solid #ddd;

&:last-child {
border-bottom: none; /* Removes border for the last dd element */
}

.tabular {
border-bottom: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/hyrax/base/_work_description.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%# OVERRIDE Hyrax 5.0.1 to enable markdown in the work description, and remove autolink to search in description on show page %>

<% presenter.description.each do |description| %>
<p class="work_description"><%= markdown(description) %></p>
<p class="work_description"><%= simple_format(auto_link((markdown(description)))) %></p>
<% end %>
54 changes: 54 additions & 0 deletions app/views/themes/cultural_show/hyrax/base/_show_actions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<%# OVERRIDE Hyrax v5.0.1 Adjust permission checks for delete and add analytics button and add ENV to control turbolinks %>
<div class="row show-actions button-row-top-two-column justify-content-start mt-1">
<div class="pr-3">
<% if Hyrax.config.analytics_reporting? %>
<% # turbolinks needs to be turned off or the page will use the cache and the %>
<% # analytics graph will not show unless the page is refreshed. %>
<%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-secondary', data: { turbolinks: false } %>
<% end %>
<% if presenter.editor? && !workflow_restriction?(presenter) %>
<%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-secondary', data: { turbolinks: block_valkyrie_redirect? } %>
<% if presenter.member_count > 1 %>
<%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-secondary' %>
<% end %>
<% if presenter.valid_child_concerns.length > 0 %>
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" type="button" id="dropdown-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= t('.attach_child') %>
</button>
<div class="dropdown-menu">
<% presenter.valid_child_concerns.each do |concern| %>
<%= 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" %>
<% end %>
</div>
</div>
<% end %>
<%# OVERRIDE to validate delete permission %>
<% if current_ability.can?(:delete, presenter.solr_document) %>
<%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %>
<% end %>
<% if !workflow_restriction?(presenter) %>
<% if presenter.show_deposit_for?(collections: @user_collections) %>
<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" />
<%= button_tag t('hyrax.dashboard.my.action.add_to_collection'),
class: 'btn btn-secondary submits-batches submits-batches-add',
data: { toggle: "modal", target: "#collection-list-container" } %>
<% end %>
<% if presenter.work_featurable? %>
<%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'feature' },
class: presenter.display_feature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>

<%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'unfeature' },
class: presenter.display_unfeature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>
<% end %>
<% end %>
<% end %>
</div>
</div>

<!-- COinS hook for Zotero -->
<span class="Z3988" title="<%= export_as_openurl_ctx_kev(presenter) %>"></span>
<!-- Render Modals -->
<%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %>
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<% presenter.title.each_with_index do |title, index| %>
<div class="row">
<div class="col-12 text-show-title">
<div class="col-12 text-show-title d-flex">
<% if index == 0 %>
<h2><%= markdown(title) %>
<small class="text-muted"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></small>
</h2>
<h2><%= markdown(title) %></h2><span class="ml-2 mt-2"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></span>
<% else %>
<h2><%= markdown(title) %></h2>
<% end %>
Expand Down
8 changes: 5 additions & 3 deletions app/views/themes/cultural_show/hyrax/base/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
<div class="card-body">
<div class="row">
<%= render 'workflow_actions_widget', presenter: @presenter %>
<div class="col-12">
<%= render "show_actions", presenter: @presenter %>
</div>
<% if @presenter.video_embed_viewer? %>
<%= render 'video_embed_viewer', presenter: @presenter %>
<% elsif @presenter.iiif_viewer? %>
Expand All @@ -29,6 +26,9 @@
<%= render 'representative_media', presenter: @presenter, viewer: false %>
</div>
<% end %>
<div class="col-12">
<%= render "show_actions", presenter: @presenter %>
</div>
<div class="col-md-8">
<%= render 'work_description', presenter: @presenter %>
<%= render 'metadata', presenter: @presenter %>
Expand All @@ -38,7 +38,9 @@
<%= render 'relationships', presenter: @presenter %>
</div>
<%= render('download_pdf', presenter: @presenter, file_set_id: @presenter.file_set_presenters.first.id) if @presenter.show_pdf_download_button? %>
<div class="d-flex justify-content-center">
<%= render 'citations', presenter: @presenter %>
</div>
<!-- analytics_button is disabled until future fix -->
<%#= render 'analytics_button', presenter: @presenter %>
</div>
Expand Down
54 changes: 54 additions & 0 deletions app/views/themes/scholarly_show/hyrax/base/_show_actions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<%# OVERRIDE Hyrax v5.0.1 Adjust permission checks for delete and add analytics button and add ENV to control turbolinks %>
<div class="row show-actions button-row-top-two-column justify-content-end">
<div class="pr-3">
<% if Hyrax.config.analytics_reporting? %>
<% # turbolinks needs to be turned off or the page will use the cache and the %>
<% # analytics graph will not show unless the page is refreshed. %>
<%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-secondary', data: { turbolinks: false } %>
<% end %>
<% if presenter.editor? && !workflow_restriction?(presenter) %>
<%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-secondary', data: { turbolinks: block_valkyrie_redirect? } %>
<% if presenter.member_count > 1 %>
<%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-secondary' %>
<% end %>
<% if presenter.valid_child_concerns.length > 0 %>
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" type="button" id="dropdown-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= t('.attach_child') %>
</button>
<div class="dropdown-menu">
<% presenter.valid_child_concerns.each do |concern| %>
<%= 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" %>
<% end %>
</div>
</div>
<% end %>
<%# OVERRIDE to validate delete permission %>
<% if current_ability.can?(:delete, presenter.solr_document) %>
<%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %>
<% end %>
<% if !workflow_restriction?(presenter) %>
<% if presenter.show_deposit_for?(collections: @user_collections) %>
<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" />
<%= button_tag t('hyrax.dashboard.my.action.add_to_collection'),
class: 'btn btn-secondary submits-batches submits-batches-add',
data: { toggle: "modal", target: "#collection-list-container" } %>
<% end %>
<% if presenter.work_featurable? %>
<%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'feature' },
class: presenter.display_feature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>

<%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'unfeature' },
class: presenter.display_unfeature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %>
<% end %>
<% end %>
<% end %>
</div>
</div>

<!-- COinS hook for Zotero -->
<span class="Z3988" title="<%= export_as_openurl_ctx_kev(presenter) %>"></span>
<!-- Render Modals -->
<%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<div class="row">
<div class="col-md-6">
<% if index == 0 %>
<h2><%= markdown(title) %>
<small class="text-muted"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></small>
</h2>
<h2><%= markdown(title) %></h2><span class="ml-2 mt-2"><%= presenter.permission_badge %> <%= presenter.workflow.badge %></span>
<% else %>
<h2><%= markdown(title) %></h2>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/themes/scholarly_show/hyrax/base/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
<div class="col-sm-9 image-show-metadata">
<%= render 'metadata', presenter: @presenter %>
</div>
<div class="col-sm-3">
<div class="col-sm-3 text-center">
<%= render('download_pdf', presenter: @presenter, file_set_id: @presenter.file_set_presenters.first.id) if @presenter.show_pdf_download_button? %>
<%= render 'citations', presenter: @presenter %>
<!-- analytics_button is disabled until future fix -->
<%#= render 'analytics_button', presenter: @presenter %>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<div class="col-12 work-show-items">
<%= render 'relationships', presenter: @presenter %>
<% if @presenter.class == Hyrax::OerPresenter %>
<%= render 'hyrax/oers/related_items', presenter: @presenter %>
Expand Down

0 comments on commit 7223dbb

Please sign in to comment.