luci-theme-material: Decrease font and spacing
[project/luci.git] / themes / luci-theme-material / luasrc / view / themes / material / header.htm
1 <%#
2 Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI
3
4 luci-theme-material
5 Copyright 2015 Lutty Yang
6 <lutty@wcan.in>
7
8 Have a bug? Please create an issue here on GitHub!
9 https://github.com/LuttyYang/luci-theme-material/issues
10
11 luci-theme-bootstrap:
12 Copyright 2008 Steven Barth
13 <steven@midlink.org>
14 Copyright 2008 Jo-Philipp Wich
15 <jow@openwrt.org>
16 Copyright 2012 David Menting
17 <david@nut-bolt.nl>
18
19 MUI:
20 https://github.com/muicss/mui
21
22 Licensed to the public under the Apache License 2.0
23 -%>
24
25 <%
26 local ver = require "luci.version"
27 local sys  = require "luci.sys"
28 local util = require "luci.util"
29 local http = require "luci.http"
30 local disp = require "luci.dispatcher"
31
32 local boardinfo = util.ubus("system", "board")
33
34 local request  = disp.context.path
35 local request2 = disp.context.request
36
37 local category = request[1]
38 local cattree  = category and disp.node(category)
39
40 local leaf = request2[#request2]
41
42 local tree = disp.node()
43 local node = disp.context.dispatched
44
45 local categories = disp.node_childs(tree)
46
47 local c = tree
48 local i, r
49
50 -- tag all nodes leading to this page
51 for i, r in ipairs(request) do
52 if c.nodes and c.nodes[r] then
53 c = c.nodes[r]
54 c._menu_selected = true
55 end
56 end
57
58 -- send as HTML5
59 http.prepare_content("text/html")
60
61 local function nodeurl(prefix, name, query)
62 local url = controller .. prefix .. name .. "/"
63 if query then
64 url = url .. http.build_querystring(query)
65 end
66 return pcdata(url)
67 end
68
69 local function subtree(prefix, node, level)
70 if not level then
71 level = 1
72 end
73
74 local childs = disp.node_childs(node)
75 if #childs > 0 then
76
77 if level > 2 then
78 %>
79 <ul class="tabs">
80     <%
81     end
82
83     local selected_node
84     local selected_name
85     local i, v
86
87     for i, v in ipairs(childs) do
88     local nnode = node.nodes[v]
89     if nnode._menu_selected then
90     selected_node = nnode
91     selected_name = v
92     end
93     if level > 2 then
94     %>
95     <li class="tabmenu-item-<%=v%><%- if nnode._menu_selected or (node.leaf and v == leaf) then %> active<% end %>">
96         <a href="<%=nodeurl(prefix, v, nnode.query)%>"><%=striptags(translate(nnode.title))%></a>
97     </li>
98     <% end
99     end
100
101     if level > 2 then
102     %>
103 </ul>
104 <%          end
105
106 if selected_node then
107 subtree(prefix .. selected_name .. "/", selected_node, level + 1)
108 end
109 end
110 end
111 -%>
112 <!DOCTYPE html>
113 <html lang="<%=luci.i18n.context.lang%>">
114 <head>
115     <meta charset="utf-8">
116     <title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or
117         '')) %> - LuCI</title>
118     <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
119     <meta name="format-detection" content="telephone=no, email=no"/>
120     <meta name="apple-mobile-web-app-capable" content="yes">
121     <meta name="mobile-web-app-capable" content="yes">
122     <meta name="x5-fullscreen" content="true">
123     <meta name="full-screen" content="yes">
124     <meta name="x5-page-mode" content="app">
125     <meta name="browsermode" content="application">
126     <meta name="theme-color" content="#0099CC">
127     <meta name="msapplication-tap-highlight" content="no">
128     <meta name="msapplication-TileColor" content="#0099CC">
129
130     <meta name="application-name" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI">
131     <meta name="apple-mobile-web-app-title" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI">
132     <meta name="msapplication-TileImage" content="<%=media%>/logo.png"/>
133     <link rel="icon" href="<%=media%>/logo.png" sizes="144x144">
134     <link rel="apple-touch-icon-precomposed" href="<%=media%>/logo.png" sizes="144x144">
135
136     <link rel="stylesheet" href="<%=media%>/css/style.css">
137     <link rel="shortcut icon" href="<%=media%>/favicon.ico">
138     <% if node and node.css then %>
139     <link rel="stylesheet" href="<%=resource%>/<%=node.css%>">
140     <% end -%>
141     <% if css then %>
142     <style title="text/css">
143         <
144         %
145         -
146         =
147         css
148
149         %
150         >
151     </style>
152     <% end -%>
153     <script src="<%=resource%>/xhr.js"></script>
154 </head>
155
156 <body class="lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>">
157
158 <header>
159     <div class="container">
160         <span class="showSide"></span>
161         <a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
162         <div class="pull-right">
163             <%
164             -- calculate the number of unsaved changes
165             if tree.nodes[category] and tree.nodes[category].ucidata then
166             local ucichanges = 0
167             for i, j in pairs(require("luci.model.uci").cursor():changes()) do
168             for k, l in pairs(j) do
169             for m, n in pairs(l) do
170             ucichanges = ucichanges + 1;
171             end
172             end
173             end
174             %>
175             <% if ucichanges > 0 then %>
176             <a class="label notice"
177                href="<%=controller%>/<%=category%>/uci/changes?redir=<%=http.urlencode(http.formvalue(" redir") or
178             REQUEST_URI)%>"><span class="mobile-hide"><%:Unsaved Changes%>: </span><%=ucichanges%></a>
179             <% end %>
180                         <span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
181                                 <span class="label success" id="xhr_poll_status_on"><span class="mobile-hide"><%:Auto Refresh%> </span><%:on%></span>
182                                 <span class="label" id="xhr_poll_status_off" style="display:none"><span class="mobile-hide"><%:Auto Refresh%> </span><%:off%></span>
183                         </span>
184             <% end %>
185         </div>
186     </div>
187 </header>
188
189 <div class="main">
190     <div style="" class="loading"><span><div class="loading-img"></div>Loading...</span></div>
191     <div class="main-left">
192         <ul class="nav">
193             <%-
194             local function submenu(prefix, node)
195             local childs = disp.node_childs(node)
196             if #childs > 0 then
197             %>
198             <ul class="slide-menu">
199                 <%-
200                 for i, r in ipairs(childs) do
201                 local nnode = node.nodes[r]
202                 local href = controller .. prefix .. r ..
203                 (nnode.query and http.build_querystring(nnode.query) or "")
204                 %>
205                 <li><a data-title="<%=pcdata(striptags(nnode.title))%>" href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a>
206                 </li>
207                 <%-
208                 end
209                 %>
210             </ul>
211             <%-
212             end
213             end
214
215             childs = disp.node_childs(cattree)
216
217             if #childs > 0 then
218             for i, r in ipairs(childs) do
219             local nnode = cattree.nodes[r]
220             local href = controller .. "/" .. category .. "/" .. r ..
221             (nnode.query and http.build_querystring(k.query) or "")
222             local grandchildren = disp.node_childs(nnode)
223
224             if #grandchildren > 0 then
225             %>
226             <li class="slide">
227                 <a class="menu" data-title="<%=pcdata(striptags(nnode.title))%>" href="#"><%=pcdata(striptags(translate(nnode.title)))%></a>
228                 <%- submenu("/" .. category .. "/" .. r .. "/", nnode) %>
229             </li>
230             <% else %>
231             <li>
232                 <a data-title="<%=pcdata(striptags(nnode.title))%>" href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a>
233             </li>
234             <%
235             end
236             end
237             end
238             %>
239         </ul>
240     </div>
241     <div class="main-right">
242         <div class="darkMask"></div>
243         <div id="maincontent">
244             <div class="container">
245                 <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not
246                 luci.sys.user.getpasswd("root") then -%>
247                 <div class="alert-message warning">
248                     <h4><%:No password set!%></h4>
249                     <%:There is no password set on this router. Please configure a root password to protect the web
250                     interface and enable SSH.%><br>
251                     <a href="<%=pcdata(luci.dispatcher.build_url(" admin/system/admin"))%>"><%:Go to password
252                     configuration...%></a>
253                 </div>
254                 <%- end -%>
255                 <% if category then subtree("/" .. category .. "/", cattree) end %>
256