diff options
author | Eric Guzman | 2012-04-03 14:43:52 -0700 |
---|---|---|
committer | Eric Guzman | 2012-04-03 14:43:52 -0700 |
commit | 30e3f3d6c19025c37694127ac148146277681994 (patch) | |
tree | 5b5edcf0508d98318e11e931283bb248c78bfd52 /js/panels/css-panel/style-sheet.reel/style-sheet.js | |
parent | 0241bf331b7e06e206a54be441edf2f4c7261f63 (diff) | |
download | ninja-30e3f3d6c19025c37694127ac148146277681994.tar.gz |
CSS Panel - Stylesheet edit mode
Diffstat (limited to 'js/panels/css-panel/style-sheet.reel/style-sheet.js')
-rw-r--r-- | js/panels/css-panel/style-sheet.reel/style-sheet.js | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.js b/js/panels/css-panel/style-sheet.reel/style-sheet.js index 5caf69a4..2396d625 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.js +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js | |||
@@ -13,9 +13,15 @@ exports.StyleSheet = Montage.create(Component, { | |||
13 | console.log("style sheet view - deserialized"); | 13 | console.log("style sheet view - deserialized"); |
14 | } | 14 | } |
15 | }, | 15 | }, |
16 | prepareForDraw : { | 16 | willDraw : { |
17 | value: function() { | 17 | value: function() { |
18 | console.log("style sheet view - prepare for draw"); | 18 | console.log("style sheet view - will draw"); |
19 | |||
20 | if(this.editing) { | ||
21 | document.body.addEventListener('click', this, false); | ||
22 | } else { | ||
23 | document.body.removeEventListener('click', this, false); | ||
24 | } | ||
19 | } | 25 | } |
20 | }, | 26 | }, |
21 | draw : { | 27 | draw : { |
@@ -23,6 +29,40 @@ exports.StyleSheet = Montage.create(Component, { | |||
23 | console.log("styles sheet view - draw"); | 29 | console.log("styles sheet view - draw"); |
24 | 30 | ||
25 | this.mediaInput.value = this._source.media.mediaText; | 31 | this.mediaInput.value = this._source.media.mediaText; |
32 | |||
33 | if(this.editing) { | ||
34 | this.editView.classList.add('expanded'); | ||
35 | } else { | ||
36 | this.editView.classList.remove('expanded'); | ||
37 | } | ||
38 | } | ||
39 | }, | ||
40 | |||
41 | handleEditButtonAction: { | ||
42 | value: function(e) { | ||
43 | console.log('handle edit button action'); | ||
44 | this.editing = true; | ||
45 | } | ||
46 | }, | ||
47 | _editing : { | ||
48 | value: null | ||
49 | }, | ||
50 | editing : { | ||
51 | get: function() { | ||
52 | return this._editing; | ||
53 | }, | ||
54 | set: function(enterEditingMode) { | ||
55 | this._editing = enterEditingMode; | ||
56 | this.needsDraw = true; | ||
57 | } | ||
58 | }, | ||
59 | |||
60 | handleClick : { | ||
61 | value: function(e) { | ||
62 | console.log("handle click"); | ||
63 | if(e.target !== this.editView) { | ||
64 | this.editing = false; | ||
65 | } | ||
26 | } | 66 | } |
27 | }, | 67 | }, |
28 | 68 | ||