summaryrefslogtreecommitdiffhomepage
path: root/themes/luci-theme-bootstrap/ucode
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-09-09 20:08:57 +0200
committerJo-Philipp Wich <jo@mein.io>2022-10-25 01:03:37 +0200
commit2e3282e624836c9e7cd425dee6eec708038b3a26 (patch)
treeb32fb0dead66fd39eb5236f0c2821fac21358fba /themes/luci-theme-bootstrap/ucode
parentf478fe6c4351749520730f65550f29b57eb107fb (diff)
luci-theme-bootstrap: translate Lua templates to ucode equivalents
Add ucode template equivalents for the Lua templates used by the theme. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'themes/luci-theme-bootstrap/ucode')
l---------themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-dark1
l---------themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-light1
-rw-r--r--themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/footer.ut20
-rw-r--r--themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut83
-rw-r--r--themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/sysauth.ut48
5 files changed, 153 insertions, 0 deletions
diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-dark b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-dark
new file mode 120000
index 0000000000..ac7bcbbf37
--- /dev/null
+++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-dark
@@ -0,0 +1 @@
+bootstrap \ No newline at end of file
diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-light b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-light
new file mode 120000
index 0000000000..ac7bcbbf37
--- /dev/null
+++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-light
@@ -0,0 +1 @@
+bootstrap \ No newline at end of file
diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/footer.ut b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/footer.ut
new file mode 100644
index 0000000000..6031724053
--- /dev/null
+++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/footer.ut
@@ -0,0 +1,20 @@
+ {% if (!blank_page): %}
+ </div>
+ <footer>
+ <span>
+ Powered by
+ <a href="https://github.com/openwrt/luci">
+ {{ version.luciname }} ({{ version.luciversion }})</a>
+ /
+ <a href="{{ entityencode(version.disturl ?? '#', true) }}">
+ {{ version.distname }} {{ version.distversion }} ({{ version.distrevision }})</a>
+ {% if (lua_active): %}
+ / {{ _('Lua compatibility mode active') }}
+ {% endif %}
+ </span>
+ <ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul>
+ </footer>
+ <script type="text/javascript">L.require('menu-bootstrap')</script>
+ {% endif %}
+ </body>
+</html>
diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut
new file mode 100644
index 0000000000..b7bc770b4b
--- /dev/null
+++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut
@@ -0,0 +1,83 @@
+{#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2012 David Menting <david@nut-bolt.nl>
+ Copyright 2008-2022 Jo-Philipp Wich <jo@mein.io>
+ Licensed to the public under the Apache License 2.0.
+-#}
+
+{%
+ import { getuid, getspnam } from 'luci.core';
+
+ const boardinfo = ubus.call('system', 'board');
+ const darkpref = (theme == 'bootstrap-dark' ? 'true' : (theme == 'bootstrap-light' ? 'false' : null));
+
+ http.prepare_content('text/html; charset=UTF-8');
+-%}
+
+<!DOCTYPE html>
+<html lang="{{ dispatcher.lang }}" {{ darkpref ? `data-darkmode="${darkpref}"` : '' }}>
+ <head>
+ <meta charset="utf-8">
+ <title>{{ striptags(`${boardinfo.hostname ?? '?'}${node ? ` - ${node.title}` : ''}`) }} - LuCI</title>
+ {% if (!darkpref): %}
+ <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>
+ {% endif %}
+ <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" />
+ <link rel="shortcut icon" href="{{ media }}/favicon.png">
+ {% if (node?.css): %}
+ <link rel="stylesheet" href="{{ resource }}/{{ node.css }}">
+ {% endif %}
+ {% if (css): %}
+ <style title="text/css">{{ css }}</style>
+ {% endif %}
+ <script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script>
+ <script src="{{ resource }}/cbi.js"></script>
+ </head>
+
+ <body class="lang_{{ dispatcher.lang }} {{ entityencode(striptags(node?.title ?? ''), true) }}" data-page="{{ entityencode(join('-', ctx.request_path), true) }}">
+ {% if (!blank_page): %}
+ <header>
+ <a class="brand" href="/">{{ striptags(boardinfo.hostname ?? '?') }}</a>
+ <ul class="nav" id="topmenu" style="display:none"></ul>
+ <div id="indicators" class="pull-right"></div>
+ </header>
+
+ <div id="maincontent" class="container">
+ {% if (getuid() == 0 && getspnam('root')?.pwdp === ''): %}
+ <div class="alert-message warning">
+ <h4>{{ _('No password set!') }}</h4>
+ <p>{{ _('There is no password set on this router. Please configure a root password to protect the web interface.') }}</p>
+ {% if (dispatcher.lookup("admin/system/admin")): %}
+ <div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/admin") }}">{{ _('Go to password configuration...') }}</a></div>
+ {% endif %}
+ </div>
+ {% endif %}
+
+ {% if (boardinfo.rootfs_type == "initramfs"): %}
+ <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 (dispatcher.lookup("admin/system/flash")): %}
+ <div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/flash") }}">{{ _('Go to firmware upgrade...') }}</a></div>
+ {% endif %}
+ </div>
+ {% endif %}
+
+ <noscript>
+ <div class="alert-message warning">
+ <h4>{{ _('JavaScript required!') }}</h4>
+ <p>{{ _('You must enable JavaScript in your browser or LuCI will not work properly.') }}</p>
+ </div>
+ </noscript>
+
+ <div id="tabmenu" style="display:none"></div>
+ {% endif %}
diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/sysauth.ut b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/sysauth.ut
new file mode 100644
index 0000000000..a172d95d76
--- /dev/null
+++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/sysauth.ut
@@ -0,0 +1,48 @@
+{#
+ Copyright 2022 Jo-Philipp Wich <jo@mein.io>
+ Licensed to the public under the Apache License 2.0.
+-#}
+
+{% include('header', { blank_page: true }) %}
+
+<section hidden>
+ <form method="post" class="cbi-map">
+ <div class="cbi-section">
+ <div class="cbi-section-node">
+ <div class="cbi-value">
+ <label class="cbi-value-title" for="luci_username">{{ _('Username') }}</label>
+ <div class="cbi-value-field">
+ <input name="luci_username" id="luci_username" type="text" autocomplete="username" value="{{ entityencode(duser, true) }}">
+ </div>
+ </div>
+ <div class="cbi-value">
+ <label class="cbi-value-title" for="luci_password">{{ _('Password') }}</label>
+ <div class="cbi-value-field">
+ <input name="luci_password" id="luci_password" type="password" autocomplete="current-password">
+ </div>
+ </div>
+ </div>
+ </div>
+ </form>
+
+ <hr>
+
+ {% if (fuser): %}
+ <div class="alert-message error">
+ {{ _('Invalid username and/or password! Please try again.') }}
+ </div>
+ {% endif %}
+
+ <button class="btn cbi-button-positive important">{{ _('Login') }}</button>
+</section>
+
+<div id="view">
+ <div class="spinning">{{ _('Loading view…') }}</div>
+ <script type="text/javascript">
+ L.require('ui').then(function(ui) {
+ ui.instantiateView('bootstrap.sysauth');
+ });
+ </script>
+</div>
+
+{% include('footer', { blank_page: true }) %}