Resources/public/js/components/comments/edit/details/main.js   A
last analyzed

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 44
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 44
rs 10
c 0
b 0
f 0
cc 0
nc 1
mnd 0
bc 7
fnc 7
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B main.js ➔ define 0 39 1
1
/*
2
 * This file is part of Sulu.
3
 *
4
 * (c) MASSIVE ART WebServices GmbH
5
 *
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
define([
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11
    'underscore',
12
    'jquery',
13
    'services/sulucomment/comment-manager',
14
    'text!/admin/comments/comment-template/details.html'
15
], function(_, $, CommentManager, form) {
16
17
    return {
18
19
        defaults: {
20
            templates: {
21
                form: form
22
            },
23
            translations: {
24
                title: 'public.title',
25
                message: 'sulu_comment.list.message'
26
            }
27
        },
28
29
        type: 'form-tab',
30
31
        tabInitialize: function() {
32
            this.sandbox.on('sulu.content.changed', this.setDirty.bind(this));
33
        },
34
35
        parseData: function(data) {
36
            return data;
37
        },
38
39
        save: function(data) {
40
            CommentManager.save(data).then(function(data) {
41
                this.saved(data);
42
            }.bind(this));
43
        },
44
45
        getTemplate: function() {
46
            return this.templates.form({translations: this.translations, translate: this.sandbox.translate});
47
        },
48
49
        getFormId: function() {
50
            return '#comment-form';
51
        }
52
    };
53
});
54