From 272c5f74f4ce76fec9cbe360817bf23639307d3a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Sun, 5 Feb 2012 19:20:37 -0800 Subject: changes to show document dirty indicator on editing code view, and to remove dirty indicator on save. Signed-off-by: Ananya Sen --- .../layout/document-entry.reel/document-entry.css | 1 + .../layout/document-entry.reel/document-entry.js | 23 ++++++++++++++++++++++ .../layout/documents-tab.reel/documents-tab.html | 5 +++++ 3 files changed, 29 insertions(+) (limited to 'js/components') diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index ce173cd6..52d08d72 100755 --- a/js/components/layout/document-entry.reel/document-entry.css +++ b/js/components/layout/document-entry.reel/document-entry.css @@ -35,4 +35,5 @@ .documentEntry span.dirty:before{ content: "*"; + display:inline; } diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 2a33548a..a1bed79b 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -77,6 +77,23 @@ exports.DocumentEntry = Montage.create(Component, { } }, + _dirtyFlag:{ + enumerable:false, + value:false + }, + dirtyFlag:{ + get: function() { + return this._dirtyFlag; + }, + set: function(value) { + var previousValue = this._dirtyFlag; + this._dirtyFlag = value; + + if (previousValue !== this._dirtyFlag) { + this.needsDraw = true; + } + } + }, prepareForDraw: { enumerable: false, @@ -92,6 +109,12 @@ exports.DocumentEntry = Montage.create(Component, { this.label.innerText = this._name ? this._name : ""; this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); + + if(this.dirtyFlag === true){ + if(!this.label.classList.contains("dirty")){this.label.classList.add("dirty");} + }else{ + if(this.label.classList.contains("dirty")){this.label.classList.remove("dirty");} + } } }, diff --git a/js/components/layout/documents-tab.reel/documents-tab.html b/js/components/layout/documents-tab.reel/documents-tab.html index 94b2e46e..82ba8782 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.html +++ b/js/components/layout/documents-tab.reel/documents-tab.html @@ -38,6 +38,11 @@ "boundObjectPropertyPath": "objectAtCurrentIteration.name", "oneway": true }, + "dirtyFlag": { + "boundObject": {"@": "repetition1"}, + "boundObjectPropertyPath": "objectAtCurrentIteration.dirtyFlag", + "oneway": true + }, "active": { "boundObject": {"@": "repetition1"}, "boundObjectPropertyPath": "objectAtCurrentIteration.isActive", -- cgit v1.2.3