Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / ember / controllers / items.js @ a6c6857c

History | View | Annotate | Download (1.8 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
    itemController: function () {
12
        return this.codeName.substring(0, this.codeName.length - 1);
13
    }.property(),
14

    
15
    // returns snf-network-full
16
    iconCls:  function () {
17
        var item = this.codeName.substring(0, this.codeName.length - 1);
18
        return 'snf-'+item+'-full';
19
    }.property(),
20

    
21
    // returns snf-network-create-full
22
    newIcon:  function () {
23
        var item = this.codeName.substring(0, this.codeName.length - 1);
24
        return 'snf-'+item+'-create-full';
25
    }.property(),
26

    
27
    // returns Create new network
28
    newTxt:  function () {
29
        var item = this.codeName.substring(0, this.codeName.length - 1);
30
        return 'Create new '+item;
31
    }.property(),
32
    
33
    // enables grid/list view in action bar
34
    hasViewCls: true,
35

    
36
    // enables search functionality action bar
37
    hasSearch: true,
38

    
39
    // enables filtering in action bar    
40
    hasFilter: true,
41

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

    
46
    codeNameChildInit: function () {
47
        var item = this.codeName.substring(0, this.codeName.length - 1);
48
        return item+'init';
49
    }.property(),
50
    
51
});
52

    
53

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

    
58

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

    
65

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

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