Skip to content

Commit

Permalink
WiringEditor: Adding confirmation before trashing unsaved work
Browse files Browse the repository at this point in the history
  • Loading branch information
ericabouaf committed Jul 23, 2009
1 parent 354419d commit 60adb4a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 1 addition & 3 deletions VERSION.txt
Expand Up @@ -6,8 +6,6 @@ Version 0.5.0
not released yet

Current:

* documentation for ajax controller, especially how to do REST

* BUG: jsBox: form values in input fields are overriden !!
* BUG: jsBox should be broken (because of autoload)
Expand All @@ -32,7 +30,7 @@ Changeset:
* Gears (if no backend usable)
* Ajax adapter - configurable XHR calls. Can be configured to do REST or something else...
* propertiesFields default value (becomes optional)
* saved status indicator
* saved status indicator + confirmation

* WireIt Guide
* InOutContainer
Expand Down
16 changes: 16 additions & 0 deletions js/WiringEditor.js
Expand Up @@ -371,6 +371,13 @@ WireIt.WiringEditor.prototype = {
* @method onNew
*/
onNew: function() {

if(!this.isSaved()) {
if( !confirm("Warning: Your work is not saved yet ! Press ok to continue anyway.") ) {
return;
}
}

this.preventLayerChangedEvent = true;

this.layer.clear();
Expand Down Expand Up @@ -550,6 +557,12 @@ WireIt.WiringEditor.prototype = {
*/
loadPipe: function(name) {

if(!this.isSaved()) {
if( !confirm("Warning: Your work is not saved yet ! Press ok to continue anyway.") ) {
return;
}
}

try {

this.preventLayerChangedEvent = true;
Expand Down Expand Up @@ -640,6 +653,9 @@ WireIt.WiringEditor.prototype = {
this.savedStatusEl.style.display = '';
},

isSaved: function() {
return (this.savedStatusEl.style.display == 'none');
},

/**
* This method return a wiring within the given vocabulary described by the modules list
Expand Down

0 comments on commit 60adb4a

Please sign in to comment.