Merge branch 'MDL-58454-master' of git://github.com/junpataleta/moodle
[moodle.git] / lib / templates / paged_content.mustache
blob953cbccc3e961d61b67d50d5dcf20e50027cc1ba
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             "itemsperpage": 1,
27             "previous": true,
28             "next": true,
29             "first": true,
30             "last": true,
31             "pages": [
32                 {
33                     "page": "1",
34                     "active": true
35                 },
36                 {
37                     "url": "#",
38                     "page": "2"
39                 }
40             ]
41         },
42         "pages": [
43             {
44                 "active": true,
45                 "page": 1,
46                 "content": "<p>Some page 1 content</p>"
47             },
48             {
49                 "page": 2,
50                 "content": "<p>Some page 2 content</p>"
51             }
52         ]
53     }
55 <div id="paged-content-container-{{uniqid}}" data-region="paged-content-container">
56     {{^controlplacementbottom}}
57         <div class="m-b-1">
58             {{#pagingbar}}
59                 {{> core/paged_content_paging_bar }}
60             {{/pagingbar}}
61             {{#pagingdropdown}}
62                 {{> core/paged_content_paging_dropdown }}
63             {{/pagingdropdown}}
64         </div>
65     {{/controlplacementbottom}}
66     {{> core/paged_content_pages }}
67     {{#controlplacementbottom}}
68         <div class="m-t-1">
69             {{#pagingbar}}
70                 {{> core/paged_content_paging_bar }}
71             {{/pagingbar}}
72             {{#pagingdropdown}}
73                 {{> core/paged_content_paging_dropdown }}
74             {{/pagingdropdown}}
75         </div>
76     {{/controlplacementbottom}}
77 </div>
78 {{^skipjs}}
79 {{#js}}
80 require(
82     'jquery',
83     'core/paged_content'
85 function(
86     $,
87     PagedContent
88 ) {
89     var container = $("#paged-content-container-{{uniqid}}");
90     PagedContent.init(container);
91 });
92 {{/js}}
93 {{/skipjs}}