From d1a0012d4f5f489a1171c0f1cfe5f528a73fa102 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 14 Jun 2023 14:28:10 +0200 Subject: [PATCH] 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 --- config/initializers/monkey_patches.rb | 10 ++++++++++ spec/features/request_for_comments_filter_spec.rb | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/config/initializers/monkey_patches.rb b/config/initializers/monkey_patches.rb index 3eaf9217e..61c405d57 100644 --- a/config/initializers/monkey_patches.rb +++ b/config/initializers/monkey_patches.rb @@ -7,3 +7,13 @@ def average 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 diff --git a/spec/features/request_for_comments_filter_spec.rb b/spec/features/request_for_comments_filter_spec.rb index e46735814..b5602305c 100644 --- a/spec/features/request_for_comments_filter_spec.rb +++ b/spec/features/request_for_comments_filter_spec.rb @@ -30,4 +30,11 @@ visit(request_for_comments_path) expect(page.find_by_id('q_submission_study_group_id_in')).not_to be_nil 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