MDL-69454 core_search: consistent navbar search
[moodle.git] / theme / boost / templates / navbar.mustache
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/>.
16 }}
17 {{!
19     @template theme_boost/navbar
21     This template renders the top navbar.
23     Example context (json):
24     {
25         "output": {
26             "should_display_navbar_logo": true,
27             "get_compact_logo_url": "http://placekitten.com/50/50",
28             "custom_menu": "<li>..</li>",
29             "page_heading_menu": "<li>..</li>",
30             "search_box": "<div><input type='text'></div>",
31             "navbar_plugin_output": "<div class='dropdown'>Messaging</div>",
32             "user_menu": "<div class='dropdown'>John Doe</div>"
33         },
34         "config": {
35             "wwwroot": "#"
36         },
37         "sitename": "Moodle Site"
38     }
39 }}
40 <nav class="fixed-top navbar navbar-light bg-white navbar-expand moodle-has-zindex" aria-label="{{#str}}sitemenubar, admin{{/str}}">
42         <div data-region="drawer-toggle" class="d-inline-block mr-3">
43             <button aria-expanded="{{#navdraweropen}}true{{/navdraweropen}}{{^navdraweropen}}false{{/navdraweropen}}" aria-controls="nav-drawer" type="button" class="btn nav-link float-sm-left mr-1 btn-light bg-gray" data-action="toggle-drawer" data-side="left" data-preference="drawer-open-nav">{{#pix}}i/menubars{{/pix}}<span class="sr-only">{{#str}}sidepanel, core{{/str}}</span></button>
44         </div>
46         <a href="{{{ config.wwwroot }}}" class="navbar-brand aabtn {{# output.should_display_navbar_logo }}has-logo{{/ output.should_display_navbar_logo }}
47             {{^ output.should_display_navbar_logo }}
48                 d-none d-sm-inline
49             {{/ output.should_display_navbar_logo }}
50                 ">
51             {{# output.should_display_navbar_logo }}
52                 <span class="logo d-none d-sm-inline">
53                     <img src="{{output.get_compact_logo_url}}" alt="{{sitename}}">
54                 </span>
55             {{/ output.should_display_navbar_logo }}
56             <span class="site-name d-none d-md-inline">{{{ sitename }}}</span>
57         </a>
59         <ul class="navbar-nav d-none d-md-flex">
60             <!-- custom_menu -->
61             {{{ output.custom_menu }}}
62             <!-- page_heading_menu -->
63             {{{ output.page_heading_menu }}}
64         </ul>
65         <div class="ml-auto">
66             {{{ output.search_box }}}
67         </div>
68         <ul class="nav navbar-nav usernav">
69             <!-- navbar_plugin_output -->
70             <li class="nav-item">
71                 {{{ output.navbar_plugin_output }}}
72             </li>
73             <!-- user_menu -->
74             <li class="nav-item align-items-center pl-2">
75                 {{{ output.user_menu }}}
76             </li>
77         </ul>
78         <!-- search_box -->
79 </nav>