diff options
author | Eric Guzman | 2012-04-23 11:55:08 -0700 |
---|---|---|
committer | Eric Guzman | 2012-04-23 11:55:08 -0700 |
commit | c0fce534c255ef1e25779e2f0e8de95bb4e160cf (patch) | |
tree | 61d313ae0dc14f5abf56d084e723bc1a30c64c1b /js/panels/css-panel/styles-view-mediator.js | |
parent | 0e5520008925f480d5d1bb8356220c773d1c5e37 (diff) | |
download | ninja-c0fce534c255ef1e25779e2f0e8de95bb4e160cf.tar.gz |
CSS Panel - Add styles view delegate. Add handling for adding rules to stylesheets
Diffstat (limited to 'js/panels/css-panel/styles-view-mediator.js')
-rw-r--r-- | js/panels/css-panel/styles-view-mediator.js | 38 |
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 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.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 | ||