Completed
Pull Request — develop (#147)
by Wachter
14:07
created

typed-router.js ➔ define   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 37

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 8.8571
c 0
b 0
f 0
cc 1
nc 1
nop 2

8 Functions

Rating   Name   Duplication   Size   Complexity  
A typed-router.js ➔ ... ➔ .toPageAdd 0 3 1
A typed-router.js ➔ ... ➔ .toEditForce 0 3 1
A typed-router.js ➔ ... ➔ .toAdd 0 3 1
A typed-router.js ➔ ... ➔ .toPageEdit 0 3 1
A typed-router.js ➔ ... ➔ .toList 0 3 1
A typed-router.js ➔ ... ➔ goto 0 3 1
A typed-router.js ➔ ... ➔ .toEditUpdate 0 3 1
A typed-router.js ➔ ... ➔ .toEdit 0 3 1
1
/*
2
 * This file is part of the Sulu CMS.
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(['services/husky/mediator', 'suluarticle/services/base-router'], function(Mediator, BaseRouter) {
11
12
    'use strict';
13
14
    var routes = {
15
            list: _.template('articles:<%= type %>/<%= locale %>'),
0 ignored issues
show
Bug introduced by
The variable _ seems to be never declared. If this is a global, consider adding a /** global: _ */ 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...
16
            add: _.template('articles/<%= locale %>/add:<%= type %>')
17
        },
18
19
        goto = function(route) {
20
            Mediator.emit('sulu.router.navigate', route);
21
        };
22
23
    return {
24
        toList: function(locale, type) {
25
            goto(routes.list({locale: locale, type: type}));
26
        },
27
        toAdd: function(locale, type) {
28
            goto(routes.add({locale: locale, type: type}));
29
        },
30
        toEdit: function(id, locale, tab) {
31
            BaseRouter.toEdit(id, locale, tab);
32
        },
33
        toEditForce: function(id, locale, tab) {
34
            BaseRouter.toEditForce(id, locale, tab);
35
        },
36
        toEditUpdate: function(id, locale, tab) {
37
            BaseRouter.toEditUpdate(id, locale, tab);
38
        },
39
        toPageEdit: function(id, page, locale) {
40
            BaseRouter.toPageEdit(id, page, locale);
41
        },
42
        toPageAdd: function(id, locale) {
43
            BaseRouter.toPageAdd(id, locale);
44
        }
45
    };
46
});
47