MDL-73683 core_courseformat: match hasRestrictions criteria
[moodle.git] / course / format / templates / local / courseindex / cm.mustache
blobb935868e025994c299937f3e605b68cf8dd3921d
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_courseformat/local/courseindex/cm
20     Displays a course index course-module entry.
22     Example context (json):
23     {
24         "id": "12",
25         "name": "Announcements",
26         "url": "#",
27         "visible": 1,
28         "isactive": 1,
29         "uniqid": "0",
30         "accessvisible": 1,
31         "hascmrestrictions": 0
32     }
34 <li class="courseindex-item
35         {{#isactive}}active{{/isactive}}
36         {{#hascmrestrictions}}restrictions{{/hascmrestrictions}}
37         {{^accessvisible}}dimmed{{/accessvisible}}
38         {{#url}} d-flex {{/url}} {{^url}} d-flex-noedit {{/url}}"
39     id="{{uniqid}}-course-index-cm-{{id}}"
40     data-for="cm"
41     data-id="{{id}}"
42     role="treeitem"
44     <span class="completioninfo" data-for="cm_completion" data-value="NaN"></span>
45     {{#url}}
46         {{#uservisible}}
47             <a class="courseindex-link text-truncate" href="{{{url}}}" data-for="cm_name" tabindex="-1">
48                 {{{name}}}
49             </a>
50         {{/uservisible}}
51         {{^uservisible}}
52             <a class="courseindex-link text-truncate" href="#{{{anchor}}}" data-for="cm_name" tabindex="-1" data-anchor="true">
53                 {{{name}}}
54             </a>
55         {{/uservisible}}
56     {{/url}}
57     {{^url}}
58     <span class="courseindex-name text-truncate" data-for="cm_name">
59         {{{name}}}
60     </span>
61     {{/url}}
62     <span class="courseindex-locked ml-1" data-for="cm_name">
63         {{#pix}} t/locked, core {{/pix}}
64     </span>
65     <span class="dragicon ml-auto">{{#pix}}i/dragdrop{{/pix}}</span>
66 </li>
67 {{#js}}
68 require(['core_courseformat/local/courseindex/cm'], function(component) {
69     component.init('{{uniqid}}-course-index-cm-{{id}}');
70 });
71 {{/js}}