Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / app / controllers / base.js @ 5e56bcff

History | View | Annotate | Download (1.5 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

    
48

    
49
    hasConnect: false,
50

    
51
    // allows grid-view/list-view icons in actions-bar
52
    hasViewOptions: true,
53

    
54
    // allows search functionality
55
    hasSearch: false,
56

    
57
    // allows items filtering
58
    hasFilter: false,
59

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

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

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

    
72
});