Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / app / controllers / base.js @ 20e2dbc5

History | View | Annotate | Download (1.6 kB)

1
Snf.ElemsListController = Ember.ArrayController.extend({
2
    
3
    type: '',
4

    
5
    // returns type without an 's', i.e. network
6
    _item: function () {
7
        return this.type.substring(0, this.type.length - 1);
8
    }.property(),
9
    
10
    // returns type without an 's', i.e. network
11
    itemController: function () {
12
        return this.get('_item');
13
    }.property(),
14

    
15
    // returns snf-network-full
16
    iconCls:  function () {
17
        return 'snf-'+this.get('_item')+'-full';
18
    }.property(),
19

    
20
    // allows grid-view/list-view icons in actions-bar
21
    hasViewOptions: true,
22
    
23
    // allows search functionality
24
    hasSearch: true,
25

    
26
    // allows items filtering
27
    hasFilter: true,
28

    
29
    pageTitle: function () {
30
        return this.get('type')+' ('+this.get('viewCls')+')';
31
    }.property(),
32

    
33
    // used for link-to purposes
34
    parent: function () {
35
        return this.type;
36
    }.property(),
37

    
38
    // used for link-to purposes
39
    childInit: function () {
40
        return this.get('_item')+'init';
41
    }.property(),
42

    
43
});
44

    
45
Snf.ElemController = Ember.ObjectController.extend({
46

    
47
    type: 'vm',
48

    
49
    needs: [],
50

    
51
    hasConnect: false,
52

    
53
    // allows grid-view/list-view icons in actions-bar
54
    hasViewOptions: true,
55

    
56
    // allows search functionality
57
    hasSearch: false,
58

    
59
    // allows items filtering
60
    hasFilter: false,
61

    
62
    pageTitle: function (){
63
        return this.get('model').get('name');
64
    }.property(),
65

    
66
    parent: function() {
67
        return this.type+'s';
68
    }.property(),
69

    
70
    childInit: function() {
71
        return this.codeName+'init';
72
    }.property(),
73

    
74
});