Revision 3b698137

b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember.js
439 439
/* Controllers for Wizards */
440 440

  
441 441
Synnefo.CreateController = Ember.ObjectController.extend({
442
	currentStep: undefined,
442
	currentStep: 1,
443 443

  
444 444
	totalSteps: function() {
445 445
		return this.get('stepsContent').length;
446 446
	}.property(),
447 447

  
448
	init: function() {
449
		this._super();
450
		this.set('currentStep', 1)
451
	},
452 448
	btnLeftLabel: function(){
453
	return (this.get('currentStep') === 1)?'CANCEL':'PREVIOUS';
449
		return (this.get('currentStep') === 1)?'CANCEL':'PREVIOUS';
454 450
	}.property('currentStep'),
455 451

  
456 452
	btnRightLabel: function(){
457
	return (this.get('currentStep') === this.get('totalSteps'))?'CREATE':'NEXT';
453
		return (this.get('currentStep') === this.get('totalSteps'))?'CREATE':'NEXT';
458 454
	}.property('currentStep'),
459 455

  
460 456
	onMove: false,
461 457
	directionMove: undefined,
462

  
458
	init: function() {
459
		this._super();
460
		this.set('currentStep', 1);
461
		this.set('onMove', false);
462
		this.set('directionMove', undefined);
463
	},
463 464
	actions: {
464 465
		moveNext: function() {
466
			console.log('[CreateController moveNext]');
465 467
			if(!this.get('onMove')) {
466
				var step = this.get('currentStep');
467
				if(step=== this.get('totalSteps')) {
468
					this.init();
469
					this.get('target').send('closeWizard');
468
				if(this.get('currentStep') === this.get('totalSteps'))
469
					this.resetClose();
470
				else {
471
					this.set('directionMove', 'next');
472
					this.set('onMove', true);
470 473
				}
471
				this.set('directionMove', 'next');
472
				this.set('onMove', !(this.get('onMove')));
473 474
			}
474 475
		},
475 476
		moveBack: function() {
477
			console.log('[CreateController moveBack]');
476 478
			if(!this.get('onMove')) {
477
				var step = this.get('currentStep');
478
				if(step === 1) {
479
					this.init();
480
					this.get('target').send('closeWizard');
479
				if(this.get('currentStep') === 1)
480
					this.resetClose();
481
				else {
482
					this.set('directionMove', 'prev');
483
					this.set('onMove', true);
481 484
				}
482
				this.set('directionMove', 'prev');
483
				this.set('onMove', !(this.get('onMove')));
484 485
			}
485 486
		},
487
	},
488
	resetClose: function() {
489
		console.log('[CreateController resetClose]');
490
		this.get('target').send('closeWizard');
491
		this.init();
486 492
	}
487 493

  
488 494
});
......
496 502

  
497 503
Ember.View.reopen({
498 504
    didInsertElement: function() {
499
       this.set('elIsInserted', true);
500 505
       this._super();
506
       this.set('elIsInserted', true);
501 507
    },
502 508

  
503 509
    willDestroyElement: function() {
504
       this.set('elIsInserted', false);
505 510
       this._super();
511
       this.set('elIsInserted', false);
506 512
    }
507 513
});
508 514

  
......
693 699
							viewCurrent.set('isCurrent', false);
694 700
							viewToDisplay.set('isCurrent', true);
695 701
							self.get('controller').set('currentStep',viewToDisplay.get('index'));
702
							this.get('controller').set('onMove', false);
696 703
						}, this)
697 704
					});
698 705
				}
699
				this.get('controller').set('onMove', false);
700 706
			}
701 707
		}
702 708
	}.observes('controller.onMove'),
......
753 759
		isCurrent: function(){
754 760
			if(this.get('isFirst')) return true;
755 761
		}.property(),
756
		click: function() {
762
		move: function() {
763
			if(this.get('controller').get('onMove')) {
757 764
			this.get('parentView').removeOtherCurrent(this);
758
			this.set('isCurrent', true)
759
		}
765
			this.set('isCurrent', true);
766
			}
767
		}.observes('controller.onMove')
760 768
	})
761 769
});
762 770

  
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/controllers.js
113 113
/* Controllers for Wizards */
114 114

  
115 115
Synnefo.CreateController = Ember.ObjectController.extend({
116
	currentStep: undefined,
116
	currentStep: 1,
117 117

  
118 118
	totalSteps: function() {
119 119
		return this.get('stepsContent').length;
120 120
	}.property(),
121 121

  
122
	init: function() {
123
		this._super();
124
		this.set('currentStep', 1)
125
	},
126 122
	btnLeftLabel: function(){
127
	return (this.get('currentStep') === 1)?'CANCEL':'PREVIOUS';
123
		return (this.get('currentStep') === 1)?'CANCEL':'PREVIOUS';
128 124
	}.property('currentStep'),
129 125

  
130 126
	btnRightLabel: function(){
131
	return (this.get('currentStep') === this.get('totalSteps'))?'CREATE':'NEXT';
127
		return (this.get('currentStep') === this.get('totalSteps'))?'CREATE':'NEXT';
132 128
	}.property('currentStep'),
133 129

  
134 130
	onMove: false,
135 131
	directionMove: undefined,
136

  
132
	init: function() {
133
		this._super();
134
		this.set('currentStep', 1);
135
		this.set('onMove', false);
136
		this.set('directionMove', undefined);
137
	},
137 138
	actions: {
138 139
		moveNext: function() {
140
			console.log('[CreateController moveNext]');
139 141
			if(!this.get('onMove')) {
140
				var step = this.get('currentStep');
141
				if(step=== this.get('totalSteps')) {
142
					this.init();
143
					this.get('target').send('closeWizard');
142
				if(this.get('currentStep') === this.get('totalSteps'))
143
					this.resetClose();
144
				else {
145
					this.set('directionMove', 'next');
146
					this.set('onMove', true);
144 147
				}
145
				this.set('directionMove', 'next');
146
				this.set('onMove', !(this.get('onMove')));
147 148
			}
148 149
		},
149 150
		moveBack: function() {
151
			console.log('[CreateController moveBack]');
150 152
			if(!this.get('onMove')) {
151
				var step = this.get('currentStep');
152
				if(step === 1) {
153
					this.init();
154
					this.get('target').send('closeWizard');
153
				if(this.get('currentStep') === 1)
154
					this.resetClose();
155
				else {
156
					this.set('directionMove', 'prev');
157
					this.set('onMove', true);
155 158
				}
156
				this.set('directionMove', 'prev');
157
				this.set('onMove', !(this.get('onMove')));
158 159
			}
159 160
		},
161
	},
162
	resetClose: function() {
163
		console.log('[CreateController resetClose]');
164
		this.get('target').send('closeWizard');
165
		this.init();
160 166
	}
161 167

  
162 168
});
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/okeanos-ember/views.js
3 3

  
4 4
Ember.View.reopen({
5 5
    didInsertElement: function() {
6
       this.set('elIsInserted', true);
7 6
       this._super();
7
       this.set('elIsInserted', true);
8 8
    },
9 9

  
10 10
    willDestroyElement: function() {
11
       this.set('elIsInserted', false);
12 11
       this._super();
12
       this.set('elIsInserted', false);
13 13
    }
14 14
});
15 15

  
......
200 200
							viewCurrent.set('isCurrent', false);
201 201
							viewToDisplay.set('isCurrent', true);
202 202
							self.get('controller').set('currentStep',viewToDisplay.get('index'));
203
							this.get('controller').set('onMove', false);
203 204
						}, this)
204 205
					});
205 206
				}
206
				this.get('controller').set('onMove', false);
207 207
			}
208 208
		}
209 209
	}.observes('controller.onMove'),
......
260 260
		isCurrent: function(){
261 261
			if(this.get('isFirst')) return true;
262 262
		}.property(),
263
		click: function() {
263
		move: function() {
264
			if(this.get('controller').get('onMove')) {
264 265
			this.get('parentView').removeOtherCurrent(this);
265
			this.set('isCurrent', true)
266
		}
266
			this.set('isCurrent', true);
267
			}
268
		}.observes('controller.onMove')
267 269
	})
268 270
});
269 271

  
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/templates.js
269 269

  
270 270
  data.buffer.push("<section class=\"overlay-area-custom\">\n	<div id=\"vm-wizard\" class=\"overlay-div wizard\">\n		<div class=\"top\">\n			<div class=\"numbers row\">\n					");
271 271
  data.buffer.push(escapeExpression((helper = helpers['close-1'] || (depth0 && depth0['close-1']),options={hash:{
272
    'action': ("closeWizard")
272
    'action': ("resetClose")
273 273
  },hashTypes:{'action': "STRING"},hashContexts:{'action': depth0},contexts:[],types:[],data:data},helper ? helper.call(depth0, options) : helperMissing.call(depth0, "close-1", options))));
274 274
  data.buffer.push("\n					");
275 275
  data.buffer.push(escapeExpression((helper = helpers.collection || (depth0 && depth0.collection),options={hash:{},hashTypes:{},hashContexts:{},contexts:[depth0],types:["ID"],data:data},helper ? helper.call(depth0, "Synnefo.WizardHeadersView", options) : helperMissing.call(depth0, "collection", "Synnefo.WizardHeadersView", options))));
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/templates/wizard.hbs
2 2
	<div id="vm-wizard" class="overlay-div wizard">
3 3
		<div class="top">
4 4
			<div class="numbers row">
5
					{{close-1 action="closeWizard"}}
5
					{{close-1 action="resetClose"}}
6 6
					{{collection Synnefo.WizardHeadersView}}
7 7
			</div>
8 8
			{{collection Synnefo.WizardSubMenusView}}
b/snf-cyclades-app/synnefo/ui/new_ui/ui/sass/_wizards.scss
147 147
						// background-color: cyan;
148 148
						border: 1px solid white;
149 149
						position: absolute;
150
						top:0;
150
						// top:0;
151 151
						width:100%;
152 152
						display:none;
153 153
						padding:50px 0 50px;
b/snf-cyclades-app/synnefo/ui/new_ui/ui/stylesheets/app.css
9496 9496
.body-wrapper .overlay-area-custom .overlay-div.wizard .middle .step {
9497 9497
  border: 1px solid white;
9498 9498
  position: absolute;
9499
  top: 0;
9500 9499
  width: 100%;
9501 9500
  display: none;
9502 9501
  padding: 50px 0 50px;

Also available in: Unified diff