-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Override the relations component to fix styling
This ensures that the relations widget displays with styling more similar to the other sections in our sidebar.
- Loading branch information
1 parent
bd8dc5d
commit d8f6d02
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="card relations relationship-<%= relationship_type.downcase %>"> | ||
<div class="card-header"> | ||
<h2 class="h4"><%= t("#{rel_type_info.label}") %></h2> | ||
</div> | ||
|
||
<ul class="list-group list-group-flush"> | ||
<% relationship_type_results['docs'][0..2].map { |hash| SolrDocument.new(hash) }.each do |doc| %> | ||
<li class="list-group-item border-bottom-0"> | ||
<%= link_to solr_document_path(doc) do %> | ||
<%= relations_icon(doc, rel_type_info.icon) unless rel_type_info.icon.nil? %> | ||
<%= doc.title %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
<% unless (relationship_type_results['numFound'].to_i <= 3) %> | ||
<li class="list-group-item border-bottom-0"> | ||
<%= link_to search_catalog_path({f: {"#{Settings.RELATIONSHIPS_SHOWN.public_send(relationship_type).field}" => [relations.link_id]}}) do %> | ||
<%= t('geoblacklight.relations.browse_all', count: relationship_type_results['numFound']) %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class RelationsComponent < Geoblacklight::RelationsComponent | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%- Settings.RELATIONSHIPS_SHOWN.each do |relationship_type, rel_type_info| %> | ||
<%= render RelationsComponent.new(relations: @relations, relationship_type:, rel_type_info:) %> | ||
<% end %> |