Skip to content

Commit

Permalink
Improve markup for contributors
Browse files Browse the repository at this point in the history
Why these changes are being introduced:

Authors are currently rendered within a `p` tag. This is not very
semantically meaningful.

Relevant ticket(s):

* [GDT-284](https://mitlibraries.atlassian.net/browse/GDT-284)

How this addresses that need:

This refactors the contributors section to a partial and renders
contributors as an unordered list. It is the same changeset that
was introduced in #191, but without displaying the contributor type,
which UXWS has deemed unnecessary at this time.

Side effects of this change:

None.
  • Loading branch information
jazairi committed May 29, 2024
1 parent ab1dfb6 commit 312eb97
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/partials/_results.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
}

.inner-heading {
Expand Down
11 changes: 10 additions & 1 deletion app/assets/stylesheets/partials/_shared.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
.result,
.full-record {
.authors {
.contributors {
font-size: 1.6rem;
font-weight: $fw-bold;
margin-bottom: 0.6em;
li {
display: inline;
}
li::after {
content: " ; ";
}
li:last-child:after {
content: "";
}
}

.data-info {
Expand Down
7 changes: 4 additions & 3 deletions app/views/record/_record_geo.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
</div>

<% if @record['contributors'].present? %>
<p class="authors">
<%= render partial: 'shared/authors', locals: { contributors: @record['contributors'] } %>
</p>
<span class="sr">Contributors: </span>
<ul class="list-inline contributors">
<%= render partial: 'shared/contributors', locals: { contributors: @record['contributors'] } %>
</ul>
<% end %>
<% if @record['alternateTitles'].present? %>
Expand Down
7 changes: 4 additions & 3 deletions app/views/search/_result.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
</span>
</p>

<p class="authors">
<%= render partial: 'shared/authors', locals: { contributors: result['contributors'] } %>
</p>
<span class="sr">Contributors: </span>
<ul class="list-inline truncate-list contributors">
<%= render partial: 'shared/contributors', locals: { contributors: result['contributors'] } %>
</ul>

<div class="result-highlights">
<%= render partial: 'search/highlights', locals: { result: result } %>
Expand Down
7 changes: 4 additions & 3 deletions app/views/search/_result_geo.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
</div>

<% if result_geo['contributors'] %>
<p class="authors truncate-list">
<%= render partial: 'shared/authors', locals: { contributors: result_geo['contributors'] } %>
</p>
<span class="sr">Contributors: </span>
<ul class="list-inline truncate-list contributors">
<%= render partial: 'shared/contributors', locals: { contributors: result_geo['contributors'] } %>
</ul>
<% end %>
<% if result_geo['summary'] %>
Expand Down
5 changes: 5 additions & 0 deletions app/views/shared/_contributors.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%= return if contributors.blank? %>
<% contributors.uniq.map do |contributor| %>
<li><%= link_to contributor['value'], results_path({ advanced: true, contributors: contributor['value'] }) %></li>
<% end %>

0 comments on commit 312eb97

Please sign in to comment.