mirror of
https://github.com/unraid/webgui.git
synced 2026-02-22 18:29:47 -06:00
refactor: replace $theme1 variable usage with ThemeHelper methods for consistency across multiple pages
This commit is contained in:
@@ -21,8 +21,8 @@ Nchan="docker_load:stop"
|
||||
<?
|
||||
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
|
||||
$width = in_array($theme,['white','black']) ? -58: -44;
|
||||
$top = in_array($theme,['white','black']) ? 40 : 20;
|
||||
$width = $themeHelper->isTopNavTheme() ? -58: -44; // $themeHelper set in DefaultPageLayout.php
|
||||
$top = $themeHelper->isTopNavTheme() ? 40 : 20;
|
||||
$busy = "<i class='fa fa-spin fa-circle-o-notch'></i> "._('Please wait')."... "._('starting up containers');
|
||||
$cpus = cpu_list();
|
||||
?>
|
||||
@@ -82,7 +82,7 @@ function LockButton() {
|
||||
$('#resetsort').removeClass('nohand').addClass('hand');
|
||||
$('i.mover').show();
|
||||
$('#docker_list .sortable').css({'cursor':'move'});
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
$('div.nav-item.LockButton').find('a').prop('title',"_(Lock sortable items)_");
|
||||
$('div.nav-item.LockButton').find('b').removeClass('icon-u-lock green-text').addClass('icon-u-lock-open red-text');
|
||||
<?endif;?>
|
||||
@@ -99,7 +99,7 @@ function LockButton() {
|
||||
$('#resetsort').removeClass('hand').addClass('nohand');
|
||||
$('i.mover').hide();
|
||||
$('#docker_list .sortable').css({'cursor':'default'});
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
$('div.nav-item.LockButton').find('a').prop('title',"_(Unlock sortable items)_");
|
||||
$('div.nav-item.LockButton').find('b').removeClass('icon-u-lock-open red-text').addClass('icon-u-lock green-text');
|
||||
<?endif;?>
|
||||
|
||||
@@ -51,7 +51,7 @@ function setupGUIsearch() {
|
||||
window.addEventListener('keydown',function(e){
|
||||
if (!e.shiftKey && !e.altKey && (navigator.appVersion.indexOf('Mac')==-1 ? e.ctrlKey : e.metaKey) && e.keyCode==75) {
|
||||
e.preventDefault();
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
if (guiSearchBoxSpan()) closeSearchBox(e); else gui_search();
|
||||
<?endif;?>
|
||||
}
|
||||
@@ -63,7 +63,7 @@ function setupGUIsearch() {
|
||||
}
|
||||
|
||||
function gui_search() {
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
languageVisible = $('.nav-item.LanguageButton').is(':visible');
|
||||
$('.nav-tile.right').prepend("<?=$guiSearchBoxSpan?>").css('overflow','visible');
|
||||
$('.nav-item.util,.nav-user.show').hide();
|
||||
@@ -86,7 +86,7 @@ function gui_search() {
|
||||
function closeSearchBox(e) {
|
||||
e.stopPropagation();
|
||||
$('#guiSearchBoxSpan').remove();
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
$('.nav-tile.right').css({'overflow-x':'auto','overflow-y':'hidden'});
|
||||
$('.nav-item.util,.nav-user.show').show();
|
||||
if (!languageVisible) $('.nav-item.LanguageButton').hide();
|
||||
|
||||
@@ -404,7 +404,7 @@ function LockButton() {
|
||||
$('#resetsort').removeClass('nohand').addClass('hand');
|
||||
$('i.mover').show();
|
||||
$('#kvm_list .sortable').css({'cursor':'move'});
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
$('div.nav-item.LockButton a').prop('title',"_(Lock sortable items)_");
|
||||
$('div.nav-item.LockButton b').removeClass('icon-u-lock green-text').addClass('icon-u-lock-open red-text');
|
||||
<?endif;?>
|
||||
@@ -427,7 +427,7 @@ function LockButton() {
|
||||
$('#resetsort').removeClass('hand').addClass('nohand');
|
||||
$('i.mover').hide();
|
||||
$('#kvm_list .sortable').css({'cursor':'default'});
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
$('div.nav-item.LockButton a').prop('title',"_(Unlock sortable items)_");
|
||||
$('div.nav-item.LockButton b').removeClass('icon-u-lock-open red-text').addClass('icon-u-lock green-text');
|
||||
<?endif;?>
|
||||
|
||||
@@ -22,7 +22,7 @@ if (substr($_SERVER['REQUEST_URI'],0,4) != '/VMs') {
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
}
|
||||
|
||||
switch ($display['theme']) {
|
||||
switch ($themeHelper->getThemeName()) { // $themeHelper set in DefaultPageLayout.php
|
||||
case 'gray' : $bgcolor = '#121510'; $border = '#606e7f'; $top = -44; break;
|
||||
case 'azure': $bgcolor = '#edeaef'; $border = '#606e7f'; $top = -44; break;
|
||||
case 'black': $bgcolor = '#212121'; $border = '#2b2b2b'; $top = -64; break;
|
||||
|
||||
@@ -191,7 +191,7 @@ $ramsize = my_scale($total,$unit,0,-1,1024)." $unit";
|
||||
$low = $memory_maximum < $memory_installed;
|
||||
if ($low) $memory_maximum = pow(2,ceil(log($memory_installed)/log(2)));
|
||||
|
||||
switch ($theme) {
|
||||
switch ($themeHelper->getThemeName()) { // $themeHelper set in DefaultPageLayout.php
|
||||
case 'white': $color = '#1c1b1b'; $grid = '#e3e3e3'; $c0 = '#a8a8a8'; $c1 = '#dcdcdc'; break;
|
||||
case 'black': $color = '#f2f2f2'; $grid = '#2b2b2b'; $c0 = '#787878'; $c1 = '#444444'; break;
|
||||
case 'azure': $color = '#606e7f'; $grid = '#f3f0f4'; $c0 = '#606e7f'; $c1 = '#eceaec'; break;
|
||||
@@ -1553,7 +1553,7 @@ var sortableHelper = function(e,ui){
|
||||
function LockButton() {
|
||||
if ($.cookie('lockbutton') == null) {
|
||||
$.cookie('lockbutton','lockbutton');
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
$('div.nav-item.LockButton a').prop('title',"_(Lock sortable items)_");
|
||||
$('div.nav-item.LockButton b').removeClass('icon-u-lock green-text').addClass('icon-u-lock-open red-text');
|
||||
<?endif;?>
|
||||
@@ -1585,7 +1585,7 @@ function LockButton() {
|
||||
}});
|
||||
} else {
|
||||
$.removeCookie('lockbutton');
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
$('div.nav-item.LockButton a').prop('title',"_(Unlock sortable items)_");
|
||||
$('div.nav-item.LockButton b').removeClass('icon-u-lock-open red-text').addClass('icon-u-lock green-text');
|
||||
<?endif;?>
|
||||
|
||||
@@ -251,8 +251,8 @@ _(Temperature unit)_:
|
||||
|
||||
_(Dynamix color theme)_:
|
||||
: <select name="theme">
|
||||
<?foreach ($themeHelper->getThemesFromFileSystem($docroot) as $theme):?>
|
||||
<?=mk_option($themeHelper->getThemeName(), $theme, _(ucfirst($theme)))?>
|
||||
<?foreach ($themeHelper->getThemesFromFileSystem($docroot) as $guiTheme):?>
|
||||
<?=mk_option($themeHelper->getThemeName(), $guiTheme, _(ucfirst($guiTheme)))?>
|
||||
<?endforeach; // $themeHelper set in DefaultPageLayout.php ?>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ function annotate($text) {echo "\n<!--\n",str_repeat("#",strlen($text)),"\n$text
|
||||
<style>
|
||||
<?if (empty($display['width'])):?>
|
||||
@media (max-width:1280px){#displaybox{min-width:1280px;max-width:1280px;margin:0}}
|
||||
@media (min-width:1281px){#displaybox{min-width:1280px;max-width:1920px;margin:0 <?=$themes1?'10px':'auto'?>}}
|
||||
@media (min-width:1281px){#displaybox{min-width:1280px;max-width:1920px;margin:0 <?=$themeHelper->isTopNavTheme()?'10px':'auto'?>}}
|
||||
@media (min-width:1921px){#displaybox{min-width:1280px;max-width:1920px;margin:0 auto}}
|
||||
<?else:?>
|
||||
@media (max-width:1280px){#displaybox{min-width:1280px;margin:0}}
|
||||
@media (min-width:1281px){#displaybox{min-width:1280px;margin:0 <?=$themes1?'10px':'auto'?>}}
|
||||
@media (min-width:1921px){#displaybox{min-width:1280px;margin:0 <?=$themes1?'20px':'auto'?>}}
|
||||
@media (min-width:1281px){#displaybox{min-width:1280px;margin:0 <?=$themeHelper->isTopNavTheme()?'10px':'auto'?>}}
|
||||
@media (min-width:1921px){#displaybox{min-width:1280px;margin:0 <?=$themeHelper->isTopNavTheme()?'20px':'auto'?>}}
|
||||
<?endif;?>
|
||||
|
||||
<?if ($display['font']):?>
|
||||
@@ -78,7 +78,7 @@ html{font-size:<?=$display['font']?>%}
|
||||
|
||||
<?if ($backgnd):?>
|
||||
#header{background-color:#<?=$backgnd?>}
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
.nav-tile{background-color:#<?=$backgnd?>}
|
||||
<?if ($header):?>
|
||||
.nav-item a,.nav-user a{color:#<?=$header?>}
|
||||
@@ -759,7 +759,7 @@ foreach ($buttons as $button) {
|
||||
// include page specific stylesheets (if existing)
|
||||
$css = "/{$button['root']}/sheets/{$button['name']}";
|
||||
$css_stock = "$css.css";
|
||||
$css_theme = "$css-$theme.css";
|
||||
$css_theme = "$css-$theme.css"; // @todo add syslog for deprecation notice
|
||||
if (is_file($docroot.$css_stock)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_stock),'">',"\n";
|
||||
if (is_file($docroot.$css_theme)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_theme),'">',"\n";
|
||||
// create page content
|
||||
@@ -1091,7 +1091,7 @@ $(window).scroll(function() {
|
||||
} else {
|
||||
$('.back_to_top').fadeOut(scrollDuration);
|
||||
}
|
||||
<?if ($themes1):?>
|
||||
<?if ($themeHelper->isTopNavTheme()):?>
|
||||
var top = $('div#header').height()-1; // header height has 1 extra pixel to cover overlap
|
||||
$('div#menu').css($(this).scrollTop() > top ? {position:'fixed',top:'0'} : {position:'absolute',top:top+'px'});
|
||||
// banner
|
||||
|
||||
Reference in New Issue
Block a user