[TASK] Simplify and harden pagination Fluid JS usage
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Resources / Private / Templates / ViewHelpers / Be / Widget / Paginate / Index.html
1 {namespace core=TYPO3\CMS\Core\ViewHelpers}
2 <f:if condition="{configuration.insertAbove}">
3 <f:render section="paginator" arguments="{pagination: pagination, recordsLabel: configuration.recordsLabel}" />
4 </f:if>
5
6 <f:if condition="{configuration.insertAbove} || {configuration.insertBelow}">
7 <script type="text/javascript">
8 function goToPage(formObject) {
9 var formField = formObject.elements['paginator-target-page'];
10 var url = formField.dataset.url;
11 var numberOfPages = formField.dataset.numberOfPages;
12 var page = formField.value;
13 if (page > numberOfPages) {
14 page = numberOfPages;
15 } else if (page < 1) {
16 page = 1;
17 }
18 url = url.replace('987654321', page);
19 self.location.href = url;
20 return false;
21 }
22 </script>
23 </f:if>
24
25 <f:renderChildren arguments="{contentArguments}" />
26
27 <f:if condition="{configuration.insertBelow}">
28 <f:render section="paginator" arguments="{pagination: pagination, recordsLabel: configuration.recordsLabel}" />
29 </f:if>
30
31 <f:section name="paginator">
32 <nav class="pagination-wrap">
33 <ul class="pagination pagination-block">
34 <f:if condition="{pagination.hasLessPages}">
35 <f:then>
36 <li>
37 <a href="{f:widget.uri(arguments:{currentPage: 1})}" title="{f:translate(key:'widget.pagination.first')}">
38 <core:icon identifier="actions-view-paging-first" />
39 </a>
40 </li>
41 <li>
42 <a href="{f:widget.uri(arguments:{currentPage: pagination.previousPage})}" title="{f:translate(key:'widget.pagination.previous')}">
43 <core:icon identifier="actions-view-paging-previous" />
44 </a>
45 </li>
46 </f:then>
47 <f:else>
48 <li class="disabled">
49 <span>
50 <core:icon identifier="actions-view-paging-first" />
51 </span>
52 </li>
53 <li class="disabled">
54 <span>
55 <core:icon identifier="actions-view-paging-previous" />
56 </span>
57 </li>
58 </f:else>
59 </f:if>
60 <li>
61 <span>
62 <f:if condition="{recordsLabel}">
63 <f:then>
64 {recordsLabel}
65 </f:then>
66 <f:else>
67 <f:translate key="widget.pagination.records" />
68 </f:else>
69 </f:if>
70 {pagination.startRecord} - {pagination.endRecord}
71 </span>
72 </li>
73 <li>
74 <span>
75 <f:translate key="widget.pagination.page" />
76
77 <form onsubmit="return goToPage(this);" style="display:inline;">
78 <f:form.textfield additionalAttributes="{data-number-of-pages: '{pagination.numberOfPages}', data-url: '{f:widget.uri(arguments:{currentPage: 987654321})}'}" name="paginator-target-page" class="form-control input-sm paginator-input" size="5" value="{pagination.current}" />
79 </form>
80
81 / {pagination.numberOfPages}
82 </span>
83 </li>
84 <f:if condition="{pagination.hasMorePages}">
85 <f:then>
86 <li>
87 <a href="{f:widget.uri(arguments:{currentPage: pagination.nextPage})}" title="{f:translate(key:'widget.pagination.next')}">
88 <core:icon identifier="actions-view-paging-next" />
89 </a>
90 </li>
91 <li>
92 <a href="{f:widget.uri(arguments:{currentPage: pagination.numberOfPages})}" title="{f:translate(key:'widget.pagination.last')}">
93 <core:icon identifier="actions-view-paging-last" />
94 </a>
95 </li>
96 </f:then>
97 <f:else>
98 <li class="disabled">
99 <span>
100 <core:icon identifier="actions-view-paging-next" />
101 </span>
102 </li>
103 <li class="disabled">
104 <span>
105 <core:icon identifier="actions-view-paging-last" />
106 </span>
107 </li>
108 </f:else>
109 </f:if>
110 <li>
111 <a href="{f:widget.uri(arguments:{currentPage: pagination.current})}" title="{f:translate(key:'widget.pagination.refresh')}">
112 <core:icon identifier="actions-refresh" />
113 </a>
114 </li>
115 </ul>
116 </nav>
117 </f:section>