-
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.
Merge pull request #4480 from pulibrary/i4187_previous_next_to_view_c…
…omponent Use ServerItemPaginationComponent
- Loading branch information
Showing
10 changed files
with
97 additions
and
63 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 |
5 changes: 5 additions & 0 deletions
5
app/components/orangelight/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,5 @@ | ||
<div class="page-links"> | ||
<%= link_to_previous_document %> | ||
<%= link_to_next_document %> | ||
<%= item_page_entry_info %> | ||
</div> |
4 changes: 4 additions & 0 deletions
4
app/components/orangelight/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,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class Orangelight::SearchContext::ServerItemPaginationComponent < Blacklight::SearchContext::ServerItemPaginationComponent | ||
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,57 +1 @@ | ||
<% #Using the Bootstrap Pagination class -%> | ||
<div class='pagination-search-widgets col'> | ||
<div class="row"> | ||
<div class="col-xs-12 px-4"> | ||
<div class="button--start-over"> | ||
<%= render_start_over_link(root_path) %> | ||
</div> | ||
<% if @search_context %> | ||
<% if @search_context[:prev] || @search_context[:next] %> | ||
<%= link_back_to_catalog_safe class: 'btn btn-default button--back-to-search', label: t('blacklight.back_to_search').html_safe %> | ||
<div class="page_links"> | ||
<%= link_to_previous_document @search_context[:prev] %> | ||
<%= link_to_next_document @search_context[:next] %> | ||
<%= item_page_entry_info %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<div class="search-widgets col pr-4"> | ||
<ul class="navbar navbar-nav pull-right"> | ||
<% if @document.alma_record? || @document.scsb_record? %> | ||
<li> | ||
<%= render_cite_link(citation_solr_document_path(id: @document)) %> | ||
</li> | ||
<% end %> | ||
<li class="dropdown"> | ||
<button class="btn btn-outline-primary dropdown-toggle" data-toggle="dropdown"><span class="icon-share" aria-hidden="true"></span> Send <span class="d-none d-lg-inline">to <span class="caret"></span></span></button> | ||
<ul class="dropdown-menu position-absolute"> | ||
<li class="sms"> | ||
<%= link_to "SMS", sms_solr_document_path(:id => @document), {:id => 'smsLink', :data => {:blacklight_modal => "trigger"}, class: "icon-mobile dropdown-item", rel: 'nofollow'} %> | ||
</li> | ||
<li class="email"> | ||
<%= link_to "Email", email_solr_document_path(:id => @document), {:id => 'emailLink', :data => {:blacklight_modal => "trigger"}, class: "icon-email dropdown-item", rel: 'nofollow'} %> | ||
</li> | ||
<% if @document.alma_record? %> | ||
<li class="endnote"> | ||
<%= link_to "EndNote", solr_document_path(@document, :format => 'endnote'), rel: 'nofollow', class: "icon-external dropdown-item" %> | ||
</li> | ||
<li class="refworks"> | ||
<%= link_to "RefWorks", refworks_export_url({url: polymorphic_url(search_state.url_for_document(@document), format: :refworks_marc_txt, only_path: false)}), rel: 'nofollow', class: "icon-external dropdown-item", :target => "_blank" %> | ||
</li> | ||
<li class="ris"> | ||
<%= link_to 'RIS', solr_document_path(@document, :format => 'ris'), rel: 'nofollow', class: "icon-external dropdown-item" %> | ||
</li> | ||
<% end %> | ||
<li class="print"> | ||
<a href="javascript:if(window.print)window.print()" class="dropdown-item"><span class="icon-print" aria-hidden="true"></span>Printer</a> | ||
</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<%= render BookmarkButtonComponent.new(document: @document) if current_or_guest_user %> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
<%= render(Orangelight::SearchContext::ServerItemPaginationComponent.new(search_context: @search_context, search_session: search_session, current_document: @document)) %> |
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,37 @@ | ||
<div class="search-widgets col pr-4"> | ||
<ul class="navbar navbar-nav pull-right"> | ||
<% if @document.alma_record? || @document.scsb_record? %> | ||
<li> | ||
<%= render_cite_link(citation_solr_document_path(id: @document)) %> | ||
</li> | ||
<% end %> | ||
<li class="dropdown"> | ||
<button class="btn btn-outline-primary dropdown-toggle" data-toggle="dropdown"><span class="icon-share" aria-hidden="true"></span> Send <span class="d-none d-lg-inline">to <span class="caret"></span></span></button> | ||
<ul class="dropdown-menu position-absolute"> | ||
<li class="sms"> | ||
<%= link_to "SMS", sms_solr_document_path(:id => @document), {:id => 'smsLink', :data => {:blacklight_modal => "trigger"}, class: "icon-mobile dropdown-item", rel: 'nofollow'} %> | ||
</li> | ||
<li class="email"> | ||
<%= link_to "Email", email_solr_document_path(:id => @document), {:id => 'emailLink', :data => {:blacklight_modal => "trigger"}, class: "icon-email dropdown-item", rel: 'nofollow'} %> | ||
</li> | ||
<% if @document.alma_record? %> | ||
<li class="endnote"> | ||
<%= link_to "EndNote", solr_document_path(@document, :format => 'endnote'), rel: 'nofollow', class: "icon-external dropdown-item" %> | ||
</li> | ||
<li class="refworks"> | ||
<%= link_to "RefWorks", refworks_export_url({url: polymorphic_url(search_state.url_for_document(@document), format: :refworks_marc_txt, only_path: false)}), rel: 'nofollow', class: "icon-external dropdown-item", :target => "_blank" %> | ||
</li> | ||
<li class="ris"> | ||
<%= link_to 'RIS', solr_document_path(@document, :format => 'ris'), rel: 'nofollow', class: "icon-external dropdown-item" %> | ||
</li> | ||
<% end %> | ||
<li class="print"> | ||
<a href="javascript:if(window.print)window.print()" class="dropdown-item"><span class="icon-print" aria-hidden="true"></span>Printer</a> | ||
</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<%= render BookmarkButtonComponent.new(document: @document) if current_or_guest_user %> | ||
</li> | ||
</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
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