Merge branch 'MDL-78676-master' of https://github.com/sarjona/moodle
[moodle.git] / theme / boost / templates / flat_navigation.mustache
blobc6424ba612adb542d47b6f582d92aec5f5167d12
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     @deprecated since Moodle 4.0
19     @template theme_boost/flat_navigation
21     Display the flat navigation for the boost theme
23     Classes required for JS:
24     * none
26     Data attributes required for JS:
27     * none
29     Context variables required for this template:
30     * flatnavigation - array of flat_navigation_nodes
31       * showdivider - boolean
32       * action - string
33       * isactive - boolean
34       * get_indent - integer
35       * is_section - boolean
36       * text - HTML
38     Example context (json):
39     {
40         "flatnavigation" : [
41             {
42                 "showdivider": false,
43                 "action": "#",
44                 "isactive": true,
45                 "get_indent": 1,
46                 "is_section": false,
47                 "text": "First"
48             },{
49                 "showdivider": true,
50                 "action": "#",
51                 "isactive": false,
52                 "get_indent": 0,
53                 "is_section": true,
54                 "text": "Last &amp; Second"
55             }
56         ]
57     }
59 <nav class="list-group" aria-label="{{firstcollectionlabel}}">
60     <ul>
61     {{# flatnavigation }}
62         {{#showdivider}}
63             </ul>
64             </nav>
65             <nav class="list-group mt-1" aria-label="{{get_collectionlabel}}">
66             <ul>
67         {{/showdivider}}
68         {{#action}}
69             <li>
70                 <a class="list-group-item list-group-item-action {{#isactive}}active{{/isactive}} {{#classes}}{{.}} {{/classes}}" href="{{{action}}}" data-key="{{key}}" data-isexpandable="{{isexpandable}}" data-indent="{{get_indent}}" data-showdivider="{{showdivider}}" data-type="{{type}}" data-nodetype="{{nodetype}}" data-collapse="{{collapse}}" data-forceopen="{{forceopen}}" data-isactive="{{isactive}}" data-hidden="{{hidden}}" data-preceedwithhr="{{preceedwithhr}}" {{#parent.key}}data-parent-key="{{.}}"{{/parent.key}}>
71                     <div class="ml-{{get_indent}}">
72                         <div class="media">
73                             {{#icon.pix}}
74                                 <span class="media-left">
75                                     {{#pix}}{{{icon.pix}}}, {{{icon.component}}}, {{{icon.alt}}}{{/pix}}
76                                 </span>
77                             {{/icon.pix}}
78                             <span class="media-body {{#isactive}}font-weight-bold{{/isactive}}">{{{text}}}</span>
79                         </div>
80                     </div>
81                 </a>
82             </li>
83         {{/action}}
84         {{^action}}
85             <li>
86                 <div class="list-group-item {{#classes}}{{.}} {{/classes}}" data-key="{{key}}" data-isexpandable="{{isexpandable}}" data-indent="{{get_indent}}" data-showdivider="{{showdivider}}" data-type="{{type}}" data-nodetype="{{nodetype}}" data-collapse="{{collapse}}" data-forceopen="{{forceopen}}" data-isactive="{{isactive}}" data-hidden="{{hidden}}" data-preceedwithhr="{{preceedwithhr}}" {{#parent.key}}data-parent-key="{{.}}"{{/parent.key}}>
87                     <div class="ml-{{get_indent}}">
88                         <div class="media">
89                             {{#icon.pix}}
90                                 <span class="media-left">
91                                     {{#pix}}{{{icon.pix}}}, {{{icon.component}}}, {{{icon.alt}}}{{/pix}}
92                                 </span>
93                             {{/icon.pix}}
94                             <span class="media-body">{{{text}}}</span>
95                         </div>
96                     </div>
97                 </div>
98             </li>
99         {{/action}}
100     {{/ flatnavigation }}
101     </ul>
102 </nav>