Revision d53ad190 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
48 48

  
49 49
		// carousel movement when right or left arrow is pressed
50 50
		$(document).keydown(function(e) {
51
			if(e.keyCode==39) {
51
			if(e.keyCode==39 && ui.wizard.current_step!=ui.wizard.vm.total_step) {
52 52
				go_next();
53 53
				return false;
54 54
			}
55
			else if(e.keyCode==37) {
55
			else if(e.keyCode==37 && ui.wizard.current_step!=1) {
56 56
				go_prev();
57 57
				return false;
58 58
			}
......
71 71
			
72 72
		});
73 73

  
74
		ui.wizard.vm.btns.next.focusout(function(e) {
75
			if(ui.wizard.current_step!=ui.wizard.vm.total_step) {
76
				$(this).removeClass('active');
77
				go_next();
78
			}
79
		
80
		});
81
		
82
		ui.wizard.vm.btns.previous.focusout(function(e) {
83
			if(ui.wizard.current_step!=1) {
84
				$(this).removeClass('active');
85
				go_prev();
86
			}
87
		
88
		});
74 89

  
75 90
		function go_next() {
76 91
			console.log('going next!');
......
82 97
				$('.vm-wizard-carousel').animate({left: ui.wizard.current_position+'px'}, speed);
83 98
				ui.wizard.indicate_step(ui.wizard.current_step);
84 99
				ui.wizard.set_movement_tags(ui.wizard.current_step, ui.wizard.vm.btns.previous, ui.wizard.vm.btns.next);
85

  
86
				if(ui.wizard.current_step == 3) {
100
				if(ui.wizard.current_step == 2) {
101
					$('.sub-menu[data-step=2] li:first').find('a').focus();
102
				}
103
				else if(ui.wizard.current_step == 3) {
87 104
					setTimeout(function() { $('.vm-name').find('input').focus() }, speed/2);
88 105
				}
89 106

  
......
103 120
				ui.wizard.indicate_step(ui.wizard.current_step);
104 121
				ui.wizard.set_movement_tags(ui.wizard.current_step, ui.wizard.vm.btns.previous, ui.wizard.vm.btns.next);
105 122

  
106
				if(ui.wizard.current_step == 3) {
123
				if(ui.wizard.current_step == 2) {
124
					$('.sub-menu[data-step=2] li:first').find('a').focus();
125
				}
126
				else if(ui.wizard.current_step == 3) {
107 127
					setTimeout(function() { $('.vm-name').find('input').focus() }, speed/2);
108 128
				}
109 129
			}
......
122 142
				ui.wizard.reset();
123 143
				ui.wizard.adjust_to_resized_screen();
124 144
				ui.wizard.set_dimensions();
145
				$('.sub-menu[data-step=1] li:first').find('a').focus();
125 146
			})
126
			$('.step-1 .os li:first').find('.btn-col a').focus();
127 147
	},
128 148

  
129 149
	// for the carousel index
......
132 152
		$('.wizard .top .sub-menu[data-step='+step+']').fadeIn();
133 153
		$('.nums').children().removeClass('current');
134 154
		//$('.nums li:nth-child('+ui.wizard.current_step+'').addClass('current');
135
		$('.nums').children().find('a:contains("'+ui.wizard.current_step+'")').parent('li').addClass('current');
155
		$('.nums').children().find('*:contains("'+ui.wizard.current_step+'")').parent('li').addClass('current');
136 156
	},
137 157

  
138 158
	// changes the text of next and previous buttons
......
186 206
	      	ui.expand_arrow(ui.wizard.vm.btns.expand_down);
187 207
	        ui.wizard.vm.btns.expand_down.parents('div.advanced-conf-step').find('.advanced-conf-options').stop().slideToggle();
188 208
	    })
189
	}
209
	},
190 210

  
191 211
}
192 212

  
......
214 234
		e.preventDefault();
215 235
		$('.nav.next').focus();
216 236
		$('.nav.next').addClass('active');
217
	})
237
	});
238

  
239

  
240
	$('.nav.previous').focus(function(e){
241
		$(this).addClass('active');
242
	});
243

  
244
	$('.nav.previous').focusout(function(e){
245
		e.preventDefault();
246
		$(this).addClass('active');
247
		$(this).removeClass('active');
248

  
249
	});
250

  
251

  
252

  
253
	
254

  
218 255
});

Also available in: Unified diff