Move bootstrap pagination list wrapper to template
This commit is contained in:
parent
8a6c34fa78
commit
b7ce0f09e6
2 changed files with 3 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
|||
<div class="d-flex flex-wrap gap-2">
|
||||
<h4 class="fs-5 mb-0"><%= heading %></h4>
|
||||
<% if pages.page_count > 1 %>
|
||||
<div class="ms-auto">
|
||||
<ul class="pagination pagination-sm mb-1 ms-auto">
|
||||
<%= raw pagination_links_bootstrap(pages, {}) { |n| url_for(page_param => n) } %>
|
||||
</div>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -133,6 +133,7 @@ module ActionView
|
|||
|
||||
# Same as above, but
|
||||
# - with bootstrap classes
|
||||
# - no list wrapper
|
||||
# - invoked block returns the page url
|
||||
def pagination_links_bootstrap(paginator, options)
|
||||
options = DEFAULT_OPTIONS.merge(options)
|
||||
|
@ -148,8 +149,6 @@ module ActionView
|
|||
|
||||
html = ""
|
||||
|
||||
html << "<ul class='pagination pagination-sm mb-1'>"
|
||||
|
||||
if always_show_anchors && !(wp_first = window_pages[0]).first?
|
||||
html << bootstrap_page_item_link(first.number.to_s, yield(first.number))
|
||||
html << bootstrap_page_item_disabled("...") if wp_first.number - first.number > 1
|
||||
|
@ -168,8 +167,6 @@ module ActionView
|
|||
html << bootstrap_page_item_link(last.number.to_s, yield(last.number))
|
||||
end
|
||||
|
||||
html << "</ul>"
|
||||
|
||||
html
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue