diff options
author | Jose Antonio Marquez | 2012-06-06 13:46:02 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-06 13:46:02 -0700 |
commit | 6a0f150f49be656e0725bc77b452a3141dddd47c (patch) | |
tree | 4d9d946c73c138ce5d6bca04872d7fe9385f4093 /js/document/views | |
parent | 18e212dca48066d1ddaca96875a3f40adcc859b6 (diff) | |
download | ninja-6a0f150f49be656e0725bc77b452a3141dddd47c.tar.gz |
Cleaning up
Removed reference of model in design view, clean up slightly, need to implement binding later.
Diffstat (limited to 'js/document/views')
-rwxr-xr-x | js/document/views/design.js | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js index f7fbf3c5..53590944 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -52,11 +52,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
52 | value: null | 52 | value: null |
53 | }, | 53 | }, |
54 | //////////////////////////////////////////////////////////////////// | 54 | //////////////////////////////////////////////////////////////////// |
55 | //TODO: Remove usage | ||
56 | model: { | ||
57 | value: null | ||
58 | }, | ||
59 | //////////////////////////////////////////////////////////////////// | ||
60 | // | 55 | // |
61 | document: { | 56 | document: { |
62 | get: function() {return this._document;}, | 57 | get: function() {return this._document;}, |
@@ -69,6 +64,33 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
69 | }, | 64 | }, |
70 | //////////////////////////////////////////////////////////////////// | 65 | //////////////////////////////////////////////////////////////////// |
71 | // | 66 | // |
67 | _baseHref: { | ||
68 | value: null | ||
69 | }, | ||
70 | //////////////////////////////////////////////////////////////////// | ||
71 | // | ||
72 | baseHref: { | ||
73 | get: function() {return this._baseHref;}, | ||
74 | set: function(value) {this._baseHref = value;} | ||
75 | }, | ||
76 | //////////////////////////////////////////////////////////////////// | ||
77 | // | ||
78 | _documentRoot: { | ||
79 | value: null | ||
80 | }, | ||
81 | //////////////////////////////////////////////////////////////////// | ||
82 | // | ||
83 | documentRoot: { | ||
84 | get: function() {return this._documentRoot;}, | ||
85 | set: function(value) {this._documentRoot = value;} | ||
86 | }, | ||
87 | //////////////////////////////////////////////////////////////////// | ||
88 | // | ||
89 | _webGlHelper: { | ||
90 | value: null | ||
91 | }, | ||
92 | //////////////////////////////////////////////////////////////////// | ||
93 | // | ||
72 | getLiveNodeList: { | 94 | getLiveNodeList: { |
73 | value: function(useFilter) { | 95 | value: function(useFilter) { |
74 | if(useFilter) { | 96 | if(useFilter) { |
@@ -142,7 +164,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
142 | if (basetag.length) { | 164 | if (basetag.length) { |
143 | if (basetag[basetag.length-1].getAttribute && basetag[basetag.length-1].getAttribute('href')) { | 165 | if (basetag[basetag.length-1].getAttribute && basetag[basetag.length-1].getAttribute('href')) { |
144 | //Setting base HREF in model | 166 | //Setting base HREF in model |
145 | this.model.baseHref = basetag[basetag.length-1].getAttribute('href'); | 167 | this.baseHref = basetag[basetag.length-1].getAttribute('href'); |
146 | } | 168 | } |
147 | } | 169 | } |
148 | //Checking to content to be template | 170 | //Checking to content to be template |
@@ -275,12 +297,12 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
275 | } | 297 | } |
276 | //TODO: Verify appropiate location for this operation | 298 | //TODO: Verify appropiate location for this operation |
277 | if (this._template && this._template.type === 'banner') { | 299 | if (this._template && this._template.type === 'banner') { |
278 | this.model.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; | 300 | this.documentRoot = this.document.body.getElementsByTagName('ninja-content')[0]; |
279 | } else { | 301 | } else { |
280 | this.model.documentRoot = this.document.body; | 302 | this.documentRoot = this.document.body; |
281 | } | 303 | } |
282 | //Storing node list for reference (might need to store in the model) | 304 | //Storing node list for reference (might need to store in the model) |
283 | this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); | 305 | this._liveNodeList = this.documentRoot.getElementsByTagName('*'); |
284 | //Getting list of original nodes | 306 | //Getting list of original nodes |
285 | orgNodes = this.document.getElementsByTagName('*'); | 307 | orgNodes = this.document.getElementsByTagName('*'); |
286 | //TODO: Figure out if this is ideal for identifying nodes created by Ninja | 308 | //TODO: Figure out if this is ideal for identifying nodes created by Ninja |
@@ -288,7 +310,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
288 | if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true'); | 310 | if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true'); |
289 | } | 311 | } |
290 | //Initiliazing document model | 312 | //Initiliazing document model |
291 | document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); | 313 | document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); |
292 | //Makign callback if specified | 314 | //Makign callback if specified |
293 | if (this._callback) this._callback(); | 315 | if (this._callback) this._callback(); |
294 | } | 316 | } |
@@ -358,8 +380,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
358 | value: function (scripttags) { | 380 | value: function (scripttags) { |
359 | // | 381 | // |
360 | var n, webgldata, fileRead; | 382 | var n, webgldata, fileRead; |
361 | //Setting the iFrame property for reference in helper class | ||
362 | this.model.webGlHelper.iframe = this.model.views.design.iframe; | ||
363 | //Checking for webGL Data | 383 | //Checking for webGL Data |
364 | for (var w in scripttags) { | 384 | for (var w in scripttags) { |
365 | // | 385 | // |
@@ -385,7 +405,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
385 | webgldata.data[n] = unescape(webgldata.data[n]); | 405 | webgldata.data[n] = unescape(webgldata.data[n]); |
386 | } | 406 | } |
387 | //TODO: Improve setter of webGL and reference | 407 | //TODO: Improve setter of webGL and reference |
388 | this.model.webGlHelper.glData = webgldata.data; | 408 | this._webGlHelper.glData = webgldata.data; |
389 | } | 409 | } |
390 | } | 410 | } |
391 | } | 411 | } |