aboutsummaryrefslogtreecommitdiff
path: root/js/panels/presets/transitions-presets.reel
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-16 22:08:04 -0800
committerValerio Virgillito2012-02-16 22:08:04 -0800
commit0175cb67e426a27a3ecfb7b81317caa383c8a5a5 (patch)
treeb4fbfcaabaadff508ad5463e8f71fd643995aacb /js/panels/presets/transitions-presets.reel
parentfe71cb9aa1700199c0089166ad54fc56eb760644 (diff)
parent9f0c4efe2ed9a00f2c5d85c9d88a8040fedb5d8f (diff)
downloadninja-0175cb67e426a27a3ecfb7b81317caa383c8a5a5.tar.gz
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js/panels/presets/transitions-presets.reel')
-rw-r--r--js/panels/presets/transitions-presets.reel/transitions-presets.css0
-rw-r--r--js/panels/presets/transitions-presets.reel/transitions-presets.html58
-rw-r--r--js/panels/presets/transitions-presets.reel/transitions-presets.js46
3 files changed, 104 insertions, 0 deletions
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
--- /dev/null
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.css
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..c22ed351
--- /dev/null
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.html
@@ -0,0 +1,58 @@
1<!DOCTYPE html>
2<!-- <copyright>
3This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
4No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
5(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
6</copyright> -->
7<html lang="en">
8<head>
9 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
10 <link rel="stylesheet" href="transitions-presets.css" type="text/css">
11 <script type="text/montage-serialization">
12 {
13 "owner": {
14 "module" : "js/panels/presets/transitions-presets.reel",
15 "name" : "TransitionsLibrary",
16 "properties" : {
17 "element" : {"#" : "transitionsLibrary"},
18 "treeList" : {"@" : "treeList"}
19 }
20 },
21 "presetsController" : {
22 "module": "js/controllers/tree-controller",
23 "name": "TreeController",
24 "properties" : {
25 "branchKey" : "children",
26 "labelKey" : "text",
27 "delegate": {"@": "owner" }
28 },
29 "bindings": {
30 "content": {
31 "boundObject": {"@": "owner"},
32 "boundObjectPropertyPath": "presetData"
33 }
34 }
35 },
36 "presetsContainer" : {
37 "module" : "js/components/treeview/treeview.reel",
38 "name" : "Treeview",
39 "properties" : {
40 "element" : {"#": "libraryContainer"},
41 "branchComponent" : {"@": "branch" },
42 "contentController": {"@": "presetsController"},
43 "showRoot": false
44 }
45 },
46 "branch" : {
47 "module" : "js/components/treeview/ninja-branch.reel",
48 "name" : "Branch"
49 }
50 }
51 </script>
52</head>
53<body>
54<section id="transitionsLibrary" class="transitionsLibrary">
55 <div id="libraryContainer"></div>
56</section>
57</body>
58</html> \ 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..f7d84085
--- /dev/null
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.js
@@ -0,0 +1,46 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 DefaultPresets = require("js/panels/presets/default-transition-presets").transitionPresets;
10
11exports.TransitionsLibrary = Montage.create(Component, {
12 hasTemplate: {
13 value: true
14 },
15 presetData : {
16 value: null
17 },
18 deserializedFromTemplate : {
19 value: function() {
20 this.presetData = DefaultPresets;
21 }
22 },
23 handleNodeActivation: {
24 value: function(presetData) {
25 var selection = this.application.ninja.selectedElements,
26 stylesController = this.application.ninja.stylesController,
27 selectorBase = presetData.selectorBase,
28 self = this;
29
30 if(!selection || !selection.length || selection.length === 0) {
31 return false;
32 }
33
34 selectorBase = stylesController.generateClassName(selectorBase);
35
36 presetData.rules.forEach(function(rule) {
37 this.application.ninja.stylesController.addRule('.' + selectorBase + rule.selectorSuffix, rule.styles);
38 }, this);
39
40 selection.forEach(function(el) {
41 el._element.classList.add(selectorBase);
42 }, this);
43
44 }
45 }
46});