mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
configure the form according to last configured values when loading the formular
This commit is contained in:
parent
379815d92b
commit
3b0a070283
@ -49,12 +49,18 @@
|
|||||||
'<Domain>&myip=<Ip>'
|
'<Domain>&myip=<Ip>'
|
||||||
var FREEDNS = 'http://freedns.afraid.org/dynamic/update.php?' +
|
var FREEDNS = 'http://freedns.afraid.org/dynamic/update.php?' +
|
||||||
'_YOURAPIKEYHERE_'
|
'_YOURAPIKEYHERE_'
|
||||||
|
|
||||||
|
//hide javascript warning
|
||||||
$('#dynamicdns-no-js').hide();
|
$('#dynamicdns-no-js').hide();
|
||||||
|
//hide ALL form fields
|
||||||
$('.form-group').hide();
|
$('.form-group').hide();
|
||||||
|
//show the enable checkbox
|
||||||
$('#id_dynamicdns-enabled').closest('.form-group').show();
|
$('#id_dynamicdns-enabled').closest('.form-group').show();
|
||||||
if ($('#id_dynamicdns-enabled').prop('checked')) {
|
if ($('#id_dynamicdns-enabled').prop('checked')) {
|
||||||
|
//show all form fields
|
||||||
show_all();
|
show_all();
|
||||||
|
//set the selectbox to the last configured value
|
||||||
|
select_service();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#id_dynamicdns-enabled').change(function() {
|
$('#id_dynamicdns-enabled').change(function() {
|
||||||
@ -84,6 +90,31 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function select_service()
|
||||||
|
{
|
||||||
|
if ( $("#id_dynamicdns-dynamicdns_server").val().length == 0 ) {
|
||||||
|
$('#id_dynamicdns-dynamicdns_update_url').closest('.form-group').show();
|
||||||
|
$('#id_dynamicdns-disable_SSL_cert_check').closest('.form-group').show();
|
||||||
|
$('#id_dynamicdns-use_http_basic_auth').closest('.form-group').show();
|
||||||
|
$('#id_dynamicdns-dynamicdns_server').closest('.form-group').hide();
|
||||||
|
if($("#id_dynamicdns-dynamicdns_update_url").val() == NOIP){
|
||||||
|
$("#id_dynamicdns-service_type").val(2);
|
||||||
|
}else if($("#id_dynamicdns-dynamicdns_update_url").val() == SELFHOST){
|
||||||
|
$("#id_dynamicdns-service_type").val(3);
|
||||||
|
}else if ($("#id_dynamicdns-dynamicdns_update_url").val() == FREEDNS){
|
||||||
|
$("#id_dynamicdns-service_type").val(4);
|
||||||
|
}else{
|
||||||
|
$("#id_dynamicdns-service_type option:selected").text("other update URL")
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$("#id_dynamicdns-service_type").val(1);
|
||||||
|
$('#id_dynamicdns-dynamicdns_update_url').closest('.form-group').hide();
|
||||||
|
$('#id_dynamicdns-disable_SSL_cert_check').closest('.form-group').hide();
|
||||||
|
$('#id_dynamicdns-use_http_basic_auth').closest('.form-group').hide();
|
||||||
|
$('#id_dynamicdns-dynamicdns_server').closest('.form-group').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function configure_dropdown()
|
function configure_dropdown()
|
||||||
{
|
{
|
||||||
if ($("#id_dynamicdns-service_type option:selected").text() == "GnuDIP") {
|
if ($("#id_dynamicdns-service_type option:selected").text() == "GnuDIP") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user