From 665771b38b6df77c1f9a5d994df9d77cc211a7eb Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger <simonschaufi+typo3@gmail.com> Date: Tue, 5 Jul 2022 21:03:04 +0200 Subject: [PATCH] [BUGFIX] Fix page link in redirects module bottom pagination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this patch, the page link (requesting a dedicated paginated page) in the redirects module bottom pagination is now working again. This is done by selecting all pagination forms and adding the submit event to them. Resolves: #94661 Releases: 10.4 Change-Id: I484aacb1f92d95c296a95a594602935551086aff Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74975 Tested-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com> Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- .../Resources/Public/TypeScript/RedirectsModule.ts | 7 +++---- .../Resources/Public/JavaScript/RedirectsModule.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/RedirectsModule.ts b/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/RedirectsModule.ts index 99f39ca492c2..84ee08e8a728 100644 --- a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/RedirectsModule.ts +++ b/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/RedirectsModule.ts @@ -19,12 +19,11 @@ import RegularEvent = require('TYPO3/CMS/Core/Event/RegularEvent'); */ class RedirectsModule { public constructor() { - const filterForm: HTMLFormElement = document.querySelector('form[data-on-submit="processNavigate"]'); - if (filterForm !== null) { + const filterForms = document.querySelectorAll('form[data-on-submit="processNavigate"]'); + if (filterForms.length > 0) { new RegularEvent('change', this.executeSubmit.bind(this)) .delegateTo(document, '[data-on-change="submit"]'); - new RegularEvent('submit', this.processNavigate.bind(this)) - .bindTo(filterForm); + filterForms.forEach((form: HTMLFormElement) => new RegularEvent('submit', this.processNavigate.bind(this)).bindTo(form)); } } diff --git a/typo3/sysext/redirects/Resources/Public/JavaScript/RedirectsModule.js b/typo3/sysext/redirects/Resources/Public/JavaScript/RedirectsModule.js index 61f6d26c349f..24220b63bdf9 100644 --- a/typo3/sysext/redirects/Resources/Public/JavaScript/RedirectsModule.js +++ b/typo3/sysext/redirects/Resources/Public/JavaScript/RedirectsModule.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -define(["require","exports","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n){"use strict";return new class{constructor(){const e=document.querySelector('form[data-on-submit="processNavigate"]');null!==e&&(new n("change",this.executeSubmit.bind(this)).delegateTo(document,'[data-on-change="submit"]'),new n("submit",this.processNavigate.bind(this)).bindTo(e))}executeSubmit(e){const t=e.target;t instanceof HTMLSelectElement&&t.form.submit()}processNavigate(e){const t=e.target;if(!(t instanceof HTMLFormElement))return;e.preventDefault();const n=t.elements.namedItem("paginator-target-page"),a=parseInt(n.dataset.numberOfPages,10);let s=n.dataset.url,r=parseInt(n.value,10);r>a?r=a:r<1&&(r=1),s=s.replace("987654322",r.toString()),self.location.href=s}}})); \ No newline at end of file +define(["require","exports","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n){"use strict";return new class{constructor(){const e=document.querySelectorAll('form[data-on-submit="processNavigate"]');e.length>0&&(new n("change",this.executeSubmit.bind(this)).delegateTo(document,'[data-on-change="submit"]'),e.forEach(e=>new n("submit",this.processNavigate.bind(this)).bindTo(e)))}executeSubmit(e){const t=e.target;t instanceof HTMLSelectElement&&t.form.submit()}processNavigate(e){const t=e.target;if(!(t instanceof HTMLFormElement))return;e.preventDefault();const n=t.elements.namedItem("paginator-target-page"),a=parseInt(n.dataset.numberOfPages,10);let r=n.dataset.url,s=parseInt(n.value,10);s>a?s=a:s<1&&(s=1),r=r.replace("987654322",s.toString()),self.location.href=r}}})); \ No newline at end of file -- GitLab