Skip to content

Commit

Permalink
HYC-1787 - Display issues on collection pages (hyrax-4) (#1026)
Browse files Browse the repository at this point in the history
* hyc-1787 - Add spacing between work thumbnail and title in collection page

* Add hyc-override tags to override files that were missing them

* Mark where our overrides our and merge in a few upstream changes

* Fix rendering of the description modal

* Get 'Show More' button on collection pages working again

* Fix subcollection dropdown styles

* Fix spacing between work thumbnail and title on public collection page

* Prevent Refresh button from wrapping down onto the table below it
  • Loading branch information
bbpennel authored Oct 11, 2023
1 parent a8083a1 commit 297eed3
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 21 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/unc/unc_custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ $(function() {
hideNonRequiredFieldsBtn();
hideNonRequiredFormFields();
removeCloning();
toggleCollectionPageDescription();
showRemoveOption();

// Make sure that form visibility and datepicker work with turbolinks
Expand Down
14 changes: 14 additions & 0 deletions app/assets/stylesheets/unc_custom.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,20 @@ table p.name span {
font-size: 18px;
}

.hyc-container, .collection-works-table {
.media-left {
margin-right: 1rem;
}
}

.collections-wrapper {
.batch-info {
.form-control-lg, .sort-toggle {
height: auto;
}
}
}

.social-media {
.sr-only {
color: $carolina-blue;
Expand Down
2 changes: 2 additions & 0 deletions app/views/hyrax/collections/_collection_description.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<%# [hyc-override] https://github.com/samvera/hyrax/blob/hyrax-v4.0.0/app/views/hyrax/collections/_collection_description.html.erb %>
<%# [hyc-override] truncate the description field by default %>
<% presenter.description.each do |description| %>
<% if description.split.size > 100 %>
<div class="truncated">
Expand Down
1 change: 0 additions & 1 deletion app/views/hyrax/collections/_show_descriptions.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<%# [hyc-override] Partial to display language term instead of link %>
<%# @TODO This file changes significantly in Hyrax 3.0 %>
<dl class="hyc-collection-metadata">
<% @presenter.terms_with_values.each do |field_name| %>
<div id=<%= "hyc-collection-metadata-#{field_name}" %>>
Expand Down
7 changes: 4 additions & 3 deletions app/views/hyrax/collections/_subcollection_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%# [hyc-override] https://github.com/samvera/hyrax/blob/hyrax-v4.0.0/app/views/hyrax/collections/_subcollection_list.html.erb %>
<% if @subcollection_docs.nil? || @subcollection_docs.empty? %>
<div class="alert alert-warning" role="alert"><%= t('hyrax.collections.show.no_visible_subcollections') %></div>
<% else %>
Expand All @@ -6,13 +7,13 @@
Subcollections (<%= @subcollection_count %>)
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="sub-collection-list">
<div class="dropdown-menu" aria-labelledby="sub-collection-list">
<% @subcollection_docs.each do |document| %>
<li>
<% id = document.id %>
<%= link_to document.title_or_label, [hyrax, document], id: "src_copy_link_#{id}" %>
<%= link_to document.title_or_label, [hyrax, document], id: "src_copy_link_#{id}", class: "dropdown-item" %>
</li>
<% end %>
</ul>
</div>
</div>
<% end %>
47 changes: 30 additions & 17 deletions app/views/hyrax/collections/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%# [hyc-override] https://github.com/samvera/hyrax/blob/hyrax-v4.0.0/app/views/hyrax/collections/show.html.erb %>
<% provide :page_title, construct_page_title(@presenter.title) %>
<div class="hyc-container" itemscope itemtype="http://schema.org/CollectionPage">
<div class="row hyc-header">
Expand All @@ -6,6 +7,7 @@
<% unless @presenter.banner_file.blank? %>
<header class="hyc-banner" style="background-image:url(<%= @presenter.banner_file %>)">
<% else %>
<%# [hyc-override] Set a default banner image %>
<header class="hyc-generic" style="background-image:url(<%= image_path('cdr-banner-bg.png') %>)">
<% end %>

Expand All @@ -15,10 +17,10 @@
<%= @presenter.permission_badge %>
</div>


<div class="hyc-logos">
<% unless @presenter.logo_record.blank? %>
<% unless @presenter.logo_record.blank? %>
<div class="hyc-logos">
<% @presenter.logo_record.each_with_index do |lr, i| %>

<% if lr[:linkurl].blank? %>
<img alt="<%= lr[:alttext] %>" src="<%= lr[:file_location] %>" />
<% else %>
Expand All @@ -27,46 +29,54 @@
</a>
<% end %>
<% end %>
<% else %>
<img alt="UNC logo" src="<%= image_path('unc-icon.png') %>" />
<% end %>
</div>
</div>
<% else %>
<%# [hyc-override] Show a default logo %>
<div class="hyc-logos">
<img alt="UNC logo" src="<%= image_path('unc-icon.png') %>" />
</div>
<% end %>
</header>
</div>
</div>

<%# [hyc-override] Move subcollections list to the top %>
<!-- Subcollections -->
<% if @presenter.collection_type_is_nestable? && @subcollection_count > 0 %>
<div class="hyc-blacklight hyc-bl-results col-md-12">
<%# [hyc-override] Remove the section header %>
<div class="hyc-blacklight hyc-bl-results">
<%= render 'subcollection_list', collection: @subcollection_docs %>
</div>
<% end %>

<div class="row hyc-body">
<%# [hyc-override] Made 12 columns instead of 8 to account for removing description %>
<div class="col-md-12 hyc-description">
<%= render 'collection_description', presenter: @presenter %>

<% if @presenter.collection_type_is_nestable? && @presenter.total_parent_collections > 0 %>
<div class="hyc-blacklight hyc-bl-title">
<h2>
<%# [hyc-override] Remove display of count %>
<%= t('.parent_collection_header') %>:
</h2>
</div>
<div class="hyc-blacklight hyc-bl-results sub-collection">
<%= render 'show_parent_collections', presenter: @presenter %>
</div>
<% end %>

<%# [hyc-override] Removed metadata display to a modal %>
</div>
</div>

<!-- Search results label -->
<% if @members_count > 0 || @presenter.subcollection_count > 0 %>
<div class="hyc-blacklight hyc-bl-title">
<% if collection_search_parameters? %>
<h2>
<% if has_collection_search_parameters? %>
<%= t('hyrax.dashboard.collections.show.search_results') %>
<% end %>
<%= t('hyrax.dashboard.collections.show.search_results') %>
</h2>
<% end %>
</div>
<% end %>

Expand All @@ -76,11 +86,13 @@
<%= render 'search_form', presenter: @presenter, url: hyrax.collection_path(@presenter.id) %>

</div>
<%# [hyc-override] Add a button to display the metadata modal %>
<button class="btn btn-primary more-metadata-btn" data-toggle="modal" data-target="#collection-metadata-modal">View detailed metadata</button>
</div>

<!-- Works -->
<% if @members_count > 0 %>
<%# [hyc-override] Added outer div for styling %>
<div class="works">
<div class="hyc-blacklight hyc-bl-title">
<h4><%= t('.works_in_collection') %> (<%= @members_count %>)</h4>
Expand All @@ -101,18 +113,19 @@
<% end # if @members_count > 0 %>
</div>
<%# [hyc-override] Added modal for displaying metadata %>
<div class="modal fade" id="collection-metadata-modal" tabindex="-1" role="dialog" aria-labelledby="collection-modal-title" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h2 class="modal-title text-center" id="collection-modal-title"><%= t('hyrax.dashboard.collections.show.metadata_header') %></h2>
<h2 class="modal-title" id="collection-modal-title"><%= t('hyrax.dashboard.collections.show.metadata_header') %></h2>
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t('hyrax.dashboard.heading_actions.close') %>"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body unc-modal">
<%= render 'show_descriptions' %>
</div>
</div>
</div>
</div>
<span class='hide analytics-event' data-category="collection" data-action="collection-page-view" data-name="<%= @presenter.id %>" >

0 comments on commit 297eed3

Please sign in to comment.