aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/styles-view-container.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel/styles-view-container.reel')
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.css33
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.html91
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.js133
3 files changed, 257 insertions, 0 deletions
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.css b/js/panels/css-panel/styles-view-container.reel/styles-view-container.css
new file mode 100644
index 00000000..bec2f449
--- /dev/null
+++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.css
@@ -0,0 +1,33 @@
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.sub-panel-slot {
7 background-color: #FFF;
8 display: -webkit-box;
9 -webkit-box-orient: vertical;
10 -webkit-box-flex: 1;
11}
12.no-styles .sub-panel-slot, .no-styles .styles-view-toolbar-container {
13 display: none;
14}
15.styles-view-container .panel-message {
16 display: none;
17}
18.styles-view-container.no-styles .panel-message {
19 display: block;
20}
21.styles-view-toolbar-container {
22 border-top: 1px solid #303030;
23}
24.styles-view-toolbar-container .toolbar-container {
25 border-top: 1px solid #5c5c5c;
26}
27
28/* ----- Toolbar ----*/
29
30.styles-view-container .toolbar-computed-button {
31 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1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%2FcQkG0BxFz4NDNBbWP48eMHN5CSBGLhFy9eyCkpKdlOmDBhNpCvh88QkAF%2FQQw2NjZuX1%2FfxNDQ0AIREREbkJi%2Bvr7OxIkTZwGZaiAl2AxgBGLtVatW7RMVFRXDZcvBgwcnNDQ01AKZX9DlmIH417Vr186ws7NzPn78%2BNW9e%2Feevnz5kkFGRgYUiAyXLl26XFFR0QBkvoC5FpsrOIFYHIjlQX4OCgqaAgrYvr6%2B60C%2BHRBzQ73LAqVRwuA%2FEH8H4pdA%2FBCI7wO98%2FjRo0dPgE4%2FYmJi8hcalXxxcXG2QFoKOTyYsTnpPxCIiYkZRkREBL5%2B%2FfruuXPnzgKFJSorK5cpKCioHDt27BqQ%2FwnkJSYs%2Bn8DNTyFuozh7du3skBKEZRGvn37xuft7Z2Ym5sLChMlkEtYsDkAFLDMzMx%2FQBwzMzMvHR0d3d%2B%2Ff3Pw8vKCUisDMIzCgfK%2FgemkghFHzAkkJSXlxsbGNuGK2p9A4OHhoc%2BCQ%2F7LvHnz5j98%2BPCepKSk1r9%2F%2F5g%2Ff%2F4sBkxkYbKystzAVPt7ypQpIMPfEUrmHKDQhyZ3mwULFjzZsWPHTy8vrxogXxpXJOACSsAMdxro%2FwJkzYwkGMANdc0PWBSCBAECDAAwy7PLmtswugAAAABJRU5ErkJggg%3D%3D);
32
33} \ No newline at end of file
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.html b/js/panels/css-panel/styles-view-container.reel/styles-view-container.html
new file mode 100644
index 00000000..9868f486
--- /dev/null
+++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.html
@@ -0,0 +1,91 @@
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 href="styles-view-container.css" rel="stylesheet" type="text/css">
11 <script type="text/montage-serialization">
12 {
13 "owner": {
14 "module" : "js/panels/css-panel/styles-view-container.reel",
15 "name" : "StylesViewContainer",
16 "properties" : {
17 "element" : {"#" : "container"},
18 "ruleListContainer": {"@": "ruleListContainer" },
19 "computedStyleView": {"@": "computedStyleView" },
20 "substitution": {"@": "substitution" },
21 "toolbar": {"@": "toolbar"}
22 }
23 },
24 "substitution": {
25 "module": "montage/ui/substitution.reel",
26 "name": "Substitution",
27 "properties": {
28 "element": {"#": "sub-panel-slot"},
29 "switchComponents": {
30 "rules": {"@": "ruleListContainer"},
31 "computed": {"@": "computedStyleView"}
32 }
33 },
34 "bindings": {
35 "switchValue": {
36 "boundObject": {"@": "owner"},
37 "boundObjectPropertyPath": "contentPanel",
38 "oneway": true
39 }
40 }
41 },
42 "stylesViewDelegate" : {
43 "module": "js/panels/css-panel/styles-view-delegate",
44 "name": "StylesViewMediator",
45 "properties": {
46 "ruleListContainer": {"@": "ruleListContainer"}
47 }
48 },
49 "ruleListContainer": {
50 "module": "js/panels/css-panel/rule-list-container.reel",
51 "name": "RuleListContainer",
52 "properties": {
53 "focusDelegate": {"@": "stylesViewDelegate"}
54 }
55 },
56 "computedStyleView": {
57 "module": "js/panels/CSSPanel/ComputedStyleSubPanel.reel",
58 "name": "ComputedStyleSubPanel"
59 },
60 "toolbar": {
61 "module": "js/components/toolbar.reel",
62 "name": "Toolbar",
63 "properties": {
64 "element": {"#": "styles-view-toolbar"},
65 "delegate": {"@": "stylesViewDelegate" },
66 "buttons": [
67 {
68 "title": "Add",
69 "identifier": "add"
70 },
71 {
72 "title": "Computed Styles",
73 "identifier": "computed",
74 "leftAlign": true
75 }
76 ]
77 }
78 }
79 }
80 </script>
81</head>
82<body>
83<div id="container" class="styles-view-container">
84 <h4 id="no-styles-message" class="panel-message">No styles to display.</h4>
85 <div id="sub-panel-slot" class="sub-panel-slot"></div>
86 <div class="styles-view-toolbar-container">
87 <div id="styles-view-toolbar"></div>
88 </div>
89</div>
90</body>
91</html> \ No newline at end of file
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
new file mode 100644
index 00000000..6ce64b8f
--- /dev/null
+++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
@@ -0,0 +1,133 @@
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
10exports.StylesViewContainer = Montage.create(Component, {
11 contentController : {
12 value: null
13 },
14 contentPanel : {
15 value: 'rules'
16 },
17 _hasStyles : {
18 value: false
19 },
20 hasStyles : {
21 get: function() {
22 return this._hasStyles;
23 },
24 set: function(hasThem) {
25 this._hasStyles = hasThem;
26 this.needsDraw = true;
27 }
28 },
29
30 _getElementLabel : {
31 value: function(el) {
32 var id = '#'+el.id,
33 className = '.'+Array.prototype.slice.call(el.classList).join('.'),
34 nodeName = el.nodeName;
35
36 if(id.length > 1) {
37 return nodeName + id;
38 } else if(className.length > 1) {
39 return nodeName + className;
40 }
41
42 return nodeName;
43 }
44 },
45
46 templateDidLoad : {
47 value: function() {
48 this.eventManager.addEventListener('styleSheetsReady', this, false);
49 //this.eventManager.addEventListener('elementChanging', this, false);
50 this.eventManager.addEventListener('elementChange', this, false);
51 }
52 },
53 handleStyleSheetsReady: {
54 value: function(e) {
55 this.eventManager.addEventListener( "selectionChange", this, false);
56 }
57 },
58 handleSelectionChange: {
59 value: function() {
60 var elements = this.application.ninja.selectedElements;
61
62 if(elements.length === 0) {