-
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.
Merge pull request #396 from trln/TD-1264-bugfix-dd-metadata
Bugfix for wayward dd elements appearing throughout metadata displays…
- Loading branch information
Showing
16 changed files
with
73 additions
and
47 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 |
---|---|---|
@@ -1 +1 @@ | ||
2.2.3 | ||
2.2.4 |
9 changes: 6 additions & 3 deletions
9
app/components/trln_argon/document_header_metadata_component.html.erb
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<ul> | ||
<dl> | ||
<% @fields.each do |field| -%> | ||
<%= @view_context.render(field_component(field).new(field: field, show: @show, layout: TrlnArgon::MetadataHeaderFieldLayoutComponent)) %> | ||
<%= @view_context.render(field_component(field).new( | ||
field: field, | ||
show: @show, | ||
layout: TrlnArgon::MetadataHeaderFieldLayoutComponent)) %> | ||
<% end -%> | ||
</ul> | ||
</dl> |
4 changes: 2 additions & 2 deletions
4
app/components/trln_argon/document_metadata_list_component.html.erb
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<ul> | ||
<dl> | ||
<% @fields.each do |field| -%> | ||
<%= @view_context.render(field_component(field).new(field: field, show: @show, layout: TrlnArgon::MetadataListFieldLayoutComponent)) %> | ||
<% end -%> | ||
</ul> | ||
</dl> |
6 changes: 4 additions & 2 deletions
6
app/components/trln_argon/metadata_field_layout_component.html.erb
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<div> | ||
<dt class="blacklight-<%= @key %> <%= @label_class %>"><%= label %></dt> | ||
<dd class="blacklight-<%= @key %> <%= @value_class %>"><%= value %></dd> | ||
</div> | ||
<% values.each do |v| %> | ||
<%= v %> | ||
<% end %> | ||
</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 |
---|---|---|
@@ -1,16 +1,11 @@ | ||
module TrlnArgon | ||
class MetadataFieldLayoutComponent < Blacklight::MetadataFieldLayoutComponent | ||
|
||
# @param field [Blacklight::FieldPresenter] | ||
def initialize(field:, label_class: '', value_class: '') | ||
@field = field | ||
@key = @field.key.parameterize | ||
@label_class = label_class | ||
@value_class = value_class | ||
end | ||
|
||
def render? | ||
value.present? | ||
end | ||
end | ||
end |
7 changes: 4 additions & 3 deletions
7
app/components/trln_argon/metadata_header_field_layout_component.html.erb
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<li class="index-metadata <%= @key %>"> | ||
<%= value %> | ||
</li> | ||
<dt class="blacklight-<%= @key %> <%= @label_class %>"><%= label %></dt> | ||
<% values.each do |v| %> | ||
<%= v %> | ||
<% end %> |
20 changes: 14 additions & 6 deletions
20
app/components/trln_argon/metadata_header_field_layout_component.rb
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 |
---|---|---|
@@ -1,12 +1,20 @@ | ||
module TrlnArgon | ||
class MetadataHeaderFieldLayoutComponent < Blacklight::MetadataFieldLayoutComponent | ||
# rubocop:disable Style/RedundantParentheses | ||
def initialize(field:, label_class: 'sr-only', value_class: '') | ||
super | ||
@field = field | ||
@key = @field.key.parameterize | ||
@label_class = label_class | ||
@value_class = value_class | ||
end | ||
|
||
# values is an Array of ViewComponent::SlotV2 | ||
# objects, each containing html markup, some with only | ||
# \n for content. So this requires gymnastics. | ||
def render? | ||
# value is actually a ViewComponent::SlotV2 and is probably | ||
# not nil? | ||
# Rubocop lies, I find this clearer | ||
!(value&.to_s.blank?) | ||
values.map(&:to_s) | ||
.map { |v| strip_tags(v).squish } | ||
.compact_blank.present? | ||
end | ||
# rubocop:enable Style/RedundantParentheses | ||
end | ||
end |
5 changes: 4 additions & 1 deletion
5
app/components/trln_argon/metadata_list_field_layout_component.html.erb
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
<%= value %> | ||
<dt class="blacklight-<%= @key %> <%= @label_class %>"><%= label %></dt> | ||
<% values.each do |v| %> | ||
<%= v %> | ||
<% end %> |
8 changes: 6 additions & 2 deletions
8
app/components/trln_argon/metadata_list_field_layout_component.rb
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 |
---|---|---|
@@ -1,7 +1,11 @@ | ||
module TrlnArgon | ||
class MetadataListFieldLayoutComponent < Blacklight::MetadataFieldLayoutComponent | ||
def render? | ||
value.present? | ||
def initialize(field:, label_class: 'sr-only', value_class: '') | ||
super | ||
@field = field | ||
@key = @field.key.parameterize | ||
@label_class = label_class | ||
@value_class = value_class | ||
end | ||
end | ||
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div id="show-sub-header" class="<%= show_sub_header_class %>"> | ||
<%= render(TrlnArgon::DocumentHeaderMetadataComponent.new(fields: show_sub_header_presenter(document).field_presenters)) %> | ||
</div> | ||
</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
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
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
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
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
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