Test Setup Failed
Push — master ( ae6bbc...554531 )
by
unknown
04:38
created

model.js ➔ define   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
dl 0
loc 47
rs 9.0303
c 0
b 0
f 0
nop 1

3 Functions

Rating   Name   Duplication   Size   Complexity  
A model.js ➔ ... ➔ Backbone.Model.extend.initialize 0 4 1
A model.js ➔ ... ➔ Backbone.Model.extend.toggleState 0 11 3
A model.js ➔ ... ➔ SidebarModel 0 3 1
1
define(function(require) {
2
    'use strict';
3
4
    var SidebarModel;
5
    var _ = require('underscore');
6
    var Backbone = require('backbone');
7
    var constants = require('./constants');
8
9
    SidebarModel = Backbone.Model.extend({
10
        defaults: {
11
            position: constants.SIDEBAR_LEFT,
12
            state: constants.SIDEBAR_MINIMIZED
13
        },
14
15
        /**
16
         * @inheritDoc
17
         */
18
        constructor: function SidebarModel() {
19
            SidebarModel.__super__.constructor.apply(this, arguments);
20
        },
21
22
        /**
23
         * @inheritDoc
24
         */
25
        initialize: function(data, options) {
26
            _.extend(this, _.pick(options, ['urlRoot']));
27
            SidebarModel.__super__.initialize.apply(this, arguments);
28
        },
29
30
        /**
31
         * Toggles state of sidebar between minimized and maximized
32
         */
33
        toggleState: function() {
34
            switch (this.get('state')) {
0 ignored issues
show
Coding Style introduced by
As per coding-style, switch statements should have a default case.
Loading history...
35
                case constants.SIDEBAR_MINIMIZED:
0 ignored issues
show
Bug introduced by
The variable constants seems to be never declared. If this is a global, consider adding a /** global: constants */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
36
                    this.set('state', constants.SIDEBAR_MAXIMIZED);
37
                    break;
38
39
                case constants.SIDEBAR_MAXIMIZED:
40
                    this.set('state', constants.SIDEBAR_MINIMIZED);
41
                    break;
42
            }
43
        }
44
    });
45
46
    return SidebarModel;
47
});
48