diff options
author | Eric Guzman | 2012-05-08 09:43:57 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-08 09:43:57 -0700 |
commit | af4dac82d2e76fe90191d6c085740d855bf961f3 (patch) | |
tree | be1eb3c1cab11bc8711f92c6a47a3fa6c46c07e7 /js/panels/css-panel | |
parent | a62f57cf6beee332ff60a48f5e26d0084b4a5432 (diff) | |
download | ninja-af4dac82d2e76fe90191d6c085740d855bf961f3.tar.gz |
Style sheets - Added default stylesheet selection
Diffstat (limited to 'js/panels/css-panel')
6 files changed, 89 insertions, 5 deletions
diff --git a/js/panels/css-panel/css-panel.reel/css-panel.css b/js/panels/css-panel/css-panel.reel/css-panel.css index 7a4191b9..8ef5ec27 100644 --- a/js/panels/css-panel/css-panel.reel/css-panel.css +++ b/js/panels/css-panel/css-panel.reel/css-panel.css | |||
@@ -31,12 +31,14 @@ | |||
31 | } | 31 | } |
32 | 32 | ||
33 | .css-panel .style-sheets-view-container { | 33 | .css-panel .style-sheets-view-container { |
34 | -webkit-box-flex: 0; | 34 | display: -webkit-box; |
35 | min-height: 41px; | 35 | min-height: 41px; |
36 | -webkit-box-flex: 0; | ||
37 | -webkit-box-orient: vertical; | ||
36 | } | 38 | } |
37 | .css-panel .styles-view-container { | 39 | .css-panel .styles-view-container { |
38 | -webkit-box-flex: 1; | ||
39 | display: -webkit-box; | 40 | display: -webkit-box; |
41 | -webkit-box-flex: 1; | ||
40 | -webkit-box-orient: vertical; | 42 | -webkit-box-orient: vertical; |
41 | } | 43 | } |
42 | .panel-message { | 44 | .panel-message { |
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.css b/js/panels/css-panel/style-sheet.reel/style-sheet.css index 9ea03be8..1d26b041 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.css +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.css | |||
@@ -127,6 +127,10 @@ | |||
127 | margin-right: 25px; | 127 | margin-right: 25px; |
128 | } | 128 | } |
129 | 129 | ||
130 | .default-style-sheet > span { | ||
131 | font-weight: bold; | ||
132 | } | ||
133 | |||
130 | .ss-invisible { | 134 | .ss-invisible { |
131 | display: none; | 135 | display: none; |
132 | } \ No newline at end of file | 136 | } \ No newline at end of file |
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.html b/js/panels/css-panel/style-sheet.reel/style-sheet.html index 6a9dee65..ca24487d 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.html +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.html | |||
@@ -29,6 +29,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
29 | "name": "DynamicText", | 29 | "name": "DynamicText", |
30 | "properties": { | 30 | "properties": { |
31 | "element": {"#": "sheet-name"}, | 31 | "element": {"#": "sheet-name"}, |
32 | "identifier": "nameText", | ||
32 | "defaultText": "Style sheet" | 33 | "defaultText": "Style sheet" |
33 | }, | 34 | }, |
34 | "bindings": { | 35 | "bindings": { |
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 9ad48a62..3ddd8454 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.js +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js | |||
@@ -12,6 +12,12 @@ exports.StyleSheet = Montage.create(Component, { | |||
12 | value: null | 12 | value: null |
13 | }, | 13 | }, |
14 | 14 | ||
15 | prepareForDraw : { | ||
16 | value: function() { | ||
17 | this.nameText.element.addEventListener('click', this, false); | ||
18 | } | ||
19 | }, | ||
20 | |||
15 | willDraw : { | 21 | willDraw : { |
16 | value: function() { | 22 | value: function() { |
17 | if(this.editing) { | 23 | if(this.editing) { |
@@ -45,6 +51,12 @@ exports.StyleSheet = Montage.create(Component, { | |||
45 | this.importButton.element.classList.add('ss-invisible'); | 51 | this.importButton.element.classList.add('ss-invisible'); |
46 | } | 52 | } |
47 | 53 | ||
54 | if(this.default) { | ||
55 | this._element.classList.add('default-style-sheet'); | ||
56 | } else { | ||
57 | this._element.classList.remove('default-style-sheet'); | ||
58 | } | ||
59 | |||
48 | } | 60 | } |
49 | }, | 61 | }, |
50 | 62 | ||
@@ -66,6 +78,12 @@ exports.StyleSheet = Montage.create(Component, { | |||
66 | } | 78 | } |
67 | }, | 79 | }, |
68 | 80 | ||
81 | handleClick : { | ||
82 | value: function(e) { | ||
83 | this.parentComponent.parentComponent.defaultStyleSheet = this.source; | ||
84 | } | ||
85 | }, | ||
86 | |||
69 | handleEditButtonAction: { | 87 | handleEditButtonAction: { |
70 | value: function(e) { | 88 | value: function(e) { |
71 | this.editing = true; | 89 | this.editing = true; |
@@ -130,6 +148,17 @@ exports.StyleSheet = Montage.create(Component, { | |||
130 | } | 148 | } |
131 | }, | 149 | }, |
132 | 150 | ||
151 | _default : { value: null }, | ||
152 | default : { | ||
153 | get: function() { | ||
154 | return this._default; | ||
155 | }, | ||
156 | set: function(value) { | ||
157 | this._default = value; | ||
158 | this.needsDraw = true; | ||
159 | } | ||
160 | }, | ||
161 | |||
133 | _disabled : { | 162 | _disabled : { |
134 | value: null | 163 | value: null |
135 | }, | 164 | }, |
diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.css b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.css index a3e13c77..a6e83a2c 100644 --- a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.css +++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.css | |||
@@ -12,7 +12,10 @@ | |||
12 | .style-sheets-view-container .sheet-list { | 12 | .style-sheets-view-container .sheet-list { |
13 | margin: 0; | 13 | margin: 0; |
14 | padding: 0; | 14 | padding: 0; |
15 | min-height: 55px; | 15 | min-height: 35px; |
16 | -webkit-box-flex: 1; | ||
17 | overflow-y: auto; | ||
18 | overflow-x: hidden; | ||
16 | } | 19 | } |
17 | .style-sheets-view-container .sheet-list li { | 20 | .style-sheets-view-container .sheet-list li { |
18 | list-style-type: none; | 21 | list-style-type: none; |
@@ -30,10 +33,11 @@ | |||
30 | ------------------- */ | 33 | ------------------- */ |
31 | 34 | ||
32 | .style-sheets-toolbar-container { | 35 | .style-sheets-toolbar-container { |
33 | bottom: 0; | 36 | /*bottom: 0;*/ |
34 | height: 24px; | 37 | height: 24px; |
35 | position: absolute; | 38 | /*position: absolute;*/ |
36 | width: 100%; | 39 | width: 100%; |
40 | -webkit-box-flex: 0; | ||
37 | } | 41 | } |
38 | 42 | ||
39 | /* ------------------ | 43 | /* ------------------ |
diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js index 2d6e18ed..b2d2c0fb 100644 --- a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js +++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js | |||
@@ -13,6 +13,7 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
13 | stylesController : { value: null }, | 13 | stylesController : { value: null }, |
14 | styleSheets : { value: [] }, | 14 | styleSheets : { value: [] }, |
15 | _initView : { value: false }, | 15 | _initView : { value: false }, |
16 | _needsScroll : { value: false }, | ||
16 | documentNameLabel : { value: null }, | 17 | documentNameLabel : { value: null }, |
17 | noDocumentLabelClass : { value: "no-document" }, | 18 | noDocumentLabelClass : { value: "no-document" }, |
18 | 19 | ||
@@ -28,6 +29,29 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
28 | this.needsDraw = true; | 29 | this.needsDraw = true; |
29 | } | 30 | } |
30 | }, | 31 | }, |
32 | _defaultStyleSheet: { value: null }, | ||
33 | defaultStyleSheet: { | ||
34 | get: function() { | ||
35 | return this._defaultStyleSheet; | ||
36 | }, | ||
37 | set: function(sheet) { | ||
38 | if(sheet === this._defaultStyleSheet) { return false; } | ||
39 | |||
40 | var sheetComponent, oldDefaultSheet; | ||
41 | |||
42 | if(this.styleSheetList) { | ||
43 | sheetComponent = this.styleSheetList.childComponents[this.styleSheets.indexOf(sheet)]; | ||
44 | sheetComponent.default = true; | ||
45 | if(this._defaultStyleSheet) { | ||
46 | oldDefaultSheet = this.styleSheetList.childComponents[this.styleSheets.indexOf(this._defaultStyleSheet)]; | ||
47 | oldDefaultSheet.default = false; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | this._defaultStyleSheet = sheet; | ||
52 | this.needsDraw = true; | ||
53 | } | ||
54 | }, | ||
31 | 55 | ||
32 | /// Toolbar Button Actions | 56 | /// Toolbar Button Actions |
33 | /// -------------------------------- | 57 | /// -------------------------------- |
@@ -36,6 +60,8 @@ exports.StyleSheetsView = Montage.create(Component, { | |||
36 | handleAddAction : { | 60 | handleAddAction : { |
37 | value: function(e) { | 61 | value: function(e) { |
38 | this.stylesController.createStylesheet(); | 62 | this.stylesController.createStylesheet(); |
63 | this.needsDraw = this._needsScroll = true; | ||
64 | |||
39 | } | 65 | } |
40 | }, |