-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the DocumentMetadataComponent to render email + sms fields
- Loading branch information
Showing
13 changed files
with
41 additions
and
196 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
17 changes: 17 additions & 0 deletions
17
app/components/blacklight/metadata_field_plain_text_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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module Blacklight | ||
class MetadataFieldPlainTextLayoutComponent < Blacklight::MetadataFieldLayoutComponent | ||
with_collection_parameter :field | ||
|
||
def initialize(field:, **kwargs) | ||
super(field: field, **kwargs, value_tag: nil) | ||
end | ||
|
||
# rubocop:disable Rails/OutputSafety | ||
def call | ||
[label.to_s.strip, helpers.strip_tags(CGI.unescape_html(safe_join(values, "\n")).strip)].compact.join(' ').html_safe | ||
end | ||
# rubocop:enable Rails/OutputSafety | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<%= t('blacklight.email.text.message', message: @message) %> | ||
|
||
<% @documents.each do |document| %> | ||
<%= document.to_email_text %> | ||
<%= t('blacklight.email.text.url', :url =>polymorphic_url(document, @url_gen_params)) %> | ||
<%= render Blacklight::DocumentMetadataComponent.new(fields: document_presenter(document).field_presenters(blacklight_config.email_fields), tag: nil, field_layout: Blacklight::MetadataFieldPlainTextLayoutComponent, field_presenter_options: { format: 'text' }) %> | ||
|
||
<%= t('blacklight.email.text.url', url: polymorphic_url(document, @url_gen_params)) %> | ||
<% end %> | ||
<%= t('blacklight.email.text.message', :message => @message) %> |
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,4 @@ | ||
<% @documents.each do |document| %> | ||
<%= document.to_sms_text(@config) %> | ||
<%= t('blacklight.sms.text.url', :url => polymorphic_url(document, @url_gen_params) ) %> | ||
<% end %> | ||
<% @documents.each do |document| %> | ||
<%= render Blacklight::DocumentMetadataComponent.new(fields: document_presenter(document).field_presenters(blacklight_config.sms_fields), tag: nil, field_layout: Blacklight::MetadataFieldPlainTextLayoutComponent, field_presenter_options: { format: 'text' }) %> | ||
<%= t('blacklight.sms.text.url', url: polymorphic_url(document, @url_gen_params)) %> | ||
<% 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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