Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / app / components / add-new.js @ f4a8c000

History | View | Annotate | Download (980 Bytes)

1
/* Add New Item */
2

    
3
// {{add-new type=controller.type icon=controller.iconCls action="openWizard"}}
4

    
5
Snf.AddNewComponent = Ember.Component.extend({
6
        layoutName: 'elem', // templateName is deprecated for components
7
        addNewBtn: true,
8
        selectable: false,
9
        iconCls: function() {
10
                var baseIcon = this.get('icon');
11
                return        baseIcon.replace('full', 'create-full');
12
        }.property(),
13
        tagName: 'li',
14
        status: 'add-new',
15
        classNameBindings: ['status'],
16
        attributeBindings: ['data-status, data-reveal-id'],
17

    
18
        'data-status': function() {
19
                return this.status;
20
        }.property(),
21
        name: function() {
22
                var msg = 'Create New ';
23
                var btnType = this.get('type');
24
                switch(btnType){
25
                        case 'vms':
26
                                return msg + 'Machine';
27
                        case 'networks':
28
                                return msg + 'Network';
29
                        case 'volumes':
30
                                return msg + 'Volume';
31
                        case 'snapshots':
32
                                return msg + 'Snapshot';
33
                        case 'images':
34
                                return '+ Upload New Image';
35
                }
36
        }.property(),
37
                click: function () {
38
                        this.sendAction('action');
39
                }
40
});