weekly back-to-dev release 5.0dev
[moodle.git] / lib / templates / paging_bar.mustache
blob845cef6b6cf5f064ea64beb3e5708c2904408628
1 {{!
2     This file is part of Moodle - http://moodle.org/
4     Moodle is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
9     Moodle is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
14     You should have received a copy of the GNU General Public License
15     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
17 {{!
18     @template core/paging_bar
20     This template renders the horizontal bar with page links, e.g.
21         | « | 1 | 2 | 3 | » |
23     Example context (json):
24     {
25         "previous": null,
26         "next": {
27             "page": 2,
28             "url": "./page.php?p=1"
29         },
30         "first": null,
31         "last": {
32             "page": 100,
33             "url": "./page.php?p=99"
34         },
35         "label": "Page",
36         "pages": [
37             {
38                 "page": 1,
39                 "active": true,
40                 "url": null
41             },
42             {
43                 "page": 2,
44                 "active": false,
45                 "url": "./page.php?p=1"
46             }
47         ],
48         "haspages": true,
49         "pagesize": 10
50     }
52 {{#haspages}}
53     <nav aria-label="{{label}}" class="pagination pagination-centered justify-content-center">
54         <ul class="mt-1 pagination " data-page-size="{{pagesize}}">
55             {{#previous}}
56                 <li class="page-item" data-page-number="{{page}}">
57                     <a href="{{url}}" class="page-link">
58                         <span aria-hidden="true">&laquo;</span>
59                         <span class="sr-only">{{#str}}previouspage, moodle{{/str}}</span>
60                     </a>
61                 </li>
62             {{/previous}}
63             {{#first}}
64                 <li class="page-item" data-page-number="{{page}}">
65                     <a href="{{url}}" class="page-link">
66                         <span aria-hidden="true">{{page}}</span>
67                         <span class="sr-only">{{#str}}pagea, moodle, {{page}}{{/str}}</span>
68                     </a>
69                 </li>
70                 <li class="page-item disabled" data-page-number="{{page}}">
71                     <span class="page-link">&hellip;</span>
72                 </li>
73             {{/first}}
74             {{#pages}}
75                 <li class="page-item {{#active}}active{{/active}}" data-page-number="{{page}}">
76                     <a href="{{#url}}{{.}}{{/url}}{{^url}}#{{/url}}" class="page-link" {{#active}}aria-current="page"{{/active}}>
77                         <span aria-hidden="true">{{page}}</span>
78                         <span class="sr-only">{{#str}}pagea, moodle, {{page}}{{/str}}</span>
79                     </a>
80                 </li>
81             {{/pages}}
82             {{#last}}
83                 <li class="page-item disabled" data-page-number="{{page}}">
84                     <span class="page-link">&hellip;</span>
85                 </li>
86                 <li class="page-item" data-page-number="{{page}}">
87                     <a href="{{url}}" class="page-link">
88                         <span aria-hidden="true">{{page}}</span>
89                         <span class="sr-only">{{#str}}pagea, moodle, {{page}}{{/str}}</span>
90                     </a>
91                 </li>
92             {{/last}}
93             {{#next}}
94                 <li class="page-item" data-page-number="{{page}}">
95                     <a href="{{url}}" class="page-link">
96                         <span aria-hidden="true">&raquo;</span>
97                         <span class="sr-only">{{#str}}nextpage, moodle{{/str}}</span>
98                     </a>
99                 </li>
100             {{/next}}
101         </ul>
102     </nav>
103 {{/haspages}}