0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-22 13:13:48 +01:00

Improved retain configuration over update ui

This commit is contained in:
peteruithoven 2014-01-02 16:46:36 +01:00
parent d5220225cc
commit ae5950eb08
3 changed files with 17 additions and 10 deletions

View File

@ -45,18 +45,18 @@ function UpdatePanel() {
this.wifiboxURL = wifiboxURL;
this.element = updatePanelElement;
this.noRetainCheckbox = this.element.find("#noRetain");
this.retainCheckbox = this.element.find("#retainConfiguration");
this.btnUpdate = this.element.find("#update");
this.statusDisplay = this.element.find("#updateState");
this.infoDisplay = this.element.find("#updateInfo");
this.noRetainCheckbox.change(this.noRetainChanged);
this.retainCheckbox.change(this.retainChanged);
this.btnUpdate.click(this.update);
this.checkStatus(false);
}
this.noRetainChanged = function(e) {
console.log("UpdatePanel:noRetainChanged");
this.retainChanged = function(e) {
console.log("UpdatePanel:retainChanged");
self.setState(self.state,true);
}
@ -82,10 +82,12 @@ function UpdatePanel() {
this.installUpdate = function() {
console.log("UpdatePanel:installUpdate");
var noRetain = self.noRetainCheckbox.prop('checked');
// should personal sketches and settings be retained over update?
var retain = self.retainCheckbox.prop('checked');
console.log(" retain: ",retain);
self.stopCheckingStatus();
postData = {no_retain:noRetain}
postData = {no_retain:!retain}
$.ajax({
url: self.wifiboxURL + "/update/install",
type: "POST",
@ -175,8 +177,9 @@ function UpdatePanel() {
console.log("UpdatePanel:setState: ",this.state," > ",newState,"(",this.stateText,") (networkMode: ",self.networkMode,") (newestVersion: ",self.newestVersion,") (refresh: ",refresh,")");
this.state = newState;
var noRetain = self.noRetainCheckbox.prop('checked');
console.log(" noRetain", noRetain);
// should personal sketches and settings be retained over update?
var retain = self.retainCheckbox.prop('checked');
console.log(" retain", retain);
// download button
// if there isn't newestVersion data something went wrong,
@ -189,7 +192,7 @@ function UpdatePanel() {
case UpdatePanel.DOWNLOAD_FAILED:
case UpdatePanel.INSTALL_FAILED:
console.log(" self.canUpdate: ",self.canUpdate);
if(self.canUpdate || noRetain) {
if(self.canUpdate || !retain) {
self.btnUpdate.removeAttr("disabled");
} else {
self.btnUpdate.attr("disabled", true);

View File

@ -137,3 +137,7 @@ form dl dt {
font-style: italic;
width: 10em;
}
#updatePanel #retainConfigurationLabel {
display: inline;
float: none;
}

View File

@ -162,7 +162,7 @@
<fieldset id="updatePanel">
<legend>Update</legend>
<label for="noRetain">Remove personal data:</label><input id="noRetain" type="checkbox" name="" value="noRetain">
<input id="retainConfiguration" type="checkbox" name="" value="retainConfiguration" checked="true"> <label for="retainConfiguration" id="retainConfigurationLabel">Preserve personal sketches and settings</label>
<br/><br/>
<input type="button" name="update" value="Update" class="button" id="update"/>
<span id="updateState"></span><br/>