Small FormPanel fixes

This commit is contained in:
peteruithoven 2014-02-07 12:35:50 +01:00
parent 1dbbf0c88c
commit c058f40b8b
2 changed files with 6 additions and 4 deletions

View File

@ -17,6 +17,7 @@ module.exports = function(grunt) {
js: { js: {
src: [ src: [
'js/api/*.js', 'js/api/*.js',
'js/settings/FormPanel.js',
'js/settings/*.js', 'js/settings/*.js',
'js/*.js', 'js/*.js',
// make sure we put main.js last // make sure we put main.js last

View File

@ -20,12 +20,14 @@ function FormPanel() {
// make _self the scope of which init was called? // make _self the scope of which init was called?
// needed to have the subclass instance access the same counter // needed to have the subclass instance access the same counter
_self = this; _self = this;
//console.log("FormPanel:init");
_element = panelElement; _element = panelElement;
_configAPI.init(wifiboxURL,wifiboxCGIBinURL); _configAPI.init(wifiboxURL,wifiboxCGIBinURL);
}; };
//this.readForm = function(form) { //this.readForm = function(form) {
FormPanel.prototype.readForm = function(form) { FormPanel.prototype.readForm = function(form) {
//console.log("FormPanel:readForm");
if(!form) form = _element; // if no form specified, read whole panel form if(!form) form = _element; // if no form specified, read whole panel form
//console.log("FormPanel"); //console.log("FormPanel");
var settings = {}; var settings = {};
@ -94,8 +96,7 @@ function FormPanel() {
}); });
}; };
this.saveSettings = function(newSettings,complete) { FormPanel.prototype.saveSettings = function(newSettings,complete) {
//console.log("FormPanel:saveSettings");
//console.log(" newSettings: ",newSettings); //console.log(" newSettings: ",newSettings);
_configAPI.save(newSettings,function(data) { _configAPI.save(newSettings,function(data) {
var validation = data.validation; var validation = data.validation;
@ -112,7 +113,7 @@ function FormPanel() {
settings.substituted_ssid = data.substituted_ssid; settings.substituted_ssid = data.substituted_ssid;
if(complete) complete(validated); if(complete) complete(validated);
}, function() { }, function() {
//console.log("Settings:saveSettings: failed"); console.log("Settings:saveSettings: failed");
clearTimeout(_retrySaveSettingsDelay); clearTimeout(_retrySaveSettingsDelay);
_retrySaveSettingsDelay = setTimeout(function() { _self.saveSettings(newSettings,complete); },_retryDelay); // retry after delay _retrySaveSettingsDelay = setTimeout(function() { _self.saveSettings(newSettings,complete); },_retryDelay); // retry after delay
}); });
@ -128,7 +129,7 @@ function FormPanel() {
_element.find(".error").removeClass("error"); _element.find(".error").removeClass("error");
}; };
this.loadSettings = function(targetSettings,complete) { FormPanel.prototype.loadSettings = function(targetSettings,complete) {
_configAPI.load(targetSettings,complete); _configAPI.load(targetSettings,complete);
}; };
} }