mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
Place page specific js after jquery so that jquery can be used
This commit is contained in:
parent
e49aa3df43
commit
288e4bb6ca
@ -88,19 +88,19 @@ class wan(FormPlugin, PagePlugin):
|
||||
url = ["/router/setup"]
|
||||
order = 10
|
||||
|
||||
js = """<script type="text/javascript">
|
||||
<!--
|
||||
function hideshow_static() {
|
||||
var d = document.getElementById('connect_type');
|
||||
connect_type = d.value;
|
||||
if (connect_type != 'Static IP') {
|
||||
hide("static_ip_form");
|
||||
} else {
|
||||
show("static_ip_form");
|
||||
js = """
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
function hideshow_static() {
|
||||
var show_or_hide = ($('#connect_type').val() == 'Static IP')
|
||||
$('#static_ip_form').toggle(show_or_hide);
|
||||
}
|
||||
}
|
||||
// -->
|
||||
</script>"""
|
||||
$(document).ready(function() {
|
||||
$('#connect_type').change(hideshow_static);
|
||||
hideshow_static();
|
||||
});
|
||||
})(jQuery);
|
||||
</script>"""
|
||||
|
||||
def sidebar_right(self, *args, **kwargs):
|
||||
side=''
|
||||
@ -141,7 +141,7 @@ class wan(FormPlugin, PagePlugin):
|
||||
action=cfg.server_dir + "/router/setup/wan/index",
|
||||
name="wan_connection_form",
|
||||
message=message)
|
||||
form.dropdown('Connection Type', vals=["DHCP", "Static IP"], id="connect_type", onchange="hideshow_static()")
|
||||
form.dropdown('Connection Type', vals=["DHCP", "Static IP"], id="connect_type")
|
||||
form.html('<div id="static_ip_form">')
|
||||
form.dotted_quad("WAN IP Address", name="wan_ip", quad=[wan_ip0, wan_ip1, wan_ip2, wan_ip3])
|
||||
form.dotted_quad("Subnet Mask", name="subnet", quad=[subnet0, subnet1, subnet2, subnet3])
|
||||
@ -150,11 +150,6 @@ class wan(FormPlugin, PagePlugin):
|
||||
form.dotted_quad("Static DNS 2", name="dns2", quad=[dns20, dns21, dns22, dns23])
|
||||
form.dotted_quad("Static DNS 3", name="dns3", quad=[dns30, dns31, dns32, dns33])
|
||||
form.html('</div>')
|
||||
form.html(""" <script type="text/javascript">
|
||||
<!--
|
||||
hideshow_static();
|
||||
// -->
|
||||
</script>""")
|
||||
form.submit("Set Wan")
|
||||
return form.render()
|
||||
|
||||
|
||||
@ -96,7 +96,6 @@
|
||||
<!-- JS from previous Plinth template, not sure what to keep yet -->
|
||||
<script type="text/javascript" src="$basehref/static/theme/js/menu.js"></script>
|
||||
<script type="text/javascript" src="$basehref/static/theme/js/plinth.js"></script>
|
||||
$js
|
||||
$main_menu_js
|
||||
$sub_menu_js
|
||||
<script type="text/javascript">
|
||||
@ -199,5 +198,6 @@
|
||||
<!--<script type="text/javascript" src="$basehref/static/theme/js/libs/bootstrap/typeahead.js"></script>-->
|
||||
<!-- JS plugins -->
|
||||
<script type="text/javascript" src="$basehref/static/theme/js/plugins.js"></script>
|
||||
$js
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user