Skip to content

Commit 559ee49

Browse files
authored
Merge pull request #3349 from projectblacklight/release-8.x-3272
Add configuration to opt-in to the new paginator layout. Backports #3272
2 parents 26651bf + dea7bc0 commit 559ee49

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

app/views/kaminari/blacklight/_paginator.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
<%= paginator.render do -%>
1212
<ul class="pagination">
1313
<%= prev_page_tag %>
14-
<%= next_page_tag %>
14+
<%= next_page_tag if Blacklight::Engine.config.blacklight.paginator[:next_page_position] == :before %>
1515
<% each_relevant_page do |page| -%>
1616
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
1717
<%= page_tag page %>
1818
<% elsif !page.was_truncated? -%>
1919
<%= gap_tag %>
2020
<% end -%>
2121
<% end -%>
22+
<%= next_page_tag if Blacklight::Engine.config.blacklight.paginator[:next_page_position] == :after %>
2223
</ul>
2324
<% end -%>

lib/blacklight/engine.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ class Engine < Rails::Engine
7272
outer_window: 2
7373
}
7474

75+
# Blacklight 9 moves the next button after the page numbers. This behavior can be configured
76+
# in Blacklight 8 by setting the next_button_position to :after
77+
bl_global_config.paginator = {
78+
next_button_position: :before
79+
}
80+
7581
bl_global_config.search_params_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol]
7682

7783
# Anything that goes into Blacklight::Engine.config is stored as a class

spec/features/search_context_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@
4747
search_for ''
4848
expect(page).to have_content "1 - 10"
4949
find_all('.index_title a').last.click
50+
expect(page).to have_css "h1", text: "Pluvial nectar"
5051
click_on "Next »"
5152

52-
expect(page).to have_content "Naqdī barā-yi tamām-i"
53+
expect(page).to have_css "h1", text: "Naqdī barā-yi tamām-i"
5354
click_on "Back to Search"
5455
expect(page).to have_content "11 - 20"
5556
end

0 commit comments

Comments
 (0)