diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-07-15 10:09:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-15 10:09:54 +0200 |
commit | b05e963f15d33502c6dafc435d3d3435d844ab2a (patch) | |
tree | b691b60e42d7f7db5a438d9655bcefb25bfef863 /apps | |
parent | fcff64afc7e2e5162bcacae7ba9d4c5faff93fa6 (diff) | |
parent | 1d00f48d2604d52af95b9a2af26ac8e7210d1699 (diff) | |
download | nextcloud-server-b05e963f15d33502c6dafc435d3d3435d844ab2a.tar.gz nextcloud-server-b05e963f15d33502c6dafc435d3d3435d844ab2a.zip |
Merge pull request #46504 from nextcloud/fix/dark-theme-enforce
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/lib/Service/ThemesService.php | 8 | ||||
-rw-r--r-- | apps/theming/src/components/ItemPreview.vue | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/apps/theming/lib/Service/ThemesService.php b/apps/theming/lib/Service/ThemesService.php index 653b895be2c..49cd72d4255 100644 --- a/apps/theming/lib/Service/ThemesService.php +++ b/apps/theming/lib/Service/ThemesService.php @@ -28,7 +28,7 @@ class ThemesService { private LoggerInterface $logger, private DefaultTheme $defaultTheme, LightTheme $lightTheme, - DarkTheme $darkTheme, + private DarkTheme $darkTheme, HighContrastTheme $highContrastTheme, DarkHighContrastTheme $darkHighContrastTheme, DyslexiaFont $dyslexiaFont) { @@ -59,9 +59,15 @@ class ThemesService { } $defaultTheme = $this->themesProviders[$this->defaultTheme->getId()]; + $darkTheme = $this->themesProviders[$this->darkTheme->getId()]; $theme = $this->themesProviders[$enforcedTheme]; return [ + // Leave the default theme as a fallback $defaultTheme->getId() => $defaultTheme, + // Make sure we also have the dark theme to allow apps + // to scope sections of their UI to the dark theme + $darkTheme->getId() => $darkTheme, + // Finally, the enforced theme $theme->getId() => $theme, ]; } diff --git a/apps/theming/src/components/ItemPreview.vue b/apps/theming/src/components/ItemPreview.vue index b1f52f2134c..c5e78607912 100644 --- a/apps/theming/src/components/ItemPreview.vue +++ b/apps/theming/src/components/ItemPreview.vue @@ -13,7 +13,10 @@ <span v-if="enforced" class="theming__preview-warning" role="note"> {{ t('theming', 'Theme selection is enforced') }} </span> - <NcCheckboxRadioSwitch class="theming__preview-toggle" + + <!-- Only show checkbox if we can change themes --> + <NcCheckboxRadioSwitch v-show="!enforced" + class="theming__preview-toggle" :checked.sync="checked" :disabled="enforced" :name="name" @@ -73,6 +76,10 @@ export default { return this.selected }, set(checked) { + if (this.enforced) { + return + } + console.debug('Changed theme', this.theme.id, checked) // If this is a radio, we can only enable @@ -89,6 +96,10 @@ export default { methods: { onToggle() { + if (this.enforced) { + return + } + if (this.switchType === 'radio') { this.checked = true return |