From 7c74bac8970e36d41693dce3257d7c2f3ee5950c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 15 Feb 2012 18:08:44 +0000 Subject: themes: add Bootstrap theme, created by David Menting / Nut & Bolt This theme is clean, modern and based on Twitter Bootstrap. It's been tested on a TP-Link WR1043n and a Carambola under Firefox, Safari and IE8. --- .../luasrc/view/themes/bootstrap/footer.htm | 41 +++++ .../luasrc/view/themes/bootstrap/header.htm | 204 +++++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 themes/bootstrap/luasrc/view/themes/bootstrap/footer.htm create mode 100644 themes/bootstrap/luasrc/view/themes/bootstrap/header.htm (limited to 'themes/bootstrap/luasrc/view') diff --git a/themes/bootstrap/luasrc/view/themes/bootstrap/footer.htm b/themes/bootstrap/luasrc/view/themes/bootstrap/footer.htm new file mode 100644 index 0000000000..7d341073fc --- /dev/null +++ b/themes/bootstrap/luasrc/view/themes/bootstrap/footer.htm @@ -0,0 +1,41 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2012 David Menting + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +-%> +<% + local disp = require "luci.dispatcher" + + local request = disp.context.path + + local category = request[1] + + local tree = disp.node() + + local categories = disp.node_childs(tree) +%> + + + + + + diff --git a/themes/bootstrap/luasrc/view/themes/bootstrap/header.htm b/themes/bootstrap/luasrc/view/themes/bootstrap/header.htm new file mode 100644 index 0000000000..60c7a6ebcf --- /dev/null +++ b/themes/bootstrap/luasrc/view/themes/bootstrap/header.htm @@ -0,0 +1,204 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2012 David Menting + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +-%> +<% + local sys = require "luci.sys" + local http = require "luci.http" + local disp = require "luci.dispatcher" + + local hostname = sys.hostname() + + local request = disp.context.path + local request2 = disp.context.request + + local category = request[1] + local cattree = category and disp.node(category) + + local leaf = request2[#request2] + + local tree = disp.node() + local node = disp.context.dispatched + + local categories = disp.node_childs(tree) + + local c = tree + local i, r + + -- tag all nodes leading to this page + for i, r in ipairs(request) do + if c.nodes and c.nodes[r] then + c = c.nodes[r] + c._menu_selected = true + end + end + + -- send as HTML5 + http.prepare_content("text/html") + + local function nodeurl(prefix, name, query) + local url = controller .. prefix .. name .. "/" + if query then + url = url .. http.build_querystring(query) + end + return pcdata(url) + end + + local function subtree(prefix, node, level) + if not level then + level = 1 + end + + local childs = disp.node_childs(node) + if #childs > 0 then + + if level > 2 then +%> +
    + <% + end + + local selected_node + local selected_name + local i, v + + for i, v in ipairs(childs) do + local nnode = node.nodes[v] + if nnode._menu_selected then + selected_node = nnode + selected_name = v + end + if level > 2 then + %> +
  • + <%=striptags(translate(nnode.title))%> +
  • + <% end + end + + if level > 2 then + %> +
+<% end + + if selected_node then + subtree(prefix .. selected_name .. "/", selected_node, level + 1) + end + end + end +-%> + + + + + <%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI + + + + <% if node and node.css then %> + <% end -%> + + + + +
+
+
+ <%=hostname%> + + + <% + -- calculate the number of unsaved changes + if tree.nodes[category] and tree.nodes[category].ucidata then + local ucichanges = 0 + + for i, j in pairs(require("luci.model.uci").cursor():changes()) do + for k, l in pairs(j) do + for m, n in pairs(l) do + ucichanges = ucichanges + 1; + end + end + end + %> +
+ <% if ucichanges > 0 then %> + <%:Unsaved Changes%>: <%=ucichanges%> + <% end %> + +
+ <% end %> +
+
+
+ + +<%- if luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%> +
+
+

<%:No password set!%>

+ <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%>
+ "><%:Go to password configuration...%> +
+
+<%- end -%> + +
+<% if category then subtree("/" .. category .. "/", cattree) end %> -- cgit v1.2.3