Passed
Push — master ( d122a2...93ca9b )
by Maxence
02:32
created

$(document).ready   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 43

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 43
rs 8.8571
cc 1
nc 1
nop 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A 0 5 1
A 0 11 1
A 0 10 1
1
/*
2
 * CMS Pico - Integration of Pico within your files to create websites.
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Maxence Lange <[email protected]>
8
 * @copyright 2017
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
27
/** global: OC */
28
/** global: OCA */
29
/** global: Notyf */
30
/** global: admin_pico_elements */
31
/** global: admin_pico_result */
32
/** global: admin_pico_nav */
33
34
var admin_pico_define = {
35
	sites: '/sites/',
36
	index: '/index.php',
37
	nchost: ''
38
};
39
40
41
$(document).ready(function () {
42
43
	/**
44
	 * @constructs AdminCMSPico
45
	 */
46
	var AdminCMSPico = function () {
47
48
		$.extend(AdminCMSPico.prototype, admin_pico_nav);
49
		$.extend(AdminCMSPico.prototype, admin_pico_elements);
50
		$.extend(AdminCMSPico.prototype, admin_pico_result);
51
		$.extend(AdminCMSPico.prototype, admin_pico_define);
52
53
		this.initialize();
54
		this.retrieveSettings();
55
	};
56
57
	AdminCMSPico.prototype = {
58
59
		initialize: function () {
60
			admin_pico_define.nchost = window.location.protocol + '//' + window.location.host;
61
			admin_pico_elements.initElements();
62
			admin_pico_elements.initUI();
63
		},
64
65
66
		retrieveSettings: function () {
67
68
			$.ajax({
69
				method: 'GET',
70
				url: OC.generateUrl('/apps/cms_pico/admin/settings'),
71
				data: {}
72
			}).done(function (res) {
73
				admin_pico_result.displaySettings(res);
74
			});
75
76
		}
77
78
	};
79
80
	OCA.AdminCMSPico = AdminCMSPico;
81
	OCA.AdminCMSPico.manage = new AdminCMSPico();
82
83
});
84