From 18f687974273b5ed7374ca5ae440c797064c5d0f Mon Sep 17 00:00:00 2001
From: Eric Guzman
Date: Tue, 7 Feb 2012 13:35:27 -0800
Subject: Presets Panel - Initial commit with panel content
---
.../transitions-presets.css | 0
.../transitions-presets.html | 58 +++++++++++++++++++
.../transitions-presets.js | 67 ++++++++++++++++++++++
3 files changed, 125 insertions(+)
create mode 100644 js/panels/presets/transitions-presets.reel/transitions-presets.css
create mode 100644 js/panels/presets/transitions-presets.reel/transitions-presets.html
create mode 100644 js/panels/presets/transitions-presets.reel/transitions-presets.js
(limited to 'js/panels/presets/transitions-presets.reel')
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.css b/js/panels/presets/transitions-presets.reel/transitions-presets.css
new file mode 100644
index 00000000..e69de29b
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.html b/js/panels/presets/transitions-presets.reel/transitions-presets.html
new file mode 100644
index 00000000..e3bf0aba
--- /dev/null
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.html
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.js b/js/panels/presets/transitions-presets.reel/transitions-presets.js
new file mode 100644
index 00000000..bc91b3ad
--- /dev/null
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.js
@@ -0,0 +1,67 @@
+/*
+ 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.TransitionsLibrary = Montage.create(Component, {
+ hasTemplate: {
+ value: true
+ },
+ contentPanel : {
+ value: "presets" // get from local storage
+ },
+ templateDidLoad : {
+ value: function() {
+ console.log('deserialized');
+ }
+ },
+ treeList : {
+ value : null
+ },
+ data2: {
+ value: {
+ "meta": "Blah",
+ "status": "OK",
+ "text" : "Root",
+ "data" : {
+ "date": "1.1.01",
+ "text": "Transitions",
+ "children": [{
+ "date": "3.3.01",
+ "text": "Kid 1"
+ },
+ {
+ "date": "3.3.01",
+ "text": "Kid 2",
+ "children": [{
+ "date": "3.4.01",
+ "text": "Grand Kid 1",
+ "children": [{
+ "date": "4.4.01",
+ "text": "Great Grand Kid 1"
+ }]
+ }]
+
+ },{
+ "date": "5.5.01",
+ "text": "Kid 3"
+ }]
+ }
+ }
+ },
+ didDraw: {
+ value : function() {
+ console.log('Presets Panel prepare for draw.');
+// this.treeList.items.push({
+// label : "Box Style",
+// type : 'leaf'
+// });
+ }
+ }
+
+
+});
--
cgit v1.2.3
From 98b3083849b71155a8cb37d300b216150db0dcb5 Mon Sep 17 00:00:00 2001
From: Eric Guzman
Date: Wed, 15 Feb 2012 21:44:01 -0800
Subject: Presets - Modify application of preset classes for new json structure
---
.../transitions-presets.html | 6 +-
.../transitions-presets.js | 71 ++++++++--------------
2 files changed, 28 insertions(+), 49 deletions(-)
(limited to 'js/panels/presets/transitions-presets.reel')
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.html b/js/panels/presets/transitions-presets.reel/transitions-presets.html
index e3bf0aba..c22ed351 100644
--- a/js/panels/presets/transitions-presets.reel/transitions-presets.html
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.html
@@ -22,7 +22,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
"module": "js/controllers/tree-controller",
"name": "TreeController",
"properties" : {
- "rootKey" : "data",
"branchKey" : "children",
"labelKey" : "text",
"delegate": {"@": "owner" }
@@ -30,7 +29,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
"bindings": {
"content": {
"boundObject": {"@": "owner"},
- "boundObjectPropertyPath": "data2"
+ "boundObjectPropertyPath": "presetData"
}
}
},
@@ -40,7 +39,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
"properties" : {
"element" : {"#": "libraryContainer"},
"branchComponent" : {"@": "branch" },
- "contentController": {"@": "presetsController"}
+ "contentController": {"@": "presetsController"},
+ "showRoot": false
}
},
"branch" : {
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.js b/js/panels/presets/transitions-presets.reel/transitions-presets.js
index bc91b3ad..f7d84085 100644
--- a/js/panels/presets/transitions-presets.reel/transitions-presets.js
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.js
@@ -5,63 +5,42 @@
*/
var Montage = require("montage/core/core").Montage,
- Component = require("montage/ui/component").Component;
+ Component = require("montage/ui/component").Component,
+ DefaultPresets = require("js/panels/presets/default-transition-presets").transitionPresets;
exports.TransitionsLibrary = Montage.create(Component, {
hasTemplate: {
value: true
},
- contentPanel : {
- value: "presets" // get from local storage
+ presetData : {
+ value: null
},
- templateDidLoad : {
+ deserializedFromTemplate : {
value: function() {
- console.log('deserialized');
+ this.presetData = DefaultPresets;
}
},
- treeList : {
- value : null
- },
- data2: {
- value: {
- "meta": "Blah",
- "status": "OK",
- "text" : "Root",
- "data" : {
- "date": "1.1.01",
- "text": "Transitions",
- "children": [{
- "date": "3.3.01",
- "text": "Kid 1"
- },
- {
- "date": "3.3.01",
- "text": "Kid 2",
- "children": [{
- "date": "3.4.01",
- "text": "Grand Kid 1",
- "children": [{
- "date": "4.4.01",
- "text": "Great Grand Kid 1"
- }]
- }]
+ handleNodeActivation: {
+ value: function(presetData) {
+ var selection = this.application.ninja.selectedElements,
+ stylesController = this.application.ninja.stylesController,
+ selectorBase = presetData.selectorBase,
+ self = this;
- },{
- "date": "5.5.01",
- "text": "Kid 3"
- }]
+ if(!selection || !selection.length || selection.length === 0) {
+ return false;
}
- }
- },
- didDraw: {
- value : function() {
- console.log('Presets Panel prepare for draw.');
-// this.treeList.items.push({
-// label : "Box Style",
-// type : 'leaf'
-// });
- }
- }
+ selectorBase = stylesController.generateClassName(selectorBase);
+ presetData.rules.forEach(function(rule) {
+ this.application.ninja.stylesController.addRule('.' + selectorBase + rule.selectorSuffix, rule.styles);
+ }, this);
+
+ selection.forEach(function(el) {
+ el._element.classList.add(selectorBase);
+ }, this);
+
+ }
+ }
});
--
cgit v1.2.3