diff options
author | hwc487 | 2012-05-31 17:11:08 -0700 |
---|---|---|
committer | hwc487 | 2012-05-31 17:11:08 -0700 |
commit | 1c445cf5d905f79937998cf2f1115594ea8c1074 (patch) | |
tree | 35271ad7ffec86fde9102af3dd954fa3a2974582 /js/document/models/text.js | |
parent | 335ce503996e3ccbd2909086328d0a31fbd03370 (diff) | |
parent | 6042bdc5f2aada4412912fd01602d32c9088dc26 (diff) | |
download | ninja-1c445cf5d905f79937998cf2f1115594ea8c1074.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
js/io/system/ninjalibrary.json
Diffstat (limited to 'js/document/models/text.js')
-rwxr-xr-x | js/document/models/text.js | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/js/document/models/text.js b/js/document/models/text.js index ebf9993e..d1252b7d 100755 --- a/js/document/models/text.js +++ b/js/document/models/text.js | |||
@@ -7,7 +7,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
7 | //////////////////////////////////////////////////////////////////////// | 7 | //////////////////////////////////////////////////////////////////////// |
8 | // | 8 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var Montage = require("montage/core/core").Montage, |
10 | BaseDocumentModel = require("js/document/models/text").BaseDocumentModel; | 10 | BaseDocumentModel = require("js/document/models/base").BaseDocumentModel; |
11 | //////////////////////////////////////////////////////////////////////// | 11 | //////////////////////////////////////////////////////////////////////// |
12 | // | 12 | // |
13 | exports.TextDocumentModel = Montage.create(BaseDocumentModel, { | 13 | exports.TextDocumentModel = Montage.create(BaseDocumentModel, { |
@@ -16,9 +16,58 @@ exports.TextDocumentModel = Montage.create(BaseDocumentModel, { | |||
16 | hasTemplate: { | 16 | hasTemplate: { |
17 | enumerable: false, | 17 | enumerable: false, |
18 | value: false | 18 | value: false |
19 | } | 19 | }, |
20 | //////////////////////////////////////////////////////////////////// | 20 | //////////////////////////////////////////////////////////////////// |
21 | //////////////////////////////////////////////////////////////////// | 21 | // |
22 | save: { | ||
23 | enumerable: false, | ||
24 | value: function (callback) { | ||
25 | this.application.ninja.documentController.activeDocument.model.views.code.editor.save();//save to textarea | ||
26 | |||
27 | var self = this; | ||
28 | |||
29 | this.application.ninja.ioMediator.fileSave({ | ||
30 | mode: ""+ self.file.extension, | ||
31 | file: self.file, | ||
32 | content:self.views.code.textArea.value | ||
33 | }, this.handleSaved.bind({callback: callback, model: this})); | ||
34 | } | ||
35 | }, | ||
36 | //////////////////////////////////////////////////////////////////// | ||
37 | // | ||
38 | handleSaved: { | ||
39 | value: function (result) { | ||
40 | // | ||
41 | if (result.status === 204) { | ||
42 | this.model.needsSave = false; | ||
43 | } | ||
44 | // | ||
45 | if (this.callback) this.callback(result); | ||
46 | } | ||
47 | }, | ||
48 | //////////////////////////////////////////////////////////////////// | ||
49 | // | ||
50 | close: { | ||
51 | value: function (view, callback) { | ||
52 | //Outcome of close (pending on save logic) | ||
53 | var success; | ||
54 | // | ||
55 | if (this.needsSave) { | ||
56 | //Prompt user to save of lose data | ||
57 | } else { | ||
58 | //Close file | ||
59 | success = true; | ||
60 | } | ||
61 | // | ||
62 | this.parentContainer.removeChild(this.views.code.textViewContainer); | ||
63 | this.application.ninja.stage.showCodeViewBar(false); | ||
64 | this.application.ninja.stage.restoreAllPanels(); | ||
65 | this.views.code = null; | ||
66 | |||
67 | // | ||
68 | return success; | ||
69 | } | ||
70 | } | ||
22 | }); | 71 | }); |
23 | //////////////////////////////////////////////////////////////////////// | 72 | //////////////////////////////////////////////////////////////////////// |
24 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 73 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |