-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit c27bf59 Co-authored-by: Kevin Reiss <[email protected]> Co-authored-by: Max Kadel <[email protected]> Co-authored-by: regineheberlein <[email protected]> Co-authored-by: Ryan Laddusaw <[email protected]>
- Loading branch information
1 parent
5b8b80a
commit 401453b
Showing
8 changed files
with
88 additions
and
11 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
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
11 changes: 11 additions & 0 deletions
11
app/components/blacklight/search_context/server_item_pagination_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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<%# This can be removed after migrating to Blacklight 8 %> | ||
<div class='pagination-search-widgets'> | ||
|
||
<div class="page-links"> | ||
<%= link_to_previous_document %> | | ||
|
||
<%= item_page_entry_info %> | | ||
|
||
<%= link_to_next_document %> | ||
</div> | ||
</div> |
18 changes: 18 additions & 0 deletions
18
app/components/blacklight/search_context/server_item_pagination_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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
# This can be removed after migrating to Blacklight 8 | ||
module Blacklight | ||
module SearchContext | ||
# This class makes the ServerItemPaginationComponent that is present in Blacklight 8 | ||
# available while we are still on Blacklight 7 | ||
class ServerItemPaginationComponent < Blacklight::SearchContextComponent | ||
with_collection_parameter :search_context | ||
|
||
def initialize(search_context:, search_session:, current_document:) | ||
@search_context = search_context | ||
@search_session = search_session | ||
@current_document_id = current_document.id | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
# This module provides the body of an email export based on the document's semantic values | ||
module Blacklight | ||
module Document | ||
module Email | ||
include ActionView::Helpers::UrlHelper | ||
# Return a text string that will be the body of the email | ||
def to_email_text | ||
body = [] | ||
add_bibliographic_text(body) | ||
add_online_text(body, self[:electronic_access_1display]) | ||
body.join("\n") unless body.empty? | ||
end | ||
|
||
private | ||
|
||
def add_single_valued_field(body, i18_label, value) | ||
body << I18n.t(i18_label, value:) if value.present? | ||
end | ||
|
||
def add_multi_valued_field(body, i18_label, value) | ||
value.each { |v| add_single_valued_field(body, i18_label, v) } if value.present? | ||
end | ||
|
||
def add_bibliographic_text(body) | ||
add_single_valued_field(body, 'blacklight.email.text.title', self[:title_vern_display]) | ||
add_single_valued_field(body, 'blacklight.email.text.title', self[:title_display]) | ||
add_multi_valued_field(body, 'blacklight.email.text.author', self[:author_display]) | ||
add_multi_valued_field(body, 'blacklight.email.text.publish', self[:pub_created_display]) | ||
add_multi_valued_field(body, 'blacklight.email.text.format', self[:format]) | ||
end | ||
|
||
def add_online_text(body, links_field) | ||
if links_field.present? | ||
body << I18n.t('blacklight.email.text.online') | ||
links = JSON.parse(links_field) | ||
links.each do |url, text| | ||
link = "#{text[0]}: #{url}" | ||
link = "#{text[1]} - " + link if text[1] | ||
body << "\t" + link | ||
end | ||
end | ||
end | ||
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
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