Browse Source

replace pagination partials by a viewhelper

Olivier Massot 4 năm trước cách đây
mục cha
commit
9052935e98

+ 1 - 1
ot_templating/Resources/Private/Layouts/Classic/StructuresEvents.html

@@ -110,7 +110,7 @@
                         </div>
                     </f:for>
 
-                    <f:render partial="Classic/Pagination" arguments="{collection: eventsCollection}"/>
+                    {ot:pagination(collection: eventsCollection)}
                 </div>
             </div>
 

+ 1 - 1
ot_templating/Resources/Private/Layouts/Modern/Structures.html

@@ -97,7 +97,7 @@
                                             </div>
                                         </f:for>
 
-                                        <f:render partial="Modern/Pagination" arguments="{collection: structuresCollection}"/>
+                                        {ot:pagination(collection: structuresCollection)}
                                     </div>
                                 </div>
                             </ot:organizations.getChildren>

+ 1 - 1
ot_templating/Resources/Private/Layouts/Modern/StructuresEvents.html

@@ -112,7 +112,7 @@
                                         </div>
                                     </f:for>
 
-                                    <f:render partial="Modern/Pagination" arguments="{collection: eventsCollection}"/>
+                                    {ot:pagination(collection: eventsCollection)}
                                 </div>
                             </div>
                         </ot:events.getAll>

+ 1 - 1
ot_templating/Resources/Private/Partials/Classic/EventsIndex.html

@@ -95,6 +95,6 @@
             </div>
         </f:for>
 
-        <f:render partial="Classic/Pagination" arguments="{collection: eventsCollection}"/>
+        {ot:pagination(collection: eventsCollection)}
     </div>
 </div>

+ 0 - 22
ot_templating/Resources/Private/Partials/Classic/Pagination.html

@@ -1,22 +0,0 @@
-{namespace ot=Opentalent\OtTemplating\ViewHelpers}
-
-<f:comment><!-- Pagination --></f:comment>
-<f:comment><!--
-    This partial expects an ApiPagedCollection
-    named {collection} as argument
- --></f:comment>
-
-<f:if condition="{collection.lastPage} > 0">
-    <div class="pagination-bar">
-        <p><f:translate key="pages"/>:</p>
-        <ul>
-            <f:for each="{collection.pages}" as="page">
-                <li class="{f:if(condition: '{page}=={collection.currentPage}', then: 'current', else: '')}">
-                    <a href="{ot:request.withPage(page: page)}">
-                        {page}
-                    </a>
-                </li>
-            </f:for>
-        </ul>
-    </div>
-</f:if>

+ 1 - 1
ot_templating/Resources/Private/Partials/Modern/EventsIndex.html

@@ -95,6 +95,6 @@
             </div>
         </f:for>
 
-        <f:render partial="Modern/Pagination" arguments="{collection: eventsCollection}"/>
+        {ot:pagination(collection: eventsCollection)}
     </div>
 </div>

+ 0 - 22
ot_templating/Resources/Private/Partials/Modern/Pagination.html

@@ -1,22 +0,0 @@
-{namespace ot=Opentalent\OtTemplating\ViewHelpers}
-
-<f:comment><!-- Pagination --></f:comment>
-<f:comment><!--
-    This partial expects an ApiPagedCollection
-    named {collection} as argument
- --></f:comment>
-
-<f:if condition="{collection.lastPage} > 0">
-    <div class="pagination-bar">
-        <p><f:translate key="pages"/>:</p>
-        <ul>
-            <f:for each="{collection.pages}" as="page">
-                <li class="{f:if(condition: '{page}=={collection.currentPage}', then: 'current', else: '')}">
-                    <a href="{ot:request.withPage(page: page)}">
-                        {page}
-                    </a>
-                </li>
-            </f:for>
-        </ul>
-    </div>
-</f:if>

+ 3 - 2
ot_templating/Resources/Public/assets/Modern/style/custom.css

@@ -1202,10 +1202,11 @@ iframe {
     display: flex;
     flex-direction: row;
     margin: 12px auto;
+    align-items: center;
 }
 
-.pagination-bar p {
-    margin: 4px;
+.pagination-bar a {
+    padding: 0 4px;
 }
 
 .pagination-bar ul {