Revision 1933ffd6 snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/ember-all.js

b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/ember-all.js
42 42

  
43 43
Synnefo.CreateRoute = Ember.Route.extend({
44 44
	model: function(){
45
		return {name: 'vm-wizard'}
45
		return [{name: 'vm-wizard'}]
46 46
	},
47 47
	renderTemplate: function(controller) {
48 48
		this.render('wizard',{controller: controller});
49
	},
50
/*	beforeModel: function() {
51
		this._super();
52
		console.log('beforeModel ',this.get('router.url'))
53
		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)
54
	},
55
	previousRoute: undefined,*/
56
	actions: {
57
		closeWizard: function() {
58
			history.back();
59
		}
49 60
	}
50 61
});
51 62

  
......
69 80
	modelName: 'userImage'
70 81
});
71 82

  
72
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({});
83
Synnefo.VmsCreateRoute = Synnefo.CreateRoute.extend({
84
	model: function() {
85
		return Synnefo.conf.wizards.findBy('name', 'vm-wizard').data;
86
	}
87
});
73 88

  
74 89
Synnefo.NetworksCreateRoute = Synnefo.CreateRoute.extend({});
75 90

  
......
113 128
		return	Synnefo.conf.sectors.findBy('destination', this.get('type')).icon.replace('outline', 'full');
114 129
	}.property(),
115 130
	hasOS: function(){
116
			if(Synnefo.get('currentPath') == "vms")
131
			console.log('hasOS ', Synnefo.get('currentPath'))
132
			if(Synnefo.get('currentPath') === "vms" || Synnefo.get('currentPath') === "vms.index")
117 133
				return true;
118 134
			else return false;
119 135
	}.property(),
120 136
		hasTags: function(){
121
			if(Synnefo.get('currentPath') == "vms")
137
			if(Synnefo.get('currentPath') == "vms" || Synnefo.get('currentPath') === "vms.index")
122 138
				return true;
123 139
			else return false;
124 140
	}.property(),
......
147 163
});
148 164

  
149 165

  
166
Synnefo.VmsCreateController = Ember.ObjectController.extend({});
150 167

  
151 168
Synnefo.ElemController = Ember.ObjectController.extend({
152 169
	needs: [],
......
192 209
});
193 210

  
194 211

  
212
Synnefo.CreateController = Ember.ArrayController.extend({
213
	actions: {
214
		moveNext: function() {
215
			console.log('move to next step');
216
		}
217
	}
218
});
219

  
220
Synnefo.VmsCreateController =Synnefo.CreateController.extend({
221

  
222
});
223

  
224

  
195 225
/* Views */
196 226

  
227
Synnefo.ApplicationView = Ember.View.extend({
228
	classNames: ['content']
229
})
230

  
197 231
Synnefo.NavIconView = Ember.View.extend({
198 232
	tagName: 'span',
199
	click: function(e) {
233
	click: function() {
200 234
		var parentEl = this.$().parent('a');
201 235
		var currentEl = this.$().parents('li').siblings('li').find('a.current');
202 236

  
......
217 251
});
218 252

  
219 253

  
254
Synnefo.WizardHeadersView = Ember.CollectionView.extend({
255
	tagName: 'ul',
256
	classNames:['nums'],
257
	content: Synnefo.conf.wizards.findBy('name', 'vm-wizard').data[0].stepsHeadlines,
258
	counter: 0,
259
	itemViewClass: Ember.View.extend({
260
		templateName: 'wizardStepHeader',
261
		classNameBindings: ['isCurrent:current', 'isFirst:preselected'],
262
		index: undefined,
263
		isCurrent: false,
264
		isFirst: false,
265
		init: function() {
266
			this._super();
267
			console.log('init');
268
			var prevIndex = this.get('parentView').get('counter');
269
			prevIndex++;
270
			console.log('prevIndex', prevIndex)
271
			this.get('parentView').set('counter', prevIndex);
272
			this.set('index', prevIndex);
273
			if(prevIndex === 1) {
274
				this.set('isFirst', true);
275
				this.set('isCurrent', true);
276
			}
277
			console.log('current', this.isCurrent)
278
		},
279
		didInsertElement: function() {
280
		}
281
	}),
282
});
283

  
284

  
220 285
Synnefo.ElemView = Ember.View.extend({
221 286
	// templateName: 'elem',
222 287
	addNewBtn: false,
......
268 333
	tagName: 'a',
269 334
	click: function() {
270 335
		this.sendAction("action", this.get('param'));
336
	},
337
	content: undefined // will be set if we want to print a message inside the span
338
});
339

  
340
Synnefo.BtnsSpanComponent = Ember.Component.extend({
341
	tagName: 'a',
342
	templateName: 'components/btns-span',
343
	click: function() {
344
		this.sendAction("action");
271 345
	}
346
})
347

  
348
Synnefo.Close1Component = Synnefo.BtnsSpanComponent.extend({
349
	classNames: ['close'],
350
});
351

  
352
//  there's another close to modals
353

  
354
Synnefo.Cancel1Component = Synnefo.BtnsSpanComponent.extend({
355
	classNames: ['nav', 'prev'],
356
	// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step
357
	content: 'CANCEL'
358
});
359

  
360
Synnefo.Next1Component = Synnefo.BtnsSpanComponent.extend({
361
	classNames: ['nav', 'next'],
362
	// classNameBindings: ['el3'], the element that should be focused when the user goes to the next step
363
	content: 'NEXT'
272 364
});
273 365

  
274 366
Synnefo.AddNewComponent = Ember.Component.extend({

Also available in: Unified diff