From b59bb17d10a0f5c9c2e5ce0eb1e0e1c7da6c92f6 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 20 Jul 2012 15:51:27 -0700 Subject: Unifying the banner and animation template display of ninja-content In the banner and animation template the stage element now shows div in both the pi and breadcrumb. IKNINJA: 1776 Signed-off-by: Valerio Virgillito --- js/components/converter/node-name-converter.js | 54 ++++++++++++++++++++++ .../layout/bread-crumb.reel/bread-crumb.html | 6 ++- js/models/element-model.js | 8 ++-- 3 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 js/components/converter/node-name-converter.js (limited to 'js') diff --git a/js/components/converter/node-name-converter.js b/js/components/converter/node-name-converter.js new file mode 100644 index 00000000..fdca06e5 --- /dev/null +++ b/js/components/converter/node-name-converter.js @@ -0,0 +1,54 @@ +/* +Copyright (c) 2012, Motorola Mobility LLC. +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +var Montage = require("montage").Montage, + Converter = require("montage/core/converter/converter").Converter; + +exports.NodeNameConverter = Montage.create(Converter, { + + convert: { + value: function(value) { + if(value) { + if(value.toLowerCase() === "ninja-content") { + value = "DIV"; + } + + return value; + } + } + }, + + revert: { + value: function(value) { + return value; + } + } + +}); diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.html b/js/components/layout/bread-crumb.reel/bread-crumb.html index 2c6d941f..2fff245c 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.html +++ b/js/components/layout/bread-crumb.reel/bread-crumb.html @@ -44,13 +44,17 @@ POSSIBILITY OF SUCH DAMAGE. } }, + "nodeNameConverter": { + "prototype": "js/components/converter/node-name-converter" + }, + "breadcrumbButton": { "prototype": "js/components/layout/bread-crumb-button.reel", "properties": { "element": {"#": "breadcrumbButton"} }, "bindings": { - "label": {"<-": "@buttonsList.objectAtCurrentIteration.label"}, + "label": {"<-": "@buttonsList.objectAtCurrentIteration.label", "converter": {"@": "nodeNameConverter"}}, "value": {"<-": "@buttonsList.objectAtCurrentIteration.nodeUuid"} } }, diff --git a/js/models/element-model.js b/js/models/element-model.js index 07abbd40..7d8e6ebb 100755 --- a/js/models/element-model.js +++ b/js/models/element-model.js @@ -53,7 +53,7 @@ var modelGenerator = exports.modelGenerator = function() { }) }); - if(this._model.selection !== "body") { + if(this._model.selection !== "body" && this.nodeName.toLowerCase() !== "ninja-content") { this._model.props3D.init(this, false); } @@ -75,9 +75,9 @@ var getInfoForElement = function(el) { } if(el.nodeName.toLowerCase() === "ninja-content") { - elementName = "body"; - controller = elementNameToController(elementName); - pi = elementNameToPi(elementName); + elementName = "div"; + controller = elementNameToController("body"); + pi = elementNameToPi("body"); } // TODO: Add this in case there is no controller for the component -- cgit v1.2.3