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