diff options
author | Valerio Virgillito | 2012-05-10 14:59:22 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-10 14:59:22 -0700 |
commit | 6e3617e56c60894649e3df9c7e4563e99a3f793a (patch) | |
tree | 3fdda43c5f4fc7d83bab9de16f5b02c1155aec20 /js/document/models | |
parent | 254e2f8ee3e915c7dafe445c724b88434fb52f28 (diff) | |
parent | fb7a3aa9ce0d9b99dca79cfb89951b5c51523250 (diff) | |
download | ninja-6e3617e56c60894649e3df9c7e4563e99a3f793a.tar.gz |
Merge pull request #210 from joseeight/Document
Adding partial close functionality
Diffstat (limited to 'js/document/models')
-rwxr-xr-x | js/document/models/base.js | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js index 2bbbe501..ebfb73b8 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js | |||
@@ -62,6 +62,11 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
62 | }, | 62 | }, |
63 | //////////////////////////////////////////////////////////////////// | 63 | //////////////////////////////////////////////////////////////////// |
64 | // | 64 | // |
65 | parentContainer: { | ||
66 | value: null | ||
67 | }, | ||
68 | //////////////////////////////////////////////////////////////////// | ||
69 | // | ||
65 | views: { | 70 | views: { |
66 | value: null | 71 | value: null |
67 | }, | 72 | }, |
@@ -115,6 +120,12 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
115 | save: { | 120 | save: { |
116 | value: function (callback) { | 121 | value: function (callback) { |
117 | // | 122 | // |
123 | if (this.needsSave) { | ||
124 | //Save | ||
125 | } else { | ||
126 | //Ignore command | ||
127 | } | ||
128 | // | ||
118 | if (this.currentView === this.views.design) { | 129 | if (this.currentView === this.views.design) { |
119 | // | 130 | // |
120 | this.application.ninja.ioMediator.fileSave({ | 131 | this.application.ninja.ioMediator.fileSave({ |
@@ -129,18 +140,18 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
129 | } else { | 140 | } else { |
130 | //TODO: Add logic to save code view data | 141 | //TODO: Add logic to save code view data |
131 | } | 142 | } |
132 | // | ||
133 | if (this.needsSave) { | ||
134 | //Save | ||
135 | } else { | ||
136 | //Ignore command | ||
137 | } | ||
138 | } | 143 | } |
139 | }, | 144 | }, |
140 | //////////////////////////////////////////////////////////////////// | 145 | //////////////////////////////////////////////////////////////////// |
141 | // | 146 | // |
142 | saveAll: { | 147 | saveAll: { |
143 | value: function (callback) { | 148 | value: function (callback) { |
149 | // | ||
150 | if (this.needsSave) { | ||
151 | //Save | ||
152 | } else { | ||
153 | //Ignore command | ||
154 | } | ||
144 | // | 155 | // |
145 | if (this.currentView === this.views.design) { | 156 | if (this.currentView === this.views.design) { |
146 | // | 157 | // |
@@ -156,12 +167,7 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
156 | } else { | 167 | } else { |
157 | //TODO: Add logic to save code view data | 168 | //TODO: Add logic to save code view data |
158 | } | 169 | } |
159 | // | 170 | |
160 | if (this.needsSave) { | ||
161 | //Save | ||
162 | } else { | ||
163 | //Ignore command | ||
164 | } | ||
165 | } | 171 | } |
166 | }, | 172 | }, |
167 | //////////////////////////////////////////////////////////////////// | 173 | //////////////////////////////////////////////////////////////////// |
@@ -179,13 +185,24 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
179 | //////////////////////////////////////////////////////////////////// | 185 | //////////////////////////////////////////////////////////////////// |
180 | // | 186 | // |
181 | close: { | 187 | close: { |
182 | value: function () { | 188 | value: function (view, callback) { |
189 | //Outcome of close (pending on save logic) | ||
190 | var success; | ||
183 | // | 191 | // |
184 | if (this.needsSave) { | 192 | if (this.needsSave) { |
185 | //Prompt user to save of lose data | 193 | //Prompt user to save of lose data |
186 | } else { | 194 | } else { |
187 | //Close file | 195 | //Close file |
196 | success = true; | ||
197 | } | ||
198 | // | ||
199 | if (this.views.design && (!view || view === 'design')) { | ||
200 | // | ||
201 | this.parentContainer.removeChild(this.views.design.iframe); | ||
202 | this.views.design = null; | ||
188 | } | 203 | } |
204 | // | ||
205 | if (callback) callback(success); | ||
189 | } | 206 | } |
190 | } | 207 | } |
191 | //////////////////////////////////////////////////////////////////// | 208 | //////////////////////////////////////////////////////////////////// |