Revision f5321878 snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/vm-wizard.js

b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/vm-wizard.js
12 12
		expand_down: undefined
13 13
	},
14 14

  
15
	set_container_height: function(step) {
16
		if (step === true) {
17
			step =0;
18
		} else {
19
			step = ui.wizard.current_step;
20
		}
21
		var topHeight = $('.top').height();
22
		var stepHeight = $('.step-'+(step+1)+'').height();
23
		var res = topHeight+stepHeight;
24
		console.log('step', step);
25
		if (step == 2) {
26
			$('.wizard-content').removeAttr('style');
27
		} else {
28
			$('.wizard-content').height(res);
29
		}
30
    },
31
    set_container_height_back: function(step) {
32
		if (step === true) {
33
			step =1;
34
		} else {
35
			step = ui.wizard.current_step;
36
		}
37
		var topHeight = $('.top').height();
38
		var stepHeight = $('.step-'+step+'').height();
39
		var res = topHeight+stepHeight;
40
		console.log('step', step);
41
		if (step == 3) {
42
			$('.wizard-content').removeAttr('style');
43
		} else {
44
			$('.wizard-content').height(res);
45
		}
46
    },
47

  
15 48

  
16 49
	// sets the width and height of the carousel and its divs
17 50
	set_dimensions: function() {
......
19 52
		ui.wizard.relocation = $(window).width();
20 53
		console.log(ui.wizard.relocation);
21 54
		$('.vm-wizard-carousel').children('div.step').width(ui.wizard.relocation);
55
		ui.wizard.set_container_height(true);
22 56
	},
23 57

  
24 58
	// sets the width and height of the carousel and its divs when the screen is resized (in PIXELS)
......
98 132

  
99 133
		function go_next() {
100 134
			console.log('you clicked next!')
135
			ui.wizard.set_container_height();
101 136
			if(ui.wizard.current_step < ui.wizard.total_step){
102 137
				ui.wizard.current_step++;
103 138
				ui.wizard.current_position -=ui.wizard.relocation;
......
111 146
				else if(ui.wizard.current_step == 3) {
112 147
					setTimeout(function() { $('.vm-name').find('input').focus() }, speed/2);
113 148
				}
114

  
115 149
			}
116 150
			else {
117 151
				console.log('This is the last step.');
......
121 155

  
122 156
		function go_prev() {
123 157
			if(ui.wizard.current_step > 1){
124
				ui.wizard.current_step--;
158
				--ui.wizard.current_step;
159
				ui.wizard.set_container_height_back();
125 160
				ui.wizard.current_position +=ui.wizard.relocation;
126 161
				$('.vm-wizard-carousel').finish();
127 162
				$('.vm-wizard-carousel').animate({left: ui.wizard.current_position+'px'}, speed);

Also available in: Unified diff