diff options
Diffstat (limited to 'themes/luci-theme-bootstrap/luasrc/view')
5 files changed, 63 insertions, 26 deletions
diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-dark b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-dark new file mode 120000 index 0000000000..ac7bcbbf37 --- /dev/null +++ b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-dark @@ -0,0 +1 @@ +bootstrap
\ No newline at end of file diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-light b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-light new file mode 120000 index 0000000000..ac7bcbbf37 --- /dev/null +++ b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-light @@ -0,0 +1 @@ +bootstrap
\ No newline at end of file diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/footer.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/footer.htm index 7b84772180..48d9b98b92 100644 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/footer.htm +++ b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/footer.htm @@ -1,20 +1,21 @@ <%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Copyright 2012 David Menting <david@nut-bolt.nl> - Licensed to the public under the Apache License 2.0. + Copyright 2008 Steven Barth <steven@midlink.org> + Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> + Copyright 2012 David Menting <david@nut-bolt.nl> + Licensed to the public under the Apache License 2.0. -%> -<% local ver = require "luci.version" %> - - <footer> - <span> - <a href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> / <%= ver.distversion %> - </span> - <ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul> - </footer> - </div> - <script type="text/javascript">L.require('menu-bootstrap')</script> - </body> + <% if not blank_page then %> + <% local ver = require "luci.version" %> + </div> + <footer> + <span> + <a href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> / <%= ver.distversion %> + </span> + <ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul> + </footer> + <script type="text/javascript">L.require('menu-bootstrap')</script> + <% end %> + </body> </html> diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm index 6e4861fe0b..0a93165f57 100644 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm +++ b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm @@ -15,14 +15,32 @@ local node = disp.context.dispatched + local darkpref + + if theme == "bootstrap-dark" then + darkpref = "true" + elseif theme == "bootstrap-light" then + darkpref = "false" + end + -- send as HTML5 http.prepare_content("text/html") -%> <!DOCTYPE html> -<html lang="<%=luci.i18n.context.lang%>"> +<html lang="<%=luci.i18n.context.lang%>"<%= ifattr(darkpref ~= nil, "data-darkmode", darkpref) %>> <head> <meta charset="utf-8"> <title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title> + <% if darkpref == nil then %> + <script type="text/javascript"> + var mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'), + rootElement = document.querySelector(':root'), + setDarkMode = function(match) { rootElement.setAttribute('data-darkmode', match.matches) }; + + mediaQuery.addEventListener('change', setDarkMode); + setDarkMode(mediaQuery); + </script> + <% end %> <meta name="viewport" content="initial-scale=1.0"> <link rel="stylesheet" href="<%=media%>/cascade.css"> <link rel="stylesheet" media="only screen and (max-device-width: 854px)" href="<%=media%>/mobile.css" type="text/css" /> @@ -38,6 +56,7 @@ </head> <body class="lang_<%=luci.i18n.context.lang%> <% if node then %><%= striptags( node.title ) %><%- end %>" data-page="<%= pcdata(table.concat(disp.context.requestpath, "-")) %>"> + <% if not blank_page then %> <header> <a class="brand" href="/"><%=striptags(boardinfo.hostname or "?")%></a> <ul class="nav" id="topmenu" style="display:none"></ul> @@ -55,16 +74,6 @@ </div> <%- end -%> - <%- if boardinfo.rootfs_type == "initramfs" then -%> - <div class="alert-message warning"> - <h4><%:System running in recovery (initramfs) mode.%></h4> - <p><%:No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade%></p> - <% if disp.lookup("admin/system/flash") then %> - <div class="right"><a class="btn" href="<%=url("admin/system/flash")%>"><%:Go to firmware upgrade...%></a></div> - <% end %> - </div> - <%- end -%> - <noscript> <div class="alert-message warning"> <h4><%:JavaScript required!%></h4> @@ -73,3 +82,4 @@ </noscript> <div id="tabmenu" style="display:none"></div> + <% end %> diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/sysauth.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/sysauth.htm new file mode 100644 index 0000000000..2427199bf5 --- /dev/null +++ b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/sysauth.htm @@ -0,0 +1,24 @@ +<%# + Copyright 2021 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-%> + +<% + -- tell bootstrap's templates to not render header and footer + blank_page = true +%> + +<%+header%> + +<div id="view"> + <div class="spinning"><%:Loading view…%></div> + <script type="text/javascript"> + L.env.default_login_user = <%=luci.http.write_json(duser) %>; + + L.require('ui').then(function(ui) { + ui.instantiateView('bootstrap.sysauth'); + }); + </script> +</div> + +<%+footer%> |