Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / app / controllers / items.js @ faad3c72

History | View | Annotate | Download (1.7 kB)

1
App.ItemsListController = Ember.ArrayController.extend({
2
    
3
    codeName: '',
4

    
5
    // returns the same as codename, i.e. networks, serves as page title
6
    title: function () {
7
        return this.codeName;
8
    }.property(),
9

    
10
    // returns codename without an 's', i.e. network
11
    _item: function () {
12
        return this.codeName.substring(0, this.codeName.length - 1);
13
    }.property(),
14
    
15
    // returns codename without an 's', i.e. network
16
    itemController: function () {
17
        return this.get('_item');
18
    }.property(),
19

    
20
    // returns snf-network-full
21
    iconCls:  function () {
22
        return 'snf-'+this.get('_item')+'-full';
23
    }.property(),
24

    
25
    // returns snf-network-create-full
26
    newIcon:  function () {
27
        return 'snf-'+this.get('_item')+'-create-full';
28
    }.property(),
29

    
30
    // returns Create new network
31
    newTxt:  function () {
32
        return 'Create new '+this.get('_item');
33
    }.property(),
34
    
35
    // enables grid/list view in action bar
36
    hasViewCls: true,
37

    
38
    // enables search functionality action bar
39
    hasSearch: true,
40

    
41
    // enables filtering in action bar    
42
    hasFilter: true,
43

    
44
    codeNameParent: function () {
45
        return this.codeName;
46
    }.property(),
47

    
48
    codeNameChildInit: function () {
49
        return this.get('_item')+'init';
50
    }.property(),
51
    
52
});
53

    
54

    
55
App.NetworksController = App.ItemsListController.extend({
56
    codeName : 'networks',
57
});
58

    
59

    
60
App.VmsController = App.ItemsListController.extend({
61
    codeName : 'vms',
62
    newIcon  : 'snf-pc-create-full', 
63
    iconCls  : 'snf-pc-full',
64
});
65

    
66

    
67
App.VolumesController = App.ItemsListController.extend({
68
    codeName : 'volumes',
69
});
70

    
71
App.TagsController = Ember.ArrayController.extend();