From c87e538fdc337639bc4d54bb087dbf2b4f20297f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 11 May 2012 14:41:20 -0700 Subject: Adding support for new templates This is supported for NEW and OPEN, SAVE is not supported yet by I/O. Saving works, but it will not be a banner template. --- js/document/templates/banner/index.html | 94 +++++++++++++++++++++++++++++++ js/document/templates/banner/main.js | 49 ++++++++++++++++ js/document/templates/banner/package.json | 8 +++ 3 files changed, 151 insertions(+) create mode 100755 js/document/templates/banner/index.html create mode 100644 js/document/templates/banner/main.js create mode 100755 js/document/templates/banner/package.json (limited to 'js/document/templates/banner') diff --git a/js/document/templates/banner/index.html b/js/document/templates/banner/index.html new file mode 100755 index 00000000..2cd82f51 --- /dev/null +++ b/js/document/templates/banner/index.html @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/js/document/templates/banner/main.js b/js/document/templates/banner/main.js new file mode 100644 index 00000000..d5ac88d5 --- /dev/null +++ b/js/document/templates/banner/main.js @@ -0,0 +1,49 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +exports.Main = Montage.create(Component, { + + hasTemplate: { + value: false + }, + + /** + * Adding window hooks to callback into this object from Ninja. + */ + templateDidLoad: { + value: function(){ + 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.needsDraw = true; + componentInstance.ownerComponent = self; + + callback(componentInstance, element); + }) + .end(); + + }; + + // Dispatch event when this template has loaded. + /* + var newEvent = document.createEvent( "CustomEvent" ); + newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); + document.body.dispatchEvent( newEvent ); + */ + + } + } +}); \ No newline at end of file diff --git a/js/document/templates/banner/package.json b/js/document/templates/banner/package.json new file mode 100755 index 00000000..c8bc02fb --- /dev/null +++ b/js/document/templates/banner/package.json @@ -0,0 +1,8 @@ +{ + "directories": { + "lib": "" + }, + "mappings": { + "montage": "../../../../node_modules/montage/" + } +} \ No newline at end of file -- cgit v1.2.3