luci-theme-bootstrap: rework menu rendering
[oweals/luci.git] / themes / luci-theme-bootstrap / luasrc / view / themes / bootstrap / header.htm
1 <%#
2  Copyright 2008 Steven Barth <steven@midlink.org>
3  Copyright 2008-2016 Jo-Philipp Wich <jow@openwrt.org>
4  Copyright 2012 David Menting <david@nut-bolt.nl>
5  Licensed to the public under the Apache License 2.0.
6 -%>
7
8 <%
9         local sys  = require "luci.sys"
10         local util = require "luci.util"
11         local http = require "luci.http"
12         local disp = require "luci.dispatcher"
13
14         local boardinfo = util.ubus("system", "board")
15
16         local node = disp.context.dispatched
17
18         -- send as HTML5
19         http.prepare_content("text/html")
20 -%>
21 <!DOCTYPE html>
22 <html lang="<%=luci.i18n.context.lang%>">
23         <head>
24                 <meta charset="utf-8">
25                 <title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
26                 <meta name="viewport" content="initial-scale=1.0">
27                 <link rel="stylesheet" href="<%=media%>/cascade.css">
28                 <link rel="stylesheet" media="only screen and (max-device-width: 854px)" href="<%=media%>/mobile.css" type="text/css" />
29                 <link rel="shortcut icon" href="<%=media%>/favicon.png">
30                 <% if node and node.css then %>
31                         <link rel="stylesheet" href="<%=resource%>/<%=node.css%>">
32                 <% end -%>
33                 <% if css then %>
34                         <style title="text/css"><%= css %></style>
35                 <% end -%>
36                 <script src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script>
37                 <script src="<%=resource%>/cbi.js"></script>
38         </head>
39
40         <body class="lang_<%=luci.i18n.context.lang%> <% if node then %><%= striptags( node.title ) %><%- end %>" data-page="<%= pcdata(table.concat(disp.context.requestpath, "-")) %>">
41                 <header>
42                         <div class="fill">
43                                 <div class="container">
44                                         <a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
45                                         <ul class="nav" id="topmenu" style="display:none"></ul>
46                                         <div id="indicators" class="pull-right"></div>
47                                 </div>
48                         </div>
49                 </header>
50
51                 <div id="maincontent" class="container">
52                         <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%>
53                                 <div class="alert-message warning">
54                                         <h4><%:No password set!%></h4>
55                                         <p><%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%></p>
56                                         <% if disp.lookup("admin/system/admin") then %>
57                                           <div class="right"><a class="btn" href="<%=url("admin/system/admin")%>"><%:Go to password configuration...%></a></div>
58                                         <% end %>
59                                 </div>
60                         <%- end -%>
61
62                         <noscript>
63                                 <div class="alert-message warning">
64                                         <h4><%:JavaScript required!%></h4>
65                                         <p><%:You must enable JavaScript in your browser or LuCI will not work properly.%></p>
66                                 </div>
67                         </noscript>
68
69                         <div id="tabmenu" style="display:none"></div>