Completed
Push — master ( e88c19...17669b )
by Rain
03:00
created

dev/Settings/Admin/Prem/Branding.js   A

Size

Lines of Code 104

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
nc 1
dl 0
loc 104
rs 10
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B Branding.js ➔ ??? 0 94 4
1
2
import _ from '_';
3
import {settingsSaveHelperSimpleFunction, trim, boolToAjax} from 'Common/Utils';
4
5
import {BrandingAdminSettings} from 'Settings/Admin/Branding';
6
7
class BrandingPremAdminSettings extends BrandingAdminSettings
8
{
9
	onBuild(oDom) {
10
		super.onBuild(oDom);
11
12
		if (this.capa && this.capa() && !this.community)
13
		{
14
			_.delay(() => {
15
				const
16
					Remote = require('Remote/Admin/Ajax'),
17
					f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this),
18
					f2 = settingsSaveHelperSimpleFunction(this.loginDescription.trigger, this),
19
					f3 = settingsSaveHelperSimpleFunction(this.loginCss.trigger, this),
20
					f4 = settingsSaveHelperSimpleFunction(this.userLogo.trigger, this),
21
					f5 = settingsSaveHelperSimpleFunction(this.userLogoTitle.trigger, this),
22
					f6 = settingsSaveHelperSimpleFunction(this.loginBackground.trigger, this),
23
					f7 = settingsSaveHelperSimpleFunction(this.userCss.trigger, this),
24
					f8 = settingsSaveHelperSimpleFunction(this.welcomePageUrl.trigger, this),
25
					f9 = settingsSaveHelperSimpleFunction(this.welcomePageDisplay.trigger, this),
26
					f10 = settingsSaveHelperSimpleFunction(this.userLogoMessage.trigger, this),
27
					f11 = settingsSaveHelperSimpleFunction(this.userIframeMessage.trigger, this);
28
29
				this.loginLogo.subscribe((value) => {
30
					Remote.saveAdminConfig(f1, {
31
						'LoginLogo': trim(value)
32
					});
33
				});
34
35
				this.loginDescription.subscribe((value) => {
36
					Remote.saveAdminConfig(f2, {
37
						'LoginDescription': trim(value)
38
					});
39
				});
40
41
				this.loginCss.subscribe((value) => {
42
					Remote.saveAdminConfig(f3, {
43
						'LoginCss': trim(value)
44
					});
45
				});
46
47
				this.userLogo.subscribe((value) => {
48
					Remote.saveAdminConfig(f4, {
49
						'UserLogo': trim(value)
50
					});
51
				});
52
53
				this.userLogoTitle.subscribe((value) => {
54
					Remote.saveAdminConfig(f5, {
55
						'UserLogoTitle': trim(value)
56
					});
57
				});
58
59
				this.userLogoMessage.subscribe((value) => {
60
					Remote.saveAdminConfig(f10, {
61
						'UserLogoMessage': trim(value)
62
					});
63
				});
64
65
				this.userIframeMessage.subscribe((value) => {
66
					Remote.saveAdminConfig(f11, {
67
						'UserIframeMessage': trim(value)
68
					});
69
				});
70
71
				this.loginBackground.subscribe((value) => {
72
					Remote.saveAdminConfig(f6, {
73
						'LoginBackground': trim(value)
74
					});
75
				});
76
77
				this.userCss.subscribe((value) => {
78
					Remote.saveAdminConfig(f7, {
79
						'UserCss': trim(value)
80
					});
81
				});
82
83
				this.welcomePageUrl.subscribe((value) => {
84
					Remote.saveAdminConfig(f8, {
85
						'WelcomePageUrl': trim(value)
86
					});
87
				});
88
89
				this.welcomePageDisplay.subscribe((value) => {
90
					Remote.saveAdminConfig(f9, {
91
						'WelcomePageDisplay': trim(value)
92
					});
93
				});
94
95
				this.loginPowered.subscribe((value) => {
96
					Remote.saveAdminConfig(null, {
97
						'LoginPowered': boolToAjax(value)
98
					});
99
				});
100
			}, 50);
101
		}
102
	}
103
}
104
105
export {BrandingPremAdminSettings, BrandingPremAdminSettings as default};
106