Revision 8b3ba816

b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/vm-wizard.js
33 33
	
34 34

  
35 35
	move_to_step: function(prev_btn, next_btn) {
36
		var speed =500;
36 37
		// when the button "next" is pressed show the next step (if there is a next step)
37 38
		next_btn.click(function(){
38 39
			event.preventDefault();
......
41 42
				prev_btn.find('span').html('PREVIOUS');
42 43
				ui.wizard.current_step++;
43 44
				ui.wizard.current_position -=ui.wizard.relocation;
44
				$('.vm-wizard-carousel').animate({left: ui.wizard.current_position+'px'}, 500);
45
				$('.vm-wizard-carousel').animate({left: ui.wizard.current_position+'px'}, speed);
45 46
				ui.wizard.indicate_step(ui.wizard.current_step);
47
				ui.wizard.set_movement_tags(ui.wizard.current_step, prev_btn, next_btn);
48

  
49
				if(ui.wizard.current_step == 3) {
50
					setTimeout(function() { $('.vm-name').find('input').focus() }, speed/2);
51
				}
52

  
46 53
			}
47 54
			else {
48 55
				console.log('This is the last step.');
......
55 62
			if(ui.wizard.current_step > 1){
56 63
				ui.wizard.current_step--;
57 64
				ui.wizard.current_position +=ui.wizard.relocation;
58
				$('.vm-wizard-carousel').animate({left: ui.wizard.current_position+'px'}, 500);
65
				$('.vm-wizard-carousel').animate({left: ui.wizard.current_position+'px'}, speed);
59 66
				ui.wizard.indicate_step(ui.wizard.current_step);
67
				ui.wizard.set_movement_tags(ui.wizard.current_step, prev_btn, next_btn);
60 68
			}
61 69
			else {
62 70
				console.log('This is the 1st step.')
......
79 87
		$('.wizard .top .sub-menu[data-step='+step+']').fadeIn();
80 88
		$('.nums').children().removeClass('current');
81 89
		$('.nums').children().find('a:contains("'+ui.wizard.current_step+'")').parent('li').addClass('current');
90
	},
91

  
92

  
93
	set_movement_tags: function(step, left_btn, right_btn) {
94
		if (step==1) {
95
			left_btn.find('span').html('CANCEL');
96
		}
97
		else if(step==ui.wizard.vm.total_step) {
98
			right_btn.find('span').html('CREATE');
99
		}
100
		else {
101
			left_btn.find('span').html('PREVIOUS');
102
			right_btn.find('span').html('NEXT');
103
		}
82 104
	}
83 105
}
84 106

  
......
97 119

  
98 120
	ui.wizard.initialize_relocation(new_vm_btn);
99 121
	ui.wizard.move_to_step(prev_btn, next_btn);
122
	ui.wizard.set_movement_tags(ui.wizard.current_step, prev_btn, next_btn);
123

  
100 124

  
101 125
});

Also available in: Unified diff