themes: add Bootstrap theme, created by David Menting / Nut & Bolt <david@nut-bolt.nl>
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.
This commit is contained in:
parent
5d45927643
commit
7c74bac897
8 changed files with 1796 additions and 0 deletions
2
themes/bootstrap/Makefile
Normal file
2
themes/bootstrap/Makefile
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
include ../../build/config.mk
|
||||||
|
include ../../build/module.mk
|
1536
themes/bootstrap/htdocs/luci-static/bootstrap/cascade.css
Normal file
1536
themes/bootstrap/htdocs/luci-static/bootstrap/cascade.css
Normal file
File diff suppressed because it is too large
Load diff
BIN
themes/bootstrap/htdocs/luci-static/bootstrap/favicon.ico
Normal file
BIN
themes/bootstrap/htdocs/luci-static/bootstrap/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
3
themes/bootstrap/htdocs/luci-static/bootstrap/html5.js
Normal file
3
themes/bootstrap/htdocs/luci-static/bootstrap/html5.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
// HTML5 Shiv v3 | @jon_neal @afarkas @rem | MIT/GPL2 Licensed
|
||||||
|
// Uncompressed source: https://github.com/aFarkas/html5shiv
|
||||||
|
(function(a,b){function f(a){var c,d,e,f;b.documentMode>7?(c=b.createElement("font"),c.setAttribute("data-html5shiv",a.nodeName.toLowerCase())):c=b.createElement("shiv:"+a.nodeName);while(a.firstChild)c.appendChild(a.childNodes[0]);for(d=a.attributes,e=d.length,f=0;f<e;++f)d[f].specified&&c.setAttribute(d[f].nodeName,d[f].nodeValue);c.style.cssText=a.style.cssText,a.parentNode.replaceChild(c,a),c.originalElement=a}function g(a){var b=a.originalElement;while(a.childNodes.length)b.appendChild(a.childNodes[0]);a.parentNode.replaceChild(b,a)}function h(a,b){b=b||"all";var c=-1,d=[],e=a.length,f,g;while(++c<e){f=a[c],g=f.media||b;if(f.disabled||!/print|all/.test(g))continue;d.push(h(f.imports,g),f.cssText)}return d.join("")}function i(c){var d=new RegExp("(^|[\\s,{}])("+a.html5.elements.join("|")+")","gi"),e=c.split("{"),f=e.length,g=-1;while(++g<f)e[g]=e[g].split("}"),b.documentMode>7?e[g][e[g].length-1]=e[g][e[g].length-1].replace(d,'$1font[data-html5shiv="$2"]'):e[g][e[g].length-1]=e[g][e[g].length-1].replace(d,"$1shiv\\:$2"),e[g]=e[g].join("}");return e.join("{")}var c=function(a){return a.innerHTML="<x-element></x-element>",a.childNodes.length===1}(b.createElement("a")),d=function(a,b,c){return b.appendChild(a),(c=(c?c(a):a.currentStyle).display)&&b.removeChild(a)&&c==="block"}(b.createElement("nav"),b.documentElement,a.getComputedStyle),e={elements:"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),shivDocument:function(a){a=a||b;if(a.documentShived)return;a.documentShived=!0;var f=a.createElement,g=a.createDocumentFragment,h=a.getElementsByTagName("head")[0],i=function(a){f(a)};c||(e.elements.join(" ").replace(/\w+/g,i),a.createElement=function(a){var b=f(a);return b.canHaveChildren&&e.shivDocument(b.document),b},a.createDocumentFragment=function(){return e.shivDocument(g())});if(!d&&h){var j=f("div");j.innerHTML=["x<style>","article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}","audio{display:none}","canvas,video{display:inline-block;*display:inline;*zoom:1}","[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}","mark{background:#FF0;color:#000}","</style>"].join(""),h.insertBefore(j.lastChild,h.firstChild)}return a}};e.shivDocument(b),a.html5=e;if(c||!a.attachEvent)return;a.attachEvent("onbeforeprint",function(){if(a.html5.supportsXElement||!b.namespaces)return;b.namespaces.shiv||b.namespaces.add("shiv");var c=-1,d=new RegExp("^("+a.html5.elements.join("|")+")$","i"),e=b.getElementsByTagName("*"),g=e.length,j,k=i(h(function(a,b){var c=[],d=a.length;while(d)c.unshift(a[--d]);d=b.length;while(d)c.unshift(b[--d]);c.sort(function(a,b){return a.sourceIndex-b.sourceIndex}),d=c.length;while(d)c[--d]=c[d].styleSheet;return c}(b.getElementsByTagName("style"),b.getElementsByTagName("link"))));while(++c<g)j=e[c],d.test(j.nodeName)&&f(j);b.appendChild(b._shivedStyleSheet=b.createElement("style")).styleSheet.cssText=k}),a.attachEvent("onafterprint",function(){if(a.html5.supportsXElement||!b.namespaces)return;var c=-1,d=b.getElementsByTagName("*"),e=d.length,f;while(++c<e)f=d[c],f.originalElement&&g(f);b._shivedStyleSheet&&b._shivedStyleSheet.parentNode.removeChild(b._shivedStyleSheet)})})(this,document)
|
4
themes/bootstrap/ipkg/postinst
Executable file
4
themes/bootstrap/ipkg/postinst
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
[ -n "${IPKG_INSTROOT}" ] || {
|
||||||
|
( . /etc/uci-defaults/luci-theme-bootstrap ) && rm -f /etc/uci-defaults/luci-theme-bootstrap
|
||||||
|
}
|
41
themes/bootstrap/luasrc/view/themes/bootstrap/footer.htm
Normal file
41
themes/bootstrap/luasrc/view/themes/bootstrap/footer.htm
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<%#
|
||||||
|
LuCI - Lua Configuration Interface
|
||||||
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||||
|
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||||
|
Copyright 2012 David Menting <david@nut-bolt.nl>
|
||||||
|
|
||||||
|
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)
|
||||||
|
%>
|
||||||
|
<footer><a href="<%=controller%>/about">Powered by <%= luci.__appname__ .. " (" .. luci.__version__ .. ")" %></a>
|
||||||
|
|
||||||
|
<%=luci.version.distversion%>
|
||||||
|
|
||||||
|
<% if #categories > 1 then %>
|
||||||
|
<ul class="breadcrumb pull-right" id="modemenu">
|
||||||
|
<% for i, r in ipairs(categories) do %>
|
||||||
|
<li<% if request[1] == r then %> class="active"<%end%>><a href="<%=controller%>/<%=r%>/"><%=striptags(translate(tree.nodes[r].title))%></a> <span class="divider">|</span></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
204
themes/bootstrap/luasrc/view/themes/bootstrap/header.htm
Normal file
204
themes/bootstrap/luasrc/view/themes/bootstrap/header.htm
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
<%#
|
||||||
|
LuCI - Lua Configuration Interface
|
||||||
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||||
|
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||||
|
Copyright 2012 David Menting <david@nut-bolt.nl>
|
||||||
|
|
||||||
|
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
|
||||||
|
%>
|
||||||
|
<ul class="tabs">
|
||||||
|
<%
|
||||||
|
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
|
||||||
|
%>
|
||||||
|
<li class="tabmenu-item-<%=v%><%- if nnode._menu_selected or (node.leaf and v == leaf) then -%> active<% end %>">
|
||||||
|
<a href="<%=nodeurl(prefix, v, nnode.query)%>"><%=striptags(translate(nnode.title))%></a>
|
||||||
|
</li>
|
||||||
|
<% end
|
||||||
|
end
|
||||||
|
|
||||||
|
if level > 2 then
|
||||||
|
%>
|
||||||
|
</ul>
|
||||||
|
<% end
|
||||||
|
|
||||||
|
if selected_node then
|
||||||
|
subtree(prefix .. selected_name .. "/", selected_node, level + 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<%=luci.i18n.context.lang%>">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||||
|
<!--[if lt IE 9]><script src="<%=media%>/html5.js"></script><![endif]-->
|
||||||
|
<link rel="stylesheet" href="<%=media%>/cascade.css">
|
||||||
|
<link rel="shortcut icon" href="<%=media%>/favicon.ico">
|
||||||
|
<% if node and node.css then %><link rel="stylesheet" href="<%=resource%>/<%=node.css%>">
|
||||||
|
<% end -%>
|
||||||
|
<script src="<%=resource%>/xhr.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %>">
|
||||||
|
<header>
|
||||||
|
<div class="fill">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="#"><%=hostname%></a>
|
||||||
|
<ul class="nav">
|
||||||
|
<%-
|
||||||
|
local function submenu(prefix, node)
|
||||||
|
local childs = disp.node_childs(node)
|
||||||
|
if #childs > 0 then
|
||||||
|
%>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<%-
|
||||||
|
for i, r in ipairs(childs) do
|
||||||
|
local nnode = node.nodes[r]
|
||||||
|
local href = controller .. prefix .. r ..
|
||||||
|
(nnode.query and http.build_querystring(nnode.query) or "")
|
||||||
|
%>
|
||||||
|
<li><a href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a></li>
|
||||||
|
<%-
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</ul>
|
||||||
|
<%-
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
childs = disp.node_childs(cattree)
|
||||||
|
|
||||||
|
if #childs > 0 then
|
||||||
|
for i, r in ipairs(childs) do
|
||||||
|
local nnode = cattree.nodes[r]
|
||||||
|
local href = controller .. "/" .. category .. "/" .. r ..
|
||||||
|
(nnode.query and http.build_querystring(k.query) or "")
|
||||||
|
local grandchildren = disp.node_childs(nnode)
|
||||||
|
|
||||||
|
if #grandchildren > 0 then
|
||||||
|
%>
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="menu" href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a>
|
||||||
|
<%- submenu("/" .. category .. "/" .. r .. "/", nnode) %>
|
||||||
|
</li>
|
||||||
|
<% else %>
|
||||||
|
<li>
|
||||||
|
<a href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a>
|
||||||
|
</li>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<%
|
||||||
|
-- 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
|
||||||
|
%>
|
||||||
|
<div class="pull-right">
|
||||||
|
<% if ucichanges > 0 then %>
|
||||||
|
<a class="label notice" href="<%=controller%>/<%=category%>/uci/changes"><%:Unsaved Changes%>: <%=ucichanges%></a>
|
||||||
|
<% end %>
|
||||||
|
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
|
||||||
|
<span class="label success" id="xhr_poll_status_on"><%:Auto Refresh%> <%:on%></span>
|
||||||
|
<span class="label" id="xhr_poll_status_off" style="display:none"><%:Auto Refresh%> <%:off%></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
|
||||||
|
<%- if luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%>
|
||||||
|
<div class="container">
|
||||||
|
<div class="alert-message warning">
|
||||||
|
<h4><%:No password set!%></h4>
|
||||||
|
<%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%><br>
|
||||||
|
<a href="<%=pcdata(luci.dispatcher.build_url("admin/system/admin"))%>"><%:Go to password configuration...%></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%- end -%>
|
||||||
|
|
||||||
|
<div id="maincontent" class="container">
|
||||||
|
<% if category then subtree("/" .. category .. "/", cattree) end %>
|
6
themes/bootstrap/root/etc/uci-defaults/luci-theme-bootstrap
Executable file
6
themes/bootstrap/root/etc/uci-defaults/luci-theme-bootstrap
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
uci batch <<-EOF
|
||||||
|
set luci.themes.Bootstrap=/luci-static/bootstrap
|
||||||
|
commit luci
|
||||||
|
EOF
|
||||||
|
exit 0
|
Loading…
Reference in a new issue