improved dark mode, automatic theme switch (#5720)
This commit is contained in:
@@ -91,8 +91,8 @@ abstract class TimesheetAbstractController extends AbstractController
|
||||
|
||||
if ($canSeeRate) {
|
||||
$table->addColumn('hourlyRate', ['class' => 'text-end d-none text-nowrap']);
|
||||
$table->addColumn('internalRate', ['class' => 'text-end text-nowrap d-none d-xxl-table-cell']);
|
||||
$table->addColumn('rate', ['class' => 'text-end text-nowrap']);
|
||||
$table->addColumn('internalRate', ['class' => 'text-end text-nowrap d-none']);
|
||||
$table->addColumn('rate', ['class' => 'text-end text-nowrap d-none']);
|
||||
}
|
||||
|
||||
$table->addColumn('customer', ['class' => 'd-none d-md-table-cell']);
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
use App\Configuration\LocaleService;
|
||||
use App\Constants;
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserPreference;
|
||||
use KevinPapst\TablerBundle\Helper\ContextHelper;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\KernelEvent;
|
||||
@@ -46,8 +44,6 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$this->helper->setAssetVersion((string) Constants::VERSION_ID);
|
||||
|
||||
if ($this->localeService->isRightToLeft($event->getRequest()->getLocale())) {
|
||||
$this->helper->setIsRightToLeft(true);
|
||||
}
|
||||
@@ -63,9 +59,14 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$skin = $user->getPreferenceValue(UserPreference::SKIN);
|
||||
$skin = $user->getSkin();
|
||||
if ($skin === 'dark') {
|
||||
$this->helper->setIsDarkMode(true);
|
||||
} elseif ($skin === 'auto') {
|
||||
$this->helper->setThemeAuto(true);
|
||||
} else {
|
||||
$this->helper->setIsDarkMode(false);
|
||||
$this->helper->setThemeAuto(false);
|
||||
}
|
||||
|
||||
// do not allow boxed layout, header is not compatible and other functions need the full size as well
|
||||
|
||||
@@ -60,7 +60,7 @@ final class MultiUpdateTable extends AbstractType
|
||||
'label' => $key,
|
||||
'attr' => [
|
||||
'data-href' => $value,
|
||||
'class' => 'multi_update_table_action' . (stripos($key, 'delete') !== false ? ' btn-danger' : ''),
|
||||
'class' => 'multi_update_table_action' . (stripos($key, 'delete') !== false ? ' btn-danger' : ' btn-primary'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -18,18 +18,17 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
final class SkinType extends AbstractType
|
||||
{
|
||||
public const THEMES = [
|
||||
'skin.light' => 'default',
|
||||
'skin.dark' => 'dark',
|
||||
];
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'label' => 'skin',
|
||||
'search' => false,
|
||||
'required' => true,
|
||||
'choices' => self::THEMES,
|
||||
'choices' => [
|
||||
'automatic' => 'auto',
|
||||
'skin.light' => 'default',
|
||||
'skin.dark' => 'dark',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ final class MenuItemModel implements MenuItemInterface
|
||||
private bool $divider = false;
|
||||
private bool $lastWasDivider = false;
|
||||
private bool $expanded = false;
|
||||
private bool $disabled = false;
|
||||
private string $translationDomain = 'messages';
|
||||
|
||||
public function __construct(
|
||||
@@ -308,4 +309,14 @@ final class MenuItemModel implements MenuItemInterface
|
||||
{
|
||||
$this->translationDomain = $translationDomain;
|
||||
}
|
||||
|
||||
public function setDisabled(bool $disabled): void
|
||||
{
|
||||
$this->disabled = $disabled;
|
||||
}
|
||||
|
||||
public function isDisabled(): bool
|
||||
{
|
||||
return $this->disabled;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user