Skip to content

Commit

Permalink
WiringEditor saved status indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
ericabouaf committed Jul 22, 2009
1 parent 9ce6c9e commit 354419d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 16 deletions.
8 changes: 5 additions & 3 deletions VERSION.txt
Expand Up @@ -7,7 +7,6 @@ not released yet

Current:

* Layer.onChangeEvt (+implementation in WiringEditor for saved state)
* documentation for ajax controller, especially how to do REST

* BUG: jsBox: form values in input fields are overriden !!
Expand All @@ -33,10 +32,13 @@ 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

* WireIt Guide
* Show only one scissor at a time
* WireIt Guide
* InOutContainer

* Layer.onChangeEvt
* Show only one scissor at a time
* Spring Layout (experimental) (+examples)
* Wire mouse events (experimental) (+examples)
* Added drawing method 'bezierArrows' (experimental)
Expand Down
10 changes: 10 additions & 0 deletions css/WireItEditor.css
Expand Up @@ -62,6 +62,16 @@ body {
background:transparent url(../images/icons/help.png) no-repeat scroll 10% 50%;
}

/**
* savedStatus
*/
div.savedStatus {
color:orange;
font-size:27pt;
left:650px;
position:absolute;
top:10px;
}

/**
* LEFT
Expand Down
44 changes: 31 additions & 13 deletions js/WiringEditor.js
Expand Up @@ -124,6 +124,9 @@ WireIt.WiringEditor = function(options) {
// Render buttons
this.renderButtons();

// Saved status
this.renderSavedStatus();

// Properties Form
this.renderPropertiesForm();

Expand Down Expand Up @@ -209,6 +212,10 @@ WireIt.WiringEditor.prototype = {
parentEl: YAHOO.util.Dom.get('propertiesForm'),
fields: this.options.propertiesFields
});

this.propertiesForm.updatedEvt.subscribe(function() {
this.markUnsaved();
}, this, true);
},

/**
Expand Down Expand Up @@ -286,6 +293,15 @@ WireIt.WiringEditor.prototype = {
helpButton.on("click", this.onHelp, this, true);
},

/**
* @method renderSavedStatus
*/
renderSavedStatus: function() {
var top = Dom.get('top');
this.savedStatusEl = WireIt.cn('div', {className: 'savedStatus', title: 'Not saved'}, {display: 'none'}, "*");
top.appendChild(this.savedStatusEl);
},

/**
* save the current module
* @method saveModule
Expand Down Expand Up @@ -315,17 +331,17 @@ WireIt.WiringEditor.prototype = {
*/
saveModuleSuccess: function(o) {

this.alert("Saved !");
this.markSaved();

//console.log(this.tempSavedWiring);
var name = this.tempSavedWiring.name;

this.alert("Saved !");

/*var name = this.tempSavedWiring.name;
if(this.modulesByName.hasOwnProperty(name) ) {
//console.log("already exists !");
}
else {
//console.log("new one !");
}
}*/

},

Expand Down Expand Up @@ -358,7 +374,10 @@ WireIt.WiringEditor.prototype = {
this.preventLayerChangedEvent = true;

this.layer.clear();
this.propertiesForm.clear();

this.propertiesForm.clear(false); // false to tell inputEx to NOT send the updatedEvt

this.markSaved();

this.preventLayerChangedEvent = false;
},
Expand Down Expand Up @@ -547,7 +566,7 @@ WireIt.WiringEditor.prototype = {
// TODO: check if current wiring is saved...
this.layer.clear();

this.propertiesForm.setValue(wiring.properties);
this.propertiesForm.setValue(wiring.properties, false); // the false tells inputEx to NOT fire the updatedEvt

if(lang.isArray(wiring.modules)) {

Expand Down Expand Up @@ -576,8 +595,9 @@ WireIt.WiringEditor.prototype = {
}
}


this.preventLayerChangedEvent = true;
this.markSaved();

this.preventLayerChangedEvent = false;

}
catch(ex) {
Expand Down Expand Up @@ -606,20 +626,18 @@ WireIt.WiringEditor.prototype = {
}, this, true);
},


onLayerChanged: function() {
if(!this.preventLayerChangedEvent) {
//console.log("layer changed !");
this.markUnsaved();
}
},

markSaved: function() {

this.savedStatusEl.style.display = 'none';
},

markUnsaved: function() {

this.savedStatusEl.style.display = '';
},


Expand Down

0 comments on commit 354419d

Please sign in to comment.