MDL-78962 core/loadingicon: remove jQuery requirement in the API
[moodle.git] / lib / templates / paged_content.mustache
blob4111ea88fdbe6cd5d934c086a040a4b2d5a274c8
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/paged_content
20     This template renders each of the content regions for a paginated
21     content section.
23     Example context (json):
24     {
25         "pagingbar": {
26             "showitemsperpageselector": true,
27             "itemsperpage": [
28                 { "value": 5, "active": false },
29                 { "value": 10, "active": true },
30                 { "value": 15, "active": false }
31             ],
32             "previous": true,
33             "next": true,
34             "first": true,
35             "last": true,
36             "barsize": 5,
37             "pages": [
38                 {
39                     "page": "1",
40                     "active": true
41                 },
42                 {
43                     "url": "#",
44                     "page": "2"
45                 },
46                 {
47                     "url": "#",
48                     "page": "3"
49                 },
50                 {
51                     "url": "#",
52                     "page": "4"
53                 },
54                 {
55                     "url": "#",
56                     "page": "5"
57                 },
58                 {
59                     "url": "#",
60                     "page": "6"
61                 },
62                 {
63                     "url": "#",
64                     "page": "7"
65                 }
66             ]
67         },
68         "pages": [
69             {
70                 "active": true,
71                 "page": 1,
72                 "content": "<p>Some page 1 content</p>"
73             },
74             {
75                 "page": 2,
76                 "content": "<p>Some page 2 content</p>"
77             },
78             {
79                 "page": 3,
80                 "content": "<p>Some page 3 content</p>"
81             },
82             {
83                 "page": 4,
84                 "content": "<p>Some page 4 content</p>"
85             },
86             {
87                 "page": 5,
88                 "content": "<p>Some page 5 content</p>"
89             },
90             {
91                 "page": 6,
92                 "content": "<p>Some page 6 content</p>"
93             },
94             {
95                 "page": 7,
96                 "content": "<p>Some page 7 content</p>"
97             }
98         ]
99     }
101 <div id="paged-content-container-{{uniqid}}" data-region="paged-content-container">
102     {{^controlplacementbottom}}
103         <div class="mb-1">
104             {{#pagingbar}}
105                 {{> core/paged_content_paging_bar }}
106             {{/pagingbar}}
107             {{#pagingdropdown}}
108                 {{> core/paged_content_paging_dropdown }}
109             {{/pagingdropdown}}
110         </div>
111     {{/controlplacementbottom}}
112     {{> core/paged_content_pages }}
113     {{#controlplacementbottom}}
114         <div class="mt-1">
115             {{#pagingbar}}
116                 {{> core/paged_content_paging_bar }}
117             {{/pagingbar}}
118             {{#pagingdropdown}}
119                 {{> core/paged_content_paging_dropdown }}
120             {{/pagingdropdown}}
121         </div>
122     {{/controlplacementbottom}}
123 </div>
124 {{^skipjs}}
125 {{#js}}
126 require(
128     'jquery',
129     'core/paged_content'
131 function(
132     $,
133     PagedContent
134 ) {
135     var container = $("#paged-content-container-{{uniqid}}");
136     PagedContent.init(container);
138 {{/js}}
139 {{/skipjs}}