From 9b8a24a7360416d5750828c9580e33dd336ff882 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Fri, 16 Mar 2012 17:57:18 -0700 Subject: Getting ownerComponent bindings --- .../templates/montage-html/main.reel/main.js | 43 +++++++++++----------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'js/document/templates/montage-html') diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index 567f481c..ee23e844 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js @@ -17,7 +17,25 @@ exports.Main = Montage.create(Component, { */ templateDidLoad: { value: function(){ - window.addComponent = this.addComponentToUserDocument; + var self = this; + window.addComponent = function(element, data, callback) { + var component; + + component = require.async(data.path) + .then(function(component) { + var componentRequire = component[data.name]; + var componentInstance = componentRequire.create(); + + componentInstance.element = element; + //componentInstance.deserializedFromTemplate(); + componentInstance.needsDraw = true; + componentInstance.ownerComponent = self; + + callback(componentInstance, element); + }) + .end(); + + }; // window.addBinding = this.addBindingToUserDocument; // Dispatch event when this template has loaded. @@ -29,26 +47,9 @@ exports.Main = Montage.create(Component, { } }, - // Adding components to the user document by using a async require. - addComponentToUserDocument:{ - value:function(element, data, callback){ - - var component; - - component = require.async(data.path) - .then(function(component) { - var componentRequire = component[data.name]; - var componentInstance = componentRequire.create(); - - componentInstance.element = element; - //componentInstance.deserializedFromTemplate(); - componentInstance.needsDraw = true; - - callback(componentInstance, element); - }) - .end(); - - } + location: { + value:null, + enumerable:false } }); \ No newline at end of file -- cgit v1.2.3 From 9b53d2dac464cb9217b217e6707dbb97c1d65490 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 11:25:52 -0700 Subject: Deleting unecessary property --- js/document/templates/montage-html/main.reel/main.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'js/document/templates/montage-html') diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index ee23e844..6c141108 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js @@ -45,11 +45,5 @@ exports.Main = Montage.create(Component, { document.body.dispatchEvent( newEvent ); } - }, - - location: { - value:null, - enumerable:false } - }); \ No newline at end of file -- cgit v1.2.3 From 19aca6ec6f3c10922646f0ca760a375acdffaf56 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 21 Mar 2012 16:35:20 -0700 Subject: Adding 'addComponentFirstDraw' event from the user document main component. Signed-off-by: Valerio Virgillito --- js/document/templates/montage-html/main.reel/main.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'js/document/templates/montage-html') diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index 6c141108..2970f37a 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js @@ -27,16 +27,17 @@ exports.Main = Montage.create(Component, { var componentInstance = componentRequire.create(); componentInstance.element = element; - //componentInstance.deserializedFromTemplate(); + componentInstance.needsDraw = true; componentInstance.ownerComponent = self; + componentInstance.addEventListener("firstDraw", self, false); + callback(componentInstance, element); }) .end(); }; -// window.addBinding = this.addBindingToUserDocument; // Dispatch event when this template has loaded. var newEvent = document.createEvent( "CustomEvent" ); @@ -45,5 +46,14 @@ exports.Main = Montage.create(Component, { document.body.dispatchEvent( newEvent ); } + }, + + handleFirstDraw: { + value: function() { + var newEvent = document.createEvent( "CustomEvent" ); + newEvent.initCustomEvent( "addComponentFirstDraw", false, true ); + + document.body.dispatchEvent( newEvent ); + } } }); \ No newline at end of file -- cgit v1.2.3 From efcec76362a652033254fc6465dd127e8bebc04c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 22 Mar 2012 09:57:32 -0700 Subject: Adding firstDraw event to components added This will allow us to re-parse the document for styles added dynamically. --- js/document/templates/montage-html/main.reel/main.js | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'js/document/templates/montage-html') diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index 2970f37a..019c675e 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js @@ -31,8 +31,6 @@ exports.Main = Montage.create(Component, { componentInstance.needsDraw = true; componentInstance.ownerComponent = self; - componentInstance.addEventListener("firstDraw", self, false); - callback(componentInstance, element); }) .end(); @@ -46,14 +44,5 @@ exports.Main = Montage.create(Component, { document.body.dispatchEvent( newEvent ); } - }, - - handleFirstDraw: { - value: function() { - var newEvent = document.createEvent( "CustomEvent" ); - newEvent.initCustomEvent( "addComponentFirstDraw", false, true ); - - document.body.dispatchEvent( newEvent ); - } } }); \ No newline at end of file -- cgit v1.2.3 From fea875906664f12feaad0f282901fa8d9a8b054a Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 22 Mar 2012 11:52:44 -0700 Subject: Presets Panel - Adding presets controller and removing functionality from panel code --- js/document/templates/montage-html/default_html.css | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js/document/templates/montage-html') diff --git a/js/document/templates/montage-html/default_html.css b/js/document/templates/montage-html/default_html.css index 68300edf..24a752bc 100755 --- a/js/document/templates/montage-html/default_html.css +++ b/js/document/templates/montage-html/default_html.css @@ -72,4 +72,9 @@ body .elem-red-outline { outline: red solid thin; +} + +.nj-preset-transition { + -webkit-transition: all 450ms linear !important; + background-color: red; } \ No newline at end of file -- cgit v1.2.3 From 668a3e832c0f4dd1ea0c3d56e3a79756c0a236b1 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 27 Mar 2012 11:43:37 -0700 Subject: Presets Controller - Removing test background from transition class --- js/document/templates/montage-html/default_html.css | 1 - 1 file changed, 1 deletion(-) (limited to 'js/document/templates/montage-html') diff --git a/js/document/templates/montage-html/default_html.css b/js/document/templates/montage-html/default_html.css index 24a752bc..6c2b415f 100755 --- a/js/document/templates/montage-html/default_html.css +++ b/js/document/templates/montage-html/default_html.css @@ -76,5 +76,4 @@ body .nj-preset-transition { -webkit-transition: all 450ms linear !important; - background-color: red; } \ No newline at end of file -- cgit v1.2.3