diff options
Diffstat (limited to 'js')
24 files changed, 343 insertions, 326 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html index ba17449a..1cf01737 100755 --- a/js/components/layout/document-entry.reel/document-entry.html +++ b/js/components/layout/document-entry.reel/document-entry.html | |||
@@ -26,7 +26,6 @@ | |||
26 | <body> | 26 | <body> |
27 | <li id="documentEntry" class="documentEntry"> | 27 | <li id="documentEntry" class="documentEntry"> |
28 | <div id="isActive"></div> | 28 | <div id="isActive"></div> |
29 | <div id="dirtyFlag"></div> | ||
30 | <span id="name"></span> | 29 | <span id="name"></span> |
31 | <img src="js/components/layout/document-entry.reel/close_button.gif"> | 30 | <img src="js/components/layout/document-entry.reel/close_button.gif"> |
32 | </li> | 31 | </li> |
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index a1bed79b..9e4110e2 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js | |||
@@ -77,19 +77,17 @@ exports.DocumentEntry = Montage.create(Component, { | |||
77 | } | 77 | } |
78 | }, | 78 | }, |
79 | 79 | ||
80 | _dirtyFlag:{ | 80 | _saveFlag: { |
81 | enumerable:false, | 81 | value: false |
82 | value:false | ||
83 | }, | 82 | }, |
84 | dirtyFlag:{ | 83 | |
84 | saveFlag: { | ||
85 | get: function() { | 85 | get: function() { |
86 | return this._dirtyFlag; | 86 | return this._saveFlag; |
87 | }, | 87 | }, |
88 | set: function(value) { | 88 | set: function(value) { |
89 | var previousValue = this._dirtyFlag; | 89 | if(this._saveFlag !== value) { |
90 | this._dirtyFlag = value; | 90 | this._saveFlag = value; |
91 | |||
92 | if (previousValue !== this._dirtyFlag) { | ||
93 | this.needsDraw = true; | 91 | this.needsDraw = true; |
94 | } | 92 | } |
95 | } | 93 | } |
@@ -110,10 +108,10 @@ exports.DocumentEntry = Montage.create(Component, { | |||
110 | 108 | ||
111 | this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); | 109 | this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); |
112 | 110 | ||
113 | if(this.dirtyFlag === true){ | 111 | if(this.saveFlag) { |
114 | if(!this.label.classList.contains("dirty")){this.label.classList.add("dirty");} | 112 | this.label.classList.add("dirty"); |
115 | }else{ | 113 | } else { |
116 | if(this.label.classList.contains("dirty")){this.label.classList.remove("dirty");} | 114 | this.label.classList.remove("dirty"); |
117 | } | 115 | } |
118 | } | 116 | } |
119 | }, | 117 | }, |
diff --git a/js/components/layout/documents-tab.reel/documents-tab.html b/js/components/layout/documents-tab.reel/documents-tab.html index 82ba8782..737dfbcb 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.html +++ b/js/components/layout/documents-tab.reel/documents-tab.html | |||
@@ -38,9 +38,9 @@ | |||
38 | "boundObjectPropertyPath": "objectAtCurrentIteration.name", | 38 | "boundObjectPropertyPath": "objectAtCurrentIteration.name", |
39 | "oneway": true | 39 | "oneway": true |
40 | }, | 40 | }, |
41 | "dirtyFlag": { | 41 | "saveFlag": { |
42 | "boundObject": {"@": "repetition1"}, | 42 | "boundObject": {"@": "repetition1"}, |
43 | "boundObjectPropertyPath": "objectAtCurrentIteration.dirtyFlag", | 43 | "boundObjectPropertyPath": "objectAtCurrentIteration.needsSave", |
44 | "oneway": true | 44 | "oneway": true |
45 | }, | 45 | }, |
46 | "active": { | 46 | "active": { |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index c2aa1b6b..7491ef9f 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -66,35 +66,37 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | handleWebRequest: { | ||
70 | value: function (request) { | ||
71 | if (request.url.indexOf('js/document/templates/montage-html') !== -1) { | ||
72 | 69 | ||
73 | //console.log(request); | ||
74 | 70 | ||
75 | //TODO: Figure out why active document is not available here | ||
76 | 71 | ||
77 | if (this._hackRootFlag) { | ||
78 | |||
79 | //console.log(request.url.split('/')[request.url.split('/').length-1]); | ||
80 | //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]); | ||
81 | 72 | ||
73 | //////////////////////////////////////////////////////////////////// | ||
74 | // | ||
75 | handleWebRequest: { | ||
76 | value: function (request) { | ||
77 | if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) { | ||
78 | //TODO: Optimize creating string | ||
82 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; | 79 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; |
83 | } | 80 | } |
84 | } | 81 | } |
85 | } | ||
86 | }, | 82 | }, |
87 | 83 | //////////////////////////////////////////////////////////////////// | |
88 | 84 | // | |
89 | handleAppLoaded: { | 85 | handleAppLoaded: { |
90 | value: function() { | 86 | value: function() { |
91 | // | 87 | //Adding an intercept to resources loaded to ensure user assets load from cloud simulator |
92 | |||
93 | chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); | 88 | chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); |
94 | |||
95 | } | 89 | } |
96 | }, | 90 | }, |
91 | //////////////////////////////////////////////////////////////////// | ||
97 | 92 | ||
93 | |||
94 | |||
95 | |||
96 | |||
97 | |||
98 | |||
99 | |||
98 | handleExecuteFileOpen: { | 100 | handleExecuteFileOpen: { |
99 | value: function(event) { | 101 | value: function(event) { |
100 | var pickerSettings = event._event.settings || {}; | 102 | var pickerSettings = event._event.settings || {}; |
@@ -118,28 +120,21 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
118 | //TODO: Check for appropiate structures | 120 | //TODO: Check for appropiate structures |
119 | handleExecuteSave: { | 121 | handleExecuteSave: { |
120 | value: function(event) { | 122 | value: function(event) { |
123 | if(!!this.activeDocument){ | ||
121 | //Text and HTML document classes should return the same save object for fileSave | 124 | //Text and HTML document classes should return the same save object for fileSave |
122 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); | 125 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); |
123 | } | 126 | } |
127 | } | ||
124 | }, | 128 | }, |
125 | //////////////////////////////////////////////////////////////////// | 129 | //////////////////////////////////////////////////////////////////// |
126 | // | 130 | // |
127 | fileSaveResult: { | 131 | fileSaveResult: { |
128 | value: function (result) { | 132 | value: function (result) { |
129 | if(result.status === 204){ | 133 | if(result.status === 204){ |
130 | this.clearDocumentDirtyFlag(); | 134 | this.activeDocument.needsSave = false; |
131 | } | 135 | } |
132 | } | 136 | } |
133 | }, | 137 | }, |
134 | //////////////////////////////////////////////////////////////////// | ||