mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #46504 from nextcloud/fix/dark-theme-enforce
This commit is contained in:
commit
b05e963f15
4 changed files with 22 additions and 5 deletions
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
4
dist/theming-personal-theming.js
vendored
4
dist/theming-personal-theming.js
vendored
File diff suppressed because one or more lines are too long
2
dist/theming-personal-theming.js.map
vendored
2
dist/theming-personal-theming.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue