aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorJose Antonio Marquez Russo2012-07-23 19:07:11 -0700
committerJose Antonio Marquez Russo2012-07-23 19:07:11 -0700
commit5946ec8651547f846520add097850470a09df635 (patch)
tree0278eeb16b60df94c35d1374796f92204b7be4ed /js/document
parent9c74db91b9f0c755eb8e8c36d5270b7db90c8ff7 (diff)
downloadninja-5946ec8651547f846520add097850470a09df635.tar.gz
In Progress: Cleaning up merge
Cleaned up new updates. Still pending is adding functionality to parse the document when toggling views and fix Timeline errors. Code view also has some rending issues that will be fixed, this is just a clean up.
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 76157a07..569b6d8b 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -35,7 +35,7 @@ var Montage = require("montage/core/core").Montage,
35 Component = require("montage/ui/component").Component, 35 Component = require("montage/ui/component").Component,
36 HtmlDocumentModel = require("js/document/models/html").HtmlDocumentModel, 36 HtmlDocumentModel = require("js/document/models/html").HtmlDocumentModel,
37 DesignDocumentView = require("js/document/views/design").DesignDocumentView, 37 DesignDocumentView = require("js/document/views/design").DesignDocumentView,
38 DesignCodeView = require("js/document/views/design-code").DesignCodeView; 38 CodeDocumentView = require("js/document/views/design-code").DesignCodeView;
39//////////////////////////////////////////////////////////////////////// 39////////////////////////////////////////////////////////////////////////
40// 40//
41exports.HtmlDocument = Montage.create(Component, { 41exports.HtmlDocument = Montage.create(Component, {
@@ -78,7 +78,6 @@ exports.HtmlDocument = Montage.create(Component, {
78 // 78 //
79 init: { 79 init: {
80 value: function(file, context, callback, view, template) { 80 value: function(file, context, callback, view, template) {
81 var designCodeView = DesignCodeView.create();
82 //Storing callback data for loaded dispatch 81 //Storing callback data for loaded dispatch
83 this.loaded.callback = callback; 82 this.loaded.callback = callback;
84 this.loaded.context = context; 83 this.loaded.context = context;
@@ -87,7 +86,7 @@ exports.HtmlDocument = Montage.create(Component, {
87 file: {value: file}, 86 file: {value: file},
88 fileTemplate: {value: template}, 87 fileTemplate: {value: template},
89 parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach 88 parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach
90 views: {value: {'design': DesignDocumentView.create(), 'code': designCodeView}} //TODO: Add code view logic 89 views: {value: {'design': DesignDocumentView.create(), 'code': CodeDocumentView.create()}} //TODO: Add code view logic
91 }); 90 });
92 //Calling the any init routines in the model 91 //Calling the any init routines in the model
93 this.model.init(); 92 this.model.init();
@@ -101,10 +100,10 @@ exports.HtmlDocument = Montage.create(Component, {
101 //ERROR: Design View not initialized 100 //ERROR: Design View not initialized
102 } 101 }
103 102
104 103
104 //TODO: Make sure you have a boolean to indicate if view was initilize and handle errors (just like design view above)
105 //initialize the code view for the html document and hide it since design is the default view 105 //initialize the code view for the html document and hide it since design is the default view
106 this.model.views.code.initialize(this.model.parentContainer); 106 this.model.views.code.initialize(this.model.parentContainer);
107
108 this.model.views.code.hide(); 107 this.model.views.code.hide();
109 108
110 109
@@ -126,8 +125,10 @@ exports.HtmlDocument = Montage.create(Component, {
126 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); 125 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this));
127 this._observer.observe(this.model.views.design.document.head, {childList: true}); 126 this._observer.observe(this.model.views.design.document.head, {childList: true});
128 }.bind(this), template, {viewCallback: this.handleViewReady, context: this}); 127 }.bind(this), template, {viewCallback: this.handleViewReady, context: this});
128 } else if (view === 'code'){
129 //TODO: Add logic to open document in code view since it's now available
129 } else { 130 } else {
130 //TODO: Identify default view (probably code) 131 //TODO: Add error handling
131 } 132 }
132 } 133 }
133 }, 134 },
@@ -166,17 +167,19 @@ exports.HtmlDocument = Montage.create(Component, {
166 this._observer.observe(this.model.views.design.document.head, {childList: true}); 167 this._observer.observe(this.model.views.design.document.head, {childList: true});
167 }.bind(this), template, {viewCallback: this.handleViewReady, context: this}); 168 }.bind(this), template, {viewCallback: this.handleViewReady, context: this});
168 } else if(view === 'code'){ 169 } else if(view === 'code'){
169 //TODO: Identify default view (probably code) 170
170 171
171 //TODO:get the html content from the document 172 //TODO: Parse in memory document through template to get current document
172 content = '<html><head>'+this.model.file.content.head+'</head><body>'+this.model.file.content.body+'</body></html>';//dummy 173 content = '<html><head>'+this.model.file.content.head+'</head><body>'+this.model.file.content.body+'</body></html>';//dummy
173 174
175
176 //
174 this.model.views.code.load(content); 177 this.model.views.code.load(content);
175
176 //Setting current view object to code 178 //Setting current view object to code
177 this.currentView = 'code'; 179 this.currentView = 'code';
178 this.model.currentView = this.model.views.code; 180 this.model.currentView = this.model.views.code;
179 181 } else {
182 //TODO: Identify default view (probably code) - Error handling
180 } 183 }
181 } 184 }
182 }, 185 },