Skip to content

Commit

Permalink
show back to search and start over for 1 result show pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Jan 28, 2015
1 parent 072e64f commit fe8fed1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/assets/stylesheets/blacklight/_catalog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ label.toggle_bookmark
padding-bottom: $padding-base-vertical;
}

#sortAndPerPage, #previousNextDocument {
#sortAndPerPage, .pagination-search-widgets {
border-bottom: 1px solid $pagination-border;
margin-bottom: 1em;
padding-bottom: 1em;
}

#previousNextDocument {
.pagination-search-widgets {
@extend .clearfix;
padding-top: 1px;
padding-bottom: $padding-base-vertical;
Expand Down
22 changes: 12 additions & 10 deletions app/views/catalog/_previous_next_doc.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<% #Using the Bootstrap Pagination class -%>
<% if @previous_document || @next_document %>
<div id="previousNextDocument">
<% #DEPRECATED - using id="previousNextDocument" as a selector is deprecated and will be removed in Blacklight 6.0 %>
<div id='previousNextDocument' class='pagination-search-widgets'>
<% if @previous_document || @next_document %>
<div class="page_links">
<%= link_to_previous_document @previous_document %> |
<%= item_page_entry_info %> |
<%= link_to_next_document @next_document %>
</div>
</div>
<% end %>
<% if current_search_session %>
<div class="pull-right search-widgets">
<%= link_back_to_catalog :class => 'btn' %>
<%=link_to "#{t('blacklight.search.start_over')}", start_over_path(current_search_session.try(:query_params) || {}), :id=>"startOverLink", :class => 'btn' %>
</div>
</div>
<% end %>
<%= link_back_to_catalog class: 'btn' %>
<%=link_to t('blacklight.search.start_over'), start_over_path(current_search_session.try(:query_params) || {}), id: 'startOverLink', class: 'btn' %>
</div>
<% end %>
</div>
13 changes: 11 additions & 2 deletions spec/features/search_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
search_id = Search.last.id.to_s
click_on 'Pluvial nectar of blessings'
expect(page).to have_content "« Previous | 10 of 30 | Next »"
prev = page.find("#previousNextDocument .previous")
prev = page.find(".pagination-search-widgets .previous")
expect(prev['data-context-href']).to eq "/catalog/2003546302/track?counter=9&search_id=#{search_id}"

click_on "« Previous"

prev = page.find("#previousNextDocument .previous")
prev = page.find(".pagination-search-widgets .previous")
expect(prev['data-context-href']).to eq "/catalog/2004310986/track?counter=8&search_id=#{search_id}"
end

Expand All @@ -23,6 +23,15 @@
expect(page).to have_content "« Previous | 1 of 30 | Next »"
expect(page.current_url).to_not have_content "/track"
end

it 'should show "Back to Search" and "Start Over links"' do
search_for 'Bod kyi naṅ chos ṅo sprod sñiṅ bsdus'
first('.index_title a').click
within '.pagination-search-widgets' do
expect(page).to have_css 'a', text: 'Back to Search'
expect(page).to have_css 'a', text: 'Start Over'
end
end

context "navigating between search results using context pagination" do
it "should update the back to search link with the current search pagination context" do
Expand Down
1 change: 1 addition & 0 deletions spec/views/catalog/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
before :each do
allow(view).to receive_messages(:has_user_authentication_provider? => false)
allow(view).to receive_messages(:render_document_sidebar_partial => "Sidebar")
allow(view).to receive_messages(current_search_session: nil)
assign :document, document
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
end
Expand Down

0 comments on commit fe8fed1

Please sign in to comment.