assets/scripts/layout.js   A
last analyzed

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 54
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
dl 0
loc 54
rs 10
cc 0
nc 1
mnd 0
bc 6
fnc 6
bpm 1
cpm 1
noi 0
1
var Layout = function() {
2
3
	/**
4
     * Get default dfi layout.
5
     */
6
    this.getDefaultDFILayout = function(index) {
7
        return $.ajax({
8
            url: '/wp-admin/admin-ajax.php?action=wpdfi_get_default_layout',
9
            method: 'POST',
10
            data: {
11
                index: index,
12
                include_delete: true
13
            },
14
        })
15
    }
16
17
    /**
18
     * Get related layout of a dfi, related layout include taxonomies, image upload and image size.
19
     */
20
    this.getRelatedDFILayout = function(dfiIndex, postType) {
21
        return $.ajax({
22
            url: '/wp-admin/admin-ajax.php?action=wpdfi_get_related_layout',
23
            method: 'POST',
24
            data: {
25
                dfi_index: dfiIndex,
26
                post_type: postType
27
            },
28
        })
29
    }
30
31
    /**
32
     * Get errors wrapper layout.
33
     */
34
    this.getErrorListingWrapperLayout = function() {
35
        return '<ul class="error-list">%error-list-markup%</ul>';
36
    }
37
38
    /**
39
     * Get single error listing layout.
40
     */
41
    this.getErrorSingleListingLayout = function(errorContent) {
42
        return '<li class="single-error">' + errorContent + '</li>';
43
    }
44
45
    /**
46
     * Get delete button layout.
47
     */
48
    this.getDeleteButtonLayout = function() {
49
        return '<a href="#" class="btn-remove">-</a>';
50
    }
51
52
}
53
54
export default Layout;