Overwrite Bootstrap Link Renderer for WillPaginate

Without this fix, the new will_paginate version is not compatible with the old version of bootstrap-will_paginate. This issue is also tracked here: https://github.com/mislav/will_paginate/issues/649

Fixes CODEOCEAN-QK
This commit is contained in:
Sebastian Serth
2023-06-14 14:28:10 +02:00
parent 677289e5c2
commit d1a0012d4f
2 changed files with 17 additions and 0 deletions

View File

@ -7,3 +7,13 @@ unless Array.respond_to?(:average)
end end
end end
end end
module WillPaginate
module ActionView
class Bootstrap4LinkRenderer
def previous_or_next_page(page, text, classname, aria_label = nil)
tag :li, link(text, page || '#', class: 'page-link', 'aria-label': aria_label), class: [(classname[0..3] if @options[:page_links]), (classname if @options[:page_links]), ('disabled' unless page), 'page-item'].join(' ')
end
end
end
end

View File

@ -30,4 +30,11 @@ describe 'Request_for_Comments' do
visit(request_for_comments_path) visit(request_for_comments_path)
expect(page.find_by_id('q_submission_study_group_id_in')).not_to be_nil expect(page.find_by_id('q_submission_study_group_id_in')).not_to be_nil
end end
it 'works with the pagination' do
submission = create(:submission)
create_list(:rfc, 25, submission:, exercise: submission.exercise)
visit(request_for_comments_path)
expect(page).to have_css('ul.pagination')
end
end end