mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
improved theme dropdown, selected theme detection
This commit is contained in:
parent
b93763cef8
commit
259d3838b5
@ -5,22 +5,17 @@
|
|||||||
*/
|
*/
|
||||||
function DisplayThemeConfig()
|
function DisplayThemeConfig()
|
||||||
{
|
{
|
||||||
|
$themes = [
|
||||||
|
"default" => "RaspAP (default)",
|
||||||
|
"hackernews" => "HackerNews",
|
||||||
|
"terminal" => "Terminal"
|
||||||
|
];
|
||||||
|
$themeFiles = [
|
||||||
|
"default" => "custom.css",
|
||||||
|
"hackernews" => "hackernews.css",
|
||||||
|
"terminal" => "terminal.css"
|
||||||
|
];
|
||||||
|
$selectedTheme = array_search($_COOKIE['theme'], $themeFiles);
|
||||||
|
|
||||||
$cselected = '';
|
echo renderTemplate("themes", compact("themes", "selectedTheme"));
|
||||||
$hselected = '';
|
|
||||||
$tselected = '';
|
|
||||||
|
|
||||||
switch ($_COOKIE['theme']) {
|
|
||||||
case "custom.css":
|
|
||||||
$cselected = ' selected="selected"';
|
|
||||||
break;
|
|
||||||
case "hackernews.css":
|
|
||||||
$hselected = ' selected="selected"';
|
|
||||||
break;
|
|
||||||
case "terminal.css":
|
|
||||||
$tselected = ' selected="selected"';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo renderTemplate("themes", compact("cselected", "hselected", "tselected"));
|
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="code"><?php echo _("Select a theme"); ?></label>
|
<label for="code"><?php echo _("Select a theme"); ?></label>
|
||||||
<select class="form-control" id="theme-select"><?php echo _("Select a Theme"); ?>
|
<?php SelectorOptions("theme", $themes, $selectedTheme, "theme-select") ?>
|
||||||
<option value="default" class="theme-link"<?php echo $cselected; ?>>RaspAP (default)</option>
|
|
||||||
<option value="hackernews" class="theme-link"<?php echo $hselected; ?>>HackerNews</option>
|
|
||||||
<option value="terminal" class="theme-link"<?php echo $tselected; ?>>Terminal</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user