aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html2
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts7
-rw-r--r--client/src/app/core/theme/theme.service.ts4
-rw-r--r--client/src/app/shared/shared-user-settings/user-interface-settings.component.html2
-rw-r--r--client/src/app/shared/shared-user-settings/user-interface-settings.component.ts8
5 files changed, 11 insertions, 12 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html
index 315cd1749..7dfe5f5f9 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html
@@ -17,7 +17,7 @@
17 <select formControlName="default" id="themeDefault" class="form-control"> 17 <select formControlName="default" id="themeDefault" class="form-control">
18 <option i18n value="default">{{ getDefaultThemeLabel() }}</option> 18 <option i18n value="default">{{ getDefaultThemeLabel() }}</option>
19 19
20 <option *ngFor="let theme of getAvailableThemes()" [value]="theme">{{ theme }}</option> 20 <option *ngFor="let theme of availableThemes" [value]="theme.id">{{ theme.label }}</option>
21 </select> 21 </select>
22 </div> 22 </div>
23 </div> 23 </div>
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
index f8f257671..56227d11c 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
@@ -19,6 +19,7 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges {
19 19
20 signupAlertMessage: string 20 signupAlertMessage: string
21 defaultLandingPageOptions: SelectOptionsItem[] = [] 21 defaultLandingPageOptions: SelectOptionsItem[] = []
22 availableThemes: SelectOptionsItem[]
22 23
23 constructor ( 24 constructor (
24 private configService: ConfigService, 25 private configService: ConfigService,
@@ -29,6 +30,8 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges {
29 ngOnInit () { 30 ngOnInit () {
30 this.buildLandingPageOptions() 31 this.buildLandingPageOptions()
31 this.checkSignupField() 32 this.checkSignupField()
33
34 this.availableThemes = this.themeService.buildAvailableThemes()
32 } 35 }
33 36
34 ngOnChanges (changes: SimpleChanges) { 37 ngOnChanges (changes: SimpleChanges) {
@@ -49,10 +52,6 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges {
49 return this.configService.videoQuotaDailyOptions 52 return this.configService.videoQuotaDailyOptions
50 } 53 }
51 54
52 getAvailableThemes () {
53 return this.themeService.getAvailableThemeLabels()
54 }
55
56 doesTrendingVideosAlgorithmsEnabledInclude (algorithm: string) { 55 doesTrendingVideosAlgorithmsEnabledInclude (algorithm: string) {
57 const enabled = this.form.value['trending']['videos']['algorithms']['enabled'] 56 const enabled = this.form.value['trending']['videos']['algorithms']['enabled']
58 if (!Array.isArray(enabled)) return false 57 if (!Array.isArray(enabled)) return false
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index da6f2442a..40939ecb8 100644
--- a/client/src/app/core/theme/theme.service.ts
+++ b/client/src/app/core/theme/theme.service.ts
@@ -49,9 +49,9 @@ export class ThemeService {
49 return $localize`Light/Orange` 49 return $localize`Light/Orange`
50 } 50 }
51 51
52 getAvailableThemeLabels () { 52 buildAvailableThemes () {
53 return this.serverConfig.theme.registered 53 return this.serverConfig.theme.registered
54 .map(t => capitalizeFirstLetter(t.name)) 54 .map(t => ({ id: t.name, label: capitalizeFirstLetter(t.name) }))
55 } 55 }
56 56
57 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) { 57 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) {
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.html b/client/src/app/shared/shared-user-settings/user-interface-settings.component.html
index 1a24641a2..1e6e55e98 100644
--- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.html
+++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.html
@@ -8,7 +8,7 @@
8 <option i18n value="instance-default">{{ instanceName }} default theme ({{ getDefaultInstanceThemeLabel() }})</option> 8 <option i18n value="instance-default">{{ instanceName }} default theme ({{ getDefaultInstanceThemeLabel() }})</option>
9 <option i18n value="default">{{ getDefaultThemeLabel() }}</option> 9 <option i18n value="default">{{ getDefaultThemeLabel() }}</option>
10 10
11 <option *ngFor="let theme of getAvailableThemes()" [value]="theme">{{ theme }}</option> 11 <option *ngFor="let theme of availableThemes" [value]="theme.id">{{ theme.label }}</option>
12 </select> 12 </select>
13 </div> 13 </div>
14 </div> 14 </div>
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
index 24ad54b1d..13e2e5424 100644
--- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
+++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
@@ -3,6 +3,7 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core'
3import { AuthService, Notifier, ServerService, ThemeService, UserService } from '@app/core' 3import { AuthService, Notifier, ServerService, ThemeService, UserService } from '@app/core'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models' 5import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models'
6import { SelectOptionsItem } from 'src/types'
6 7
7@Component({ 8@Component({
8 selector: 'my-user-interface-settings', 9 selector: 'my-user-interface-settings',
@@ -15,6 +16,7 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
15 @Input() notifyOnUpdate = true 16 @Input() notifyOnUpdate = true
16 @Input() userInformationLoaded: Subject<any> 17 @Input() userInformationLoaded: Subject<any>
17 18
19 availableThemes: SelectOptionsItem[]
18 formValuesWatcher: Subscription 20 formValuesWatcher: Subscription
19 21
20 private serverConfig: HTMLServerConfig 22 private serverConfig: HTMLServerConfig
@@ -37,6 +39,8 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
37 ngOnInit () { 39 ngOnInit () {
38 this.serverConfig = this.serverService.getHTMLConfig() 40 this.serverConfig = this.serverService.getHTMLConfig()
39 41
42 this.availableThemes = this.themeService.buildAvailableThemes()
43
40 this.buildForm({ 44 this.buildForm({
41 theme: null 45 theme: null
42 }) 46 })
@@ -61,10 +65,6 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
61 return this.themeService.getDefaultThemeLabel() 65 return this.themeService.getDefaultThemeLabel()
62 } 66 }
63 67
64 getAvailableThemes () {
65 return this.themeService.getAvailableThemeLabels()
66 }
67
68 getDefaultInstanceThemeLabel () { 68 getDefaultInstanceThemeLabel () {
69 const theme = this.serverConfig.theme.default 69 const theme = this.serverConfig.theme.default
70 70