aboutsummaryrefslogtreecommitdiff
path: root/js/document/views
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-06 14:31:33 -0700
committerValerio Virgillito2012-06-06 14:31:33 -0700
commite14ce28b5c8858af75fbf2003c8f1b854daa7e35 (patch)
treeeaeb781511eafe2b1893db121b464151d6b361f4 /js/document/views
parent9b2aacd1ced60edb9cb604e9983f7c36fd409e0b (diff)
parent98d8cf7fdc1b14a6ac4eaa54f9086a558f3a60cb (diff)
downloadninja-e14ce28b5c8858af75fbf2003c8f1b854daa7e35.tar.gz
Merge pull request #277 from joseeight/Document
Fixing referencing, also clean up
Diffstat (limited to 'js/document/views')
-rwxr-xr-xjs/document/views/design.js54
1 files changed, 37 insertions, 17 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js
index f7fbf3c5..5af24546 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -28,11 +28,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
28 }, 28 },
29 //////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////
30 // 30 //
31 _document: {
32 value: null
33 },
34 ////////////////////////////////////////////////////////////////////
35 //
36 _bodyFragment: { 31 _bodyFragment: {
37 value: null 32 value: null
38 }, 33 },
@@ -52,8 +47,29 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
52 value: null 47 value: null
53 }, 48 },
54 //////////////////////////////////////////////////////////////////// 49 ////////////////////////////////////////////////////////////////////
55 //TODO: Remove usage 50 //
56 model: { 51 _liveNodeList: {
52 value: null
53 },
54 ////////////////////////////////////////////////////////////////////
55 //
56 _webGlHelper: {
57 value: null
58 },
59 ////////////////////////////////////////////////////////////////////
60 //
61 _baseHref: {
62 value: null
63 },
64 ////////////////////////////////////////////////////////////////////
65 //
66 baseHref: {
67 get: function() {return this._baseHref;},
68 set: function(value) {this._baseHref = value;}
69 },
70 ////////////////////////////////////////////////////////////////////
71 //
72 _document: {
57 value: null 73 value: null
58 }, 74 },
59 //////////////////////////////////////////////////////////////////// 75 ////////////////////////////////////////////////////////////////////
@@ -63,11 +79,17 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
63 set: function(value) {this._document = value;} 79 set: function(value) {this._document = value;}
64 }, 80 },
65 //////////////////////////////////////////////////////////////////// 81 ////////////////////////////////////////////////////////////////////
66 // 82 //
67 _liveNodeList: { 83 _documentRoot: {
68 value: null 84 value: null
69 }, 85 },
70 //////////////////////////////////////////////////////////////////// 86 ////////////////////////////////////////////////////////////////////
87 //
88 documentRoot: {
89 get: function() {return this._documentRoot;},
90 set: function(value) {this._documentRoot = value;}
91 },
92 ////////////////////////////////////////////////////////////////////
71 // 93 //
72 getLiveNodeList: { 94 getLiveNodeList: {
73 value: function(useFilter) { 95 value: function(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 }