Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / okeanos-ember / routers.js @ 1933ffd6

History | View | Annotate | Download (2.3 kB)

1
/* Mapping */
2

    
3
Synnefo.Router.map(function() {
4
// I defined the above resource to extend its Route
5
this.resource('sections', {'path':'/'});
6
for(var i=0; i<Synnefo.conf.sectors.length; i++)
7
        this.resource(Synnefo.conf.sectors[i].destination, function() {
8
                // this.route('grid');
9
                // this.route('list');
10
                this.route('create');
11
        });
12
});
13

    
14

    
15
/* Routes */
16

    
17
Synnefo.ApplicationRoute = Ember.Route.extend({
18
        model: function() {
19
                return {email: 'athina@mail.com'};
20
        },
21
        redirect: function() {
22
                //  have to set vm navigation icon full
23
                this.transitionTo('vms');
24
        },
25
});
26

    
27

    
28
/* Items Routes */
29

    
30
Synnefo.SectionsRoute = Ember.Route.extend({
31
        modelName: undefined,
32
        model: function() {
33
                return this.store.find(this.modelName);
34
        },
35
        renderTemplate: function(controller) {
36
                this.render('snfElems', {controller: controller});
37
        },
38
        actions: {
39
                openWizard: function() {
40
                        var wizardType = this.routeName;
41
                        this.transitionTo(wizardType+'.create')
42
                }
43
        }
44
});
45

    
46

    
47
Synnefo.VmsRoute = Synnefo.SectionsRoute.extend({
48
        modelName: 'vm'
49
});
50

    
51
Synnefo.NetworksRoute = Synnefo.SectionsRoute.extend({
52
        modelName: 'network'
53
});
54

    
55
Synnefo.VolumesRoute = Synnefo.SectionsRoute.extend({
56
        modelName: 'volume'
57
});
58

    
59
Synnefo.SnapshotsRoute = Synnefo.SectionsRoute.extend({
60
        modelName: 'snapshot'
61
});
62

    
63
Synnefo.ImagesRoute = Synnefo.SectionsRoute.extend({
64
        modelName: 'userImage'
65
});
66

    
67

    
68
/* Wizards Routes */
69

    
70
Synnefo.CreateRoute = Ember.Route.extend({
71
        model: function(){
72
                return [{name: 'vm-wizard'}]
73
        },
74
        renderTemplate: function(controller) {
75
                this.render('wizard',{controller: controller});
76
        },
77
/*        beforeModel: function() {
78
                this._super();
79
                console.log('beforeModel ',this.get('router.url'))
80
                this.previousRoute = this.get('router.url'); // should return the current path but some times it returns the path where the user was before (when i dont type the url of the wizard)
81
        },
82
        previousRoute: undefined,*/
83
        actions: {
84
                closeWizard: function() {
85
                        history.back();
86
                }
87
        }
88
});
89

    
90
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({
91
        model: function() {
92
                return Synnefo.wizards.vmWizard;
93
        }
94
});
95

    
96
Synnefo.NetworksCreateRoute = Synnefo.CreateRoute.extend();
97

    
98
Synnefo.VolumesCreateRoute = Synnefo.CreateRoute.extend();
99

    
100
Synnefo.SnapshotsCreateRoute = Synnefo.CreateRoute.extend();
101

    
102
Synnefo.ImagesCreateRoute = Synnefo.CreateRoute.extend({});