From 73239fa616bf1218808fea401866bc3360e4dfe9 Mon Sep 17 00:00:00 2001
From: Claus Due <claus@namelesscoder.net>
Date: Sun, 2 Jul 2017 02:04:07 +0200
Subject: [PATCH] [TASK] Refactor implementation of PaginateWidget

Refactors templates to minimise the impact of using the
uncompilable PaginateWidget. By moving the Widget to
a separate partial and the body rendered by the Widget
to another partial the impact is reduced to a minimum,
because the uncompilable template has just two nodes.

Change-Id: I6f1d528ed0c45d776c4952596ac5a8828d04f477
Resolves: #81766
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53376
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Henning Liebe <h.liebe@neusta.de>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
---
 .../BackendUser/PaginatedListWidget.html      |  3 ++
 .../BackendUser/PaginatedListWidgetBody.html  | 27 +++++++++++++++
 .../BackendUserGroup/PaginatedListWidget.html |  3 ++
 .../PaginatedListWidgetBody.html              | 25 ++++++++++++++
 .../Private/Templates/BackendUser/Index.html  | 33 +------------------
 .../Templates/BackendUserGroup/Index.html     | 31 +----------------
 6 files changed, 60 insertions(+), 62 deletions(-)
 create mode 100644 typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html
 create mode 100644 typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html
 create mode 100644 typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidget.html
 create mode 100644 typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html

diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html
new file mode 100644
index 000000000000..598ecaa782e8
--- /dev/null
+++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html
@@ -0,0 +1,3 @@
+<f:be.widget.paginate objects="{backendUsers}" as="paginatedBackendUsers" configuration="{itemsPerPage: 50, insertBelow: 1}">
+    <f:render partial="BackendUser/PaginatedListWidgetBody" arguments="{_all}" />
+</f:be.widget.paginate>
\ No newline at end of file
diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html
new file mode 100644
index 000000000000..e16b5d97b30a
--- /dev/null
+++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html
@@ -0,0 +1,27 @@
+<div class="table-fit">
+    <table id="typo3-backend-user-list" class="table table-striped table-hover">
+        <thead>
+        <tr>
+            <th></th>
+            <th class="col-title"><f:translate key="userName" /> / <f:translate key="realName" /></th>
+            <th><f:translate key="lastLogin" /></th>
+            <th class="col-control"></th>
+        </tr>
+        </thead>
+        <tbody>
+        <f:for each="{paginatedBackendUsers}" as="backendUser">
+            <f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, compareUserUidList: compareUserUidList}" />
+        </f:for>
+        <f:comment>
+            Footer row: no officially defined style yet
+        </f:comment>
+        </tbody>
+        <tfoot>
+        <tr>
+            <td colspan="5">
+                <f:count subject="{backendUsers}" /> <f:translate key="users" />
+            </td>
+        </tr>
+        </tfoot>
+    </table>
+</div>
\ No newline at end of file
diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidget.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidget.html
new file mode 100644
index 000000000000..bf487043c40a
--- /dev/null
+++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidget.html
@@ -0,0 +1,3 @@
+<f:be.widget.paginate objects="{backendUserGroups}" as="paginatedBackendUserGroups" configuration="{itemsPerPage: 50, insertBelow: 1}">
+    <f:render partial="BackendUserGroup/PaginatedListWidgetBody" arguments="{_all}" />
+</f:be.widget.paginate>
\ No newline at end of file
diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html
new file mode 100644
index 000000000000..2982a438ee64
--- /dev/null
+++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html
@@ -0,0 +1,25 @@
+<div class="table-fit">
+    <table class="table table-striped table-hover">
+        <thead>
+        <tr>
+            <th class="col-icon"></th>
+            <th class="col-title"><f:translate key="backendUserGroup" /></th>
+            <th><f:translate key="subGroups" /></th>
+            <th class="col-control"></th>
+        </tr>
+        </thead>
+        <tbody>
+        <f:for each="{paginatedBackendUserGroups}" as="backendUserGroup">
+            <f:render partial="BackendUserGroup/IndexListRow" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl}" />
+        </f:for>
+        <f:comment>
+            Footer row: no officially defined style yet
+        </f:comment>
+        <tr>
+            <td colspan="4">
+                <f:count subject="{backendUserGroups}" /> <f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:be_groups" />s
+            </td>
+        </tr>
+        </tbody>
+    </table>
+</div>
\ No newline at end of file
diff --git a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html
index 5b8b334b7171..279f2e881ac2 100644
--- a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html
+++ b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html
@@ -48,37 +48,6 @@
 	</f:comment>
 	<f:render partial="Filters/BackendUser/Index" arguments="{demand: demand, backendUserGroups: backendUserGroups}" />
 
-	<f:comment>
-		Listing of all users
-	</f:comment>
-	<f:be.widget.paginate objects="{backendUsers}" as="paginatedBackendUsers" configuration="{itemsPerPage: 50, insertBelow: 1}">
-		<div class="table-fit">
-			<table id="typo3-backend-user-list" class="table table-striped table-hover">
-				<thead>
-					<tr>
-						<th></th>
-						<th class="col-title"><f:translate key="userName" /> / <f:translate key="realName" /></th>
-						<th><f:translate key="lastLogin" /></th>
-						<th class="col-control"></th>
-					</tr>
-				</thead>
-				<tbody>
-					<f:for each="{paginatedBackendUsers}" as="backendUser">
-						<f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, compareUserUidList: compareUserUidList}" />
-					</f:for>
-					<f:comment>
-						Footer row: no officially defined style yet
-					</f:comment>
-				</tbody>
-				<tfoot>
-					<tr>
-						<td colspan="5">
-							<f:count subject="{backendUsers}" /> <f:translate key="users" />
-						</td>
-					</tr>
-				</tfoot>
-			</table>
-		</div>
-	</f:be.widget.paginate>
+	<f:render partial="BackendUser/PaginatedListWidget" arguments="{_all}" />
 
 </f:section>
diff --git a/typo3/sysext/beuser/Resources/Private/Templates/BackendUserGroup/Index.html b/typo3/sysext/beuser/Resources/Private/Templates/BackendUserGroup/Index.html
index 98146d57deca..3213b0499792 100644
--- a/typo3/sysext/beuser/Resources/Private/Templates/BackendUserGroup/Index.html
+++ b/typo3/sysext/beuser/Resources/Private/Templates/BackendUserGroup/Index.html
@@ -9,35 +9,6 @@
 
 <f:section name="content">
 
-	<f:comment>
-		Listing of all user groups
-	</f:comment>
-	<f:be.widget.paginate objects="{backendUserGroups}" as="paginatedBackendUserGroups" configuration="{itemsPerPage: 50, insertBelow: 1}">
-		<div class="table-fit">
-			<table class="table table-striped table-hover">
-				<thead>
-					<tr>
-						<th class="col-icon"></th>
-						<th class="col-title"><f:translate key="backendUserGroup" /></th>
-						<th><f:translate key="subGroups" /></th>
-						<th class="col-control"></th>
-					</tr>
-				</thead>
-				<tbody>
-					<f:for each="{paginatedBackendUserGroups}" as="backendUserGroup">
-						<f:render partial="BackendUserGroup/IndexListRow" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl}" />
-					</f:for>
-					<f:comment>
-						Footer row: no officially defined style yet
-					</f:comment>
-					<tr>
-						<td colspan="4">
-							<f:count subject="{backendUserGroups}" /> <f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:be_groups" />s
-						</td>
-					</tr>
-				</tbody>
-			</table>
-		</div>
-	</f:be.widget.paginate>
+	<f:render partial="BackendUserGroup/PaginatedListWidget" arguments="{_all}" />
 
 </f:section>
-- 
GitLab