root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / network-wizard.js @ cf508a0b
History | View | Annotate | Download (2.7 kB)
1 |
ui.wizard.network = { |
---|---|
2 |
elemID: undefined, |
3 |
btns: {
|
4 |
cancel: undefined, |
5 |
create: undefined, |
6 |
close: undefined, |
7 |
new_network: undefined |
8 |
}, |
9 |
close: function(bottom_area, main_area, total_area) { |
10 |
$('body').removeClass('with-overlay'); |
11 |
$('.overlay-area').fadeOut(400, function() { |
12 |
$('.overlay-div').hide(); |
13 |
ui.wizard.network.reset('#network-wizard');
|
14 |
}); |
15 |
}, |
16 |
|
17 |
reset: function(area) { |
18 |
$(area).find('input').val(''); |
19 |
$(area).find('.snf-radio-checked').not('.prechecked').toggleClass('snf-radio-checked snf-radio-unchecked'); |
20 |
$(area).find('.snf-radio-unchecked.prechecked').toggleClass('snf-radio-checked snf-radio-unchecked'); |
21 |
$(area).find('.snf-checkbox-checked').not('.prechecked').toggleClass('snf-checkbox-checked snf-checkbox-unchecked'); |
22 |
$(area).find('.snf-checkbox-unchecked.prechecked').toggleClass('snf-checkbox-checked snf-checkbox-unchecked'); |
23 |
$(area).find('li .manual .input').hide(); |
24 |
$(area).find('ul.subnet_options').parent('li').show(); |
25 |
} |
26 |
} |
27 |
|
28 |
|
29 |
$(document).ready(function(){ |
30 |
$('#network-wizard').find('a').click(function(e) { |
31 |
e.preventDefault(); |
32 |
}); |
33 |
ui.wizard.network.elemID = '#network-wizard';
|
34 |
ui.wizard.network.btns.new_network = $(ui.wizard.network.elemID);
|
35 |
ui.wizard.network.btns.close = ui.wizard.network.btns.new_network.find('.close');
|
36 |
ui.wizard.network.btns.cancel = ui.wizard.network.btns.new_network.find('.bottom .nav.prev');
|
37 |
ui.wizard.network.btns.create = ui.wizard.network.btns.new_network.find('.bottom .nav.next');
|
38 |
|
39 |
$('.network_options .check').click(function(e){ |
40 |
e.preventDefault(); |
41 |
$(this).parents('li').siblings().find('ul.subnet_options').parent('li').toggle(); |
42 |
}); |
43 |
|
44 |
$('.network_options .radio_btn').click(function(e){ |
45 |
e.preventDefault(); |
46 |
var state = $(this).find('span'); |
47 |
if(state.hasClass('snf-radio-unchecked')) { |
48 |
ui.checkOneRadioButton(this);
|
49 |
ui.changeRadiobuttonState(this);
|
50 |
|
51 |
if($(this).hasClass('manual')) { |
52 |
$(this).siblings('.input').toggle(); |
53 |
} |
54 |
else {
|
55 |
$(this).closest('li').siblings('.manual').find('.input').hide(); |
56 |
} |
57 |
} |
58 |
|
59 |
}); |
60 |
$(ui.wizard.network.btns.cancel).click(function(e) { |
61 |
ui.wizard.network.close('.bottom', '#network-wizard', '.overlay-area'); |
62 |
}); |
63 |
$(ui.wizard.network.btns.create).click(function(e) { |
64 |
ui.wizard.network.close('.bottom', '#network-wizard', '.overlay-area'); |
65 |
}); |
66 |
$(ui.wizard.network.btns.close).click(function(e) { |
67 |
ui.wizard.network.close('.bottom', '#network-wizard', '.overlay-area'); |
68 |
}); |
69 |
|
70 |
}) |