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/>.
18 @template core_courseformat/local/courseindex/section
20 Displays a course index section entry.
22 Example context (json):
36 "name": "Glossary of characters",
43 "name": "World Cinema forum",
50 "name": "Announcements",
59 class="courseindex-section {{#current}}current{{/current}}"
60 id="{{uniqid}}-course-index-section-{{id}}"
63 data-number="{{number}}"
65 aria-owns="courseindexcollapse{{number}}"
67 <div class="courseindex-item d-flex
68 {{^visible}}dimmed{{/visible}}
69 {{#hasrestrictions}}restrictions{{/hasrestrictions}}
70 courseindex-section-title"
71 id="courseindexsection{{number}}"
72 data-for="section_item"
74 <a data-toggle="collapse"
75 href="#courseindexcollapse{{number}}"
76 class="courseindex-chevron icons-collapse-expand {{#indexcollapsed}}collapsed{{/indexcollapsed}}"
77 aria-expanded="{{^indexcollapsed}}true{{/indexcollapsed}}{{#indexcollapsed}}false{{/indexcollapsed}}"
78 aria-controls="courseindexcollapse{{number}}"
81 <span class="collapsed-icon icon-no-margin mr-1"
82 title="{{#str}} expand, core {{/str}}">
83 {{#pix}} t/collapsedchevron, core {{/pix}}
84 <span class="sr-only">{{#str}} expand, core {{/str}}</span>
86 <span class="expanded-icon icon-no-margin mr-1"
87 title="{{#str}} collapse, core {{/str}}">
88 {{#pix}} t/expandedchevron, core {{/pix}}
89 <span class="sr-only">{{#str}} collapse, core {{/str}}</span>
92 <a href="{{{sectionurl}}}"
93 class="courseindex-link text-truncate"
94 data-action="togglecourseindexsection"
95 data-for="section_title"
100 <span class="current-badge badge badge-primary ml-2 px-2 rounded-pill">
103 <span class="courseindex-locked ml-1" data-for="cm_name">
104 {{#pix}} t/locked, core {{/pix}}
106 <span class="dragicon ml-auto">{{#pix}}i/dragdrop{{/pix}}</span>
108 <div id="courseindexcollapse{{number}}"
109 class="courseindex-item-content collapse {{^indexcollapsed}}show{{/indexcollapsed}}"
110 aria-labelledby="courseindexsection{{number}}" role="group"
112 <ul class="courseindex-sectioncontent unlist" data-for="cmlist" data-id="{{id}}" role="group">
114 {{> core_courseformat/local/courseindex/cm }}
120 require(['core_courseformat/local/courseindex/section'], function(component) {
121 component.init('{{uniqid}}-course-index-section-{{id}}');