diff options
author | Robert Zorko <robertz@gurucue.com> | 2015-10-16 11:26:32 +0200 |
---|---|---|
committer | Robert Zorko <robertz@gurucue.com> | 2015-10-16 11:26:32 +0200 |
commit | 3fa8787e93ddb751c92412662db578aad841f120 (patch) | |
tree | b611daecfad1853815f1f8355120dfc7bce3445c | |
parent | e5f4844fa6306aab17c15595c2da411d879ffa48 (diff) |
added an error msg ot the settings screen if something goes wrong and moved the redirect to only happen if the update request is successful. Also tested validation - the auto validation works, but the regex might need tweaking
-rw-r--r-- | index.html | 3 | ||||
-rw-r--r-- | js/codeq/settings.js | 6 |
2 files changed, 6 insertions, 3 deletions
@@ -88,7 +88,6 @@ </div> </div> -<!--TODO --> <!-- login screen --> <div class="container" id="screen_login" style="display: none;"> <div class="row"> @@ -416,7 +415,7 @@ <div class="form-group"> <div class="text-right"> <button type="button" class="btn btn-default" id="settings_cancel_btn">Close</button> - <input type="submit" class="btn btn-primary" id="settings_save_btn" value="Save"/> + <input form="settingsForm" type="submit" class="btn btn-primary" id="settings_save_btn" value="Save"/> </div> </div> </form> diff --git a/js/codeq/settings.js b/js/codeq/settings.js index 8207c3f..5b57c49 100644 --- a/js/codeq/settings.js +++ b/js/codeq/settings.js @@ -22,9 +22,13 @@ if (data.code !== 0) { throw new Error('Updating settings failed, code: ' + data.code + ', message: ' + data.message); } + history.back(); + }) + .fail(function(reason){ + codeq.log.error('Settings update failed: ' + reason); + alert('Settings update failed: ' + reason); }) .done(); - history.back(); e.preventDefault(); }); jqSettCancelBtn.on("click",function(){ |