aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/styles-view-mediator.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel/styles-view-mediator.js')
-rw-r--r--js/panels/css-panel/styles-view-mediator.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/js/panels/css-panel/styles-view-mediator.js b/js/panels/css-panel/styles-view-mediator.js
new file mode 100644
index 00000000..38b61220
--- /dev/null
+++ b/js/panels/css-panel/styles-view-mediator.js
@@ -0,0 +1,38 @@
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.StylesViewMediator = Montage.create(Component, {
11 stylesController : {
12 get: function() {
13 return this.application.ninja.stylesController;
14 },
15 set: function(){
16 return;
17 }
18 },
19 handleAddAction : {
20 value: function(e) {
21 var selector, newRule;
22
23 ///// Add rule to the container
24
25 ///// Get selection prefix
26 if(this.ruleListContainer.displayedList.selection.length > 1) {
27 selector = this.stylesController.generateClassName(null, true);
28 } else {
29 selector = this.stylesController.generateClassName(this.ruleListContainer.displayedList.selection[0].nodeName);
30 }
31
32 newRule = this.application.ninja.stylesController.addRule("."+selector, ' { }');
33
34 this.ruleListContainer.displayedList.component.addRule(newRule);
35
36 }
37 }
38}); \ No newline at end of file