From 0e1a276f19ea70009c5a649e9667861d7c346a7e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 6 Jun 2012 00:25:27 -0700 Subject: first iteration of adding serializable to ninja plus other changes to run the latest montage Signed-off-by: Valerio Virgillito --- js/components/menu/menu-entry.reel/menu-entry.html | 6 ++- js/components/menu/menu-entry.reel/menu-entry.js | 49 +++++++++++++++++++--- js/components/menu/menu-item.reel/menu-item.js | 15 +++++++ js/components/menu/menu.reel/menu.html | 14 +++---- 4 files changed, 69 insertions(+), 15 deletions(-) (limited to 'js/components/menu') diff --git a/js/components/menu/menu-entry.reel/menu-entry.html b/js/components/menu/menu-entry.reel/menu-entry.html index f64de3cb..7310545f 100755 --- a/js/components/menu/menu-entry.reel/menu-entry.html +++ b/js/components/menu/menu-entry.reel/menu-entry.html @@ -24,8 +24,10 @@ "repetition": { "prototype": "montage/ui/repetition.reel", "properties": { - "element": { "#": "subEntries" }, - "contentController": {"@": "entriesController"} + "element": { "#": "subEntries" } + }, + "bindings": { + "objects": {"<-": "@owner.data.entries"} } }, diff --git a/js/components/menu/menu-entry.reel/menu-entry.js b/js/components/menu/menu-entry.reel/menu-entry.js index 57e6ec87..b9c546ed 100755 --- a/js/components/menu/menu-entry.reel/menu-entry.js +++ b/js/components/menu/menu-entry.reel/menu-entry.js @@ -8,18 +8,54 @@ var Montage = require("montage/core/core").Montage; var Component = require("montage/ui/component").Component; exports.MenuEntry = Montage.create(Component, { - topHeader: { value: null }, - topHeaderText: { value: null }, + topHeader: { + value: null, + serializable: true + }, + + topHeaderText: { + value: null, + serializable: true + }, + + subEntries: { + value: null, + serializable: true + }, // Reference to the parent Menu component _menu: { value: null }, - data: { + menu: { + get: function() { + return this._menu; + }, + set: function(value) { + if(value !== this._menu) { + this._menu = value; + } + }, + serializable: true + }, + + _data: { value: null }, + data: { + get: function() { + return this._data; + }, + set: function(value) { + if(this._data !== value) { + this._data = value; + } + }, + serializable: true + }, + select: { value: function() { this.element.classList.add("selected"); @@ -49,13 +85,16 @@ exports.MenuEntry = Montage.create(Component, { handleClick: { value: function(event) { - this._menu.toggleActivation(this); + // TODO: Hack! Rework this! + this.parentComponent.ownerComponent.toggleActivation(this); +// this._menu.toggleActivation(this); } }, handleMouseover: { value: function(event) { - this._menu.activeEntry = this; + this.parentComponent.ownerComponent.activeEntry = this; +// this._menu.activeEntry = this; } }, diff --git a/js/components/menu/menu-item.reel/menu-item.js b/js/components/menu/menu-item.reel/menu-item.js index c00c4412..f9a625a3 100755 --- a/js/components/menu/menu-item.reel/menu-item.js +++ b/js/components/menu/menu-item.reel/menu-item.js @@ -9,6 +9,21 @@ var Component = require("montage/ui/component").Component; exports.MenuItem = Montage.create(Component, { + itemBackground: { + value: null, + serializable: true + }, + + itemText: { + value: null, + serializable: true + }, + + subMenu: { + value: null, + serializable: true + }, + data: { value: null }, diff --git a/js/components/menu/menu.reel/menu.html b/js/components/menu/menu.reel/menu.html index f15cf119..f18c1a0f 100755 --- a/js/components/menu/menu.reel/menu.html +++ b/js/components/menu/menu.reel/menu.html @@ -31,9 +31,10 @@ "repetition": { "prototype": "montage/ui/repetition.reel", "properties": { - "element": { "#": "topMenu" }, - "contentController": {"@": "menuController"}, - "menuComponent": {"@": "owner"} + "element": { "#": "topMenu" } + }, + "bindings": { + "objects": {"<-": "@menudata.topLevelMenu"} } }, @@ -43,17 +44,14 @@ "element": { "#": "menuItem" } }, "bindings": { - "data": {"<-": "@repetition.objectAtCurrentIteration"}, - "_menu": {"<-": "@repetition.menuComponent"} + "data": {"<-": "@repetition.objectAtCurrentIteration"} } }, "owner": { "prototype": "js/components/menu/menu.reel", "properties": { - "element": {"#": "mainMenuBar"}, - "controller": {"@": "menuController"}, - "rep": {"@": "repetition"} + "element": {"#": "mainMenuBar"} } } } -- cgit v1.2.3