add button to set default colors
This commit is contained in:
parent
9f9f8f90c8
commit
e2430866e5
|
@ -136,3 +136,9 @@
|
||||||
height: 15px;
|
height: 15px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-reset {
|
||||||
|
position: absolute;
|
||||||
|
margin-top: 8px !important;
|
||||||
|
margin-left: 5px !important;
|
||||||
|
}
|
||||||
|
|
|
@ -110,6 +110,12 @@ class Admin implements ISettings
|
||||||
$darkModeBackgroundColorTo = $this->config->getAppValue('dark-mode-background-color-to', $darkenPrimaryColor);
|
$darkModeBackgroundColorTo = $this->config->getAppValue('dark-mode-background-color-to', $darkenPrimaryColor);
|
||||||
|
|
||||||
$parameters = [
|
$parameters = [
|
||||||
|
'defaults' => [
|
||||||
|
'background-color' => $darkenPrimaryColor,
|
||||||
|
'background-color-to' => $darkenPrimaryColor,
|
||||||
|
'dark-mode-background-color' => $darkenPrimaryColor,
|
||||||
|
'dark-mode-background-color-to' => $darkenPrimaryColor,
|
||||||
|
],
|
||||||
'background-color' => $backgroundColor,
|
'background-color' => $backgroundColor,
|
||||||
'background-color-to' => $backgroundColorTo,
|
'background-color-to' => $backgroundColorTo,
|
||||||
'background-color-opacity' => $this->config->getAppValueInt('background-color-opacity', '100'),
|
'background-color-opacity' => $this->config->getAppValueInt('background-color-opacity', '100'),
|
||||||
|
|
13
src/admin.js
13
src/admin.js
|
@ -150,6 +150,19 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
saveSettings(0)
|
saveSettings(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const resets = document.querySelectorAll('.btn-reset')
|
||||||
|
|
||||||
|
for (let btn of resets) {
|
||||||
|
btn.addEventListener('click', (event) => {
|
||||||
|
const target = event.target
|
||||||
|
const values = JSON.parse(target.getAttribute('data-reset'))
|
||||||
|
|
||||||
|
for (let i in values) {
|
||||||
|
document.querySelector(`#${i}`).value = values[i]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const displays = document.querySelectorAll('.side-menu-display')
|
const displays = document.querySelectorAll('.side-menu-display')
|
||||||
|
|
||||||
for (let display of displays) {
|
for (let display of displays) {
|
||||||
|
|
|
@ -67,6 +67,11 @@ $choicesSizes = [
|
||||||
class="side-menu-setting side-menu-setting-live"
|
class="side-menu-setting side-menu-setting-live"
|
||||||
value="<?php print_unescaped($_['background-color-to']); ?>">
|
value="<?php print_unescaped($_['background-color-to']); ?>">
|
||||||
|
|
||||||
|
<button class="btn btn-info btn-reset" data-reset="<?php echo htmlentities(json_encode([
|
||||||
|
'side-menu-background-color' => $_['defaults']['background-color'],
|
||||||
|
'side-menu-background-color-to' => $_['defaults']['background-color-to'],
|
||||||
|
])) ?>"><?php p($l->t('Set default')); ?></button>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<em>
|
<em>
|
||||||
<?php p($l->t('Transparent')); ?>
|
<?php p($l->t('Transparent')); ?>
|
||||||
|
@ -227,16 +232,23 @@ $choicesSizes = [
|
||||||
</div>
|
</div>
|
||||||
<div class="side-menu-setting-form side-menu-setting-form-long">
|
<div class="side-menu-setting-form side-menu-setting-form-long">
|
||||||
<input
|
<input
|
||||||
|
id="side-menu-dark-mode-background-color"
|
||||||
name="dark-mode-background-color"
|
name="dark-mode-background-color"
|
||||||
type="color"
|
type="color"
|
||||||
class="side-menu-setting"
|
class="side-menu-setting"
|
||||||
value="<?php print_unescaped($_['dark-mode-background-color']); ?>">
|
value="<?php print_unescaped($_['dark-mode-background-color']); ?>">
|
||||||
<input
|
<input
|
||||||
|
id="side-menu-dark-mode-background-color-to"
|
||||||
name="dark-mode-background-color-to"
|
name="dark-mode-background-color-to"
|
||||||
type="color"
|
type="color"
|
||||||
class="side-menu-setting"
|
class="side-menu-setting"
|
||||||
value="<?php print_unescaped($_['dark-mode-background-color-to']); ?>">
|
value="<?php print_unescaped($_['dark-mode-background-color-to']); ?>">
|
||||||
|
|
||||||
|
<button class="btn btn-info btn-reset" data-reset="<?php echo htmlentities(json_encode([
|
||||||
|
'side-menu-dark-mode-background-color' => $_['defaults']['dark-mode-background-color'],
|
||||||
|
'side-menu-dark-mode-background-color-to' => $_['defaults']['dark-mode-background-color-to'],
|
||||||
|
])) ?>"><?php p($l->t('Set default')); ?></button>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<em>
|
<em>
|
||||||
<?php p($l->t('Transparent')); ?>
|
<?php p($l->t('Transparent')); ?>
|
||||||
|
@ -842,7 +854,7 @@ $choicesSizes = [
|
||||||
<a class="side-menu-toggler" data-target="#apps-categories-custom-list" href="#_">
|
<a class="side-menu-toggler" data-target="#apps-categories-custom-list" href="#_">
|
||||||
🖱️ <?php p($l->t('Show and hide the list of applications')); ?>
|
🖱️ <?php p($l->t('Show and hide the list of applications')); ?>
|
||||||
</a>
|
</a>
|
||||||
|
-to
|
||||||
<div id="apps-categories-custom-list" style="display: none">
|
<div id="apps-categories-custom-list" style="display: none">
|
||||||
<ul class="side-menu-setting-list">
|
<ul class="side-menu-setting-list">
|
||||||
<?php foreach ($_['apps'] as $app): ?>
|
<?php foreach ($_['apps'] as $app): ?>
|
||||||
|
|
Loading…
Reference in a new issue