mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Persist selected theme in dropdown
This commit is contained in:
parent
f6c983d8ff
commit
8a501c075f
8
dist/js/sb-admin-2.js
vendored
8
dist/js/sb-admin-2.js
vendored
@ -6,7 +6,7 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function set_theme(theme) {
|
function set_theme(theme) {
|
||||||
$('link[title="main"]').attr('href', theme);
|
$('link[title="main"]').attr('href', 'dist/css/' + theme);
|
||||||
|
|
||||||
// persist selected theme in cookie
|
// persist selected theme in cookie
|
||||||
setCookie('theme',theme,90);
|
setCookie('theme',theme,90);
|
||||||
@ -20,9 +20,9 @@ function setCookie(cname, cvalue, exdays) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var themes = {
|
var themes = {
|
||||||
"default": "dist/css/custom.css",
|
"default": "custom.css",
|
||||||
"hackernews" : "dist/css/hackernews.css",
|
"hackernews" : "hackernews.css",
|
||||||
"terminal" : "dist/css/terminal.css",
|
"terminal" : "terminal.css",
|
||||||
}
|
}
|
||||||
|
|
||||||
//Loads the correct sidebar on window load,
|
//Loads the correct sidebar on window load,
|
||||||
|
@ -5,6 +5,22 @@
|
|||||||
*/
|
*/
|
||||||
function DisplayThemeConfig(){
|
function DisplayThemeConfig(){
|
||||||
|
|
||||||
|
$cselected = '';
|
||||||
|
$hselected = '';
|
||||||
|
$tselected = '';
|
||||||
|
|
||||||
|
switch( $_COOKIE['theme'] ) {
|
||||||
|
case "custom.css":
|
||||||
|
$cselected = "selected";
|
||||||
|
break;
|
||||||
|
case "hackernews.css":
|
||||||
|
$hselected = "selected";
|
||||||
|
break;
|
||||||
|
case "terminal.css":
|
||||||
|
$tselected = "selected";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
@ -20,10 +36,10 @@ function DisplayThemeConfig(){
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="code">Select a theme</label>
|
<label for="code">Select a theme</label>
|
||||||
<select class="form-control" id="theme-select">Select a Theme</a>
|
<select class="form-control" id="theme-select">Select a Theme
|
||||||
<option value="default" class="theme-link">RaspAP (default)</option>
|
<option value="default" class="theme-link" <?php echo $cselected; ?>>RaspAP (default)</option>
|
||||||
<option value="hackernews" class="theme-link">HackerNews</option>
|
<option value="hackernews" class="theme-link"<?php echo $hselected; ?>>HackerNews</option>
|
||||||
<option value="terminal" class="theme-link">Terminal</option>
|
<option value="terminal" class="theme-link" <?php echo $tselected; ?>>Terminal</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,10 +66,11 @@ if (empty($_SESSION['csrf_token'])) {
|
|||||||
$csrf_token = $_SESSION['csrf_token'];
|
$csrf_token = $_SESSION['csrf_token'];
|
||||||
|
|
||||||
if(!isset($_COOKIE['theme'])) {
|
if(!isset($_COOKIE['theme'])) {
|
||||||
$theme_url = "dist/css/custom.css";
|
$theme = "custom.css";
|
||||||
} else {
|
} else {
|
||||||
$theme_url = $_COOKIE['theme'];
|
$theme = $_COOKIE['theme'];
|
||||||
}
|
}
|
||||||
|
$theme_url = 'dist/css/' . $theme;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
Loading…
Reference in New Issue
Block a user