Passed
Push — master ( 93ca9b...d96f2b )
by Maxence
02:43
created

js/admin.result.js   A

Complexity

Total Complexity 5
Complexity/F 1.67

Size

Lines of Code 29
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
dl 0
loc 29
rs 10
c 1
b 0
f 1
cc 0
nc 1
mnd 1
bc 5
fnc 3
bpm 1.6666
cpm 1.6666
noi 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A admin_pico_result.displayCurrentTemplates 0 7 2
A admin_pico_result.displaySettings 0 4 1
A admin_pico_result.displayNewTemplates 0 9 2
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
/** global: OC */
27
/** global: OCA */
28
/** global: admin_pico_define */
29
/** global: admin_pico_elements */
30
/** global: admin_pico_nav */
31
32
var admin_pico_result = {
33
34
	displaySettings: function (settings) {
35
		admin_pico_result.displayNewTemplates(settings.templates_new);
36
		admin_pico_result.displayCurrentTemplates(settings.templates);
37
	},
38
39
40
	displayNewTemplates: function (templates) {
41
		admin_pico_elements.cms_pico_new_template.empty();
42
		for (var i = 0; i < templates.length; i++) {
43
			admin_pico_elements.cms_pico_new_template.append($('<option>', {
44
				value: templates[i],
45
				text: templates[i]
46
			}));
47
		}
48
	},
49
50
51
	displayCurrentTemplates: function (templates) {
52
		admin_pico_elements.cms_pico_curr_templates.emptyTable();
53
		for (var i = 0; i < templates.length; i++) {
54
			var tmpl = admin_pico_nav.generateTmplCustomTemplate(templates[i]);
55
			admin_pico_elements.cms_pico_curr_templates.append(tmpl);
56
		}
57
	}
58
59
60
};