修訂 | 135 (tree) |
---|---|
時間 | 2008-11-04 07:23:10 |
作者 | junkikuchi |
updated.
@@ -69,7 +69,7 @@ | ||
69 | 69 | |
70 | 70 | App.Layout.prototype = { |
71 | 71 | init: function(app) { |
72 | - this.app = app; | |
72 | + this.app = app; | |
73 | 73 | |
74 | 74 | this.units = { |
75 | 75 | top: { |
@@ -80,7 +80,7 @@ | ||
80 | 80 | right: { |
81 | 81 | position: 'right', |
82 | 82 | body: 'right', |
83 | - width: 200, | |
83 | + width: 250, | |
84 | 84 | resize: true, |
85 | 85 | scroll: true, |
86 | 86 | gutter: '0 0 0 5px' |
@@ -93,7 +93,7 @@ | ||
93 | 93 | left: { |
94 | 94 | position: 'left', |
95 | 95 | body: 'left', |
96 | - width: 200, | |
96 | + width: 250, | |
97 | 97 | resize: true, |
98 | 98 | scroll: true, |
99 | 99 | gutter: '0 5px 0 0' |
@@ -163,7 +163,7 @@ | ||
163 | 163 | |
164 | 164 | $('#right').append('<h2>Property</h2>'); |
165 | 165 | $('#right').append('<div id="property"></div>'); |
166 | - this.property = new App.View.Property( | |
166 | + this.property = new App.View.DataTable( | |
167 | 167 | this, |
168 | 168 | 'property', |
169 | 169 | config.property.url |
@@ -171,7 +171,7 @@ | ||
171 | 171 | |
172 | 172 | $('#right').append('<h2>CSS</h2>'); |
173 | 173 | $('#right').append('<div id="css"></div>'); |
174 | - this.css = new App.View.CSS( | |
174 | + this.css = new App.View.DataTable( | |
175 | 175 | this, |
176 | 176 | 'css', |
177 | 177 | config.css.url |
@@ -272,13 +272,13 @@ | ||
272 | 272 | } |
273 | 273 | |
274 | 274 | /* |
275 | - * App.View.Property | |
275 | + * App.View.DataTable | |
276 | 276 | */ |
277 | - App.View.Property = function() { | |
277 | + App.View.DataTable = function() { | |
278 | 278 | this.init.apply(this, arguments); |
279 | 279 | } |
280 | 280 | |
281 | - App.View.Property.prototype = { | |
281 | + App.View.DataTable.prototype = { | |
282 | 282 | init: function(client, tag_id, url) { |
283 | 283 | this.client = client; |
284 | 284 | this.tag_id = tag_id; |
@@ -286,55 +286,6 @@ | ||
286 | 286 | }, |
287 | 287 | |
288 | 288 | update: function(widget_id) { |
289 | - src = new YAHOO.util.XHRDataSource(this.url + widget_id); | |
290 | - src.responseType = YAHOO.util.DataSource.TYPE_JSON; | |
291 | - src.responseSchema = { | |
292 | - resultsList: 'results', | |
293 | - fields: ['name', 'value'] | |
294 | - } | |
295 | - | |
296 | - YAHOO.widget.DataTable._bStylesheetFallback = !!YAHOO.env.ua.ie; | |
297 | - table = new YAHOO.widget.DataTable( | |
298 | - this.tag_id, | |
299 | - [ | |
300 | - { | |
301 | - key: 'name' | |
302 | - }, | |
303 | - { | |
304 | - key: 'value', | |
305 | - editor: new YAHOO.widget.TextboxCellEditor({disableBtns: true}) | |
306 | - } | |
307 | - ], | |
308 | - src | |
309 | - ); | |
310 | - table.subscribe('cellMouseoverEvent', function(args) { | |
311 | - var cell = args.target; | |
312 | - if(YAHOO.util.Dom.hasClass(cell, 'yui-dt-editable')) { | |
313 | - this.highlightCell(cell); | |
314 | - } | |
315 | - }); | |
316 | - table.subscribe('cellMouseoutEvent', table.onEventUnhighlightCell); | |
317 | - table.subscribe('cellClickEvent', table.onEventShowCellEditor); | |
318 | - }, | |
319 | - | |
320 | - render: function() {} | |
321 | - } | |
322 | - | |
323 | - /* | |
324 | - * App.View.CSS | |
325 | - */ | |
326 | - App.View.CSS = function() { | |
327 | - this.init.apply(this, arguments); | |
328 | - } | |
329 | - | |
330 | - App.View.CSS.prototype = { | |
331 | - init: function(client, tag_id, url) { | |
332 | - this.client = client; | |
333 | - this.tag_id = tag_id; | |
334 | - this.url = url; | |
335 | - }, | |
336 | - | |
337 | - update: function(widget_id) { | |
338 | 289 | var url = this.url + widget_id; |
339 | 290 | |
340 | 291 | src = new YAHOO.util.XHRDataSource(url); |
@@ -21,6 +21,7 @@ | ||
21 | 21 | ak.to_s <=> bk.to_s |
22 | 22 | end.each do |key, val| |
23 | 23 | properties << { |
24 | + 'id' => form_id(key), | |
24 | 25 | 'name' => key, |
25 | 26 | 'value' => val |
26 | 27 | } |
@@ -30,6 +31,17 @@ | ||
30 | 31 | 'results' => properties |
31 | 32 | }) |
32 | 33 | end |
34 | + | |
35 | + def post(query) | |
36 | + query.each do |key, val| | |
37 | + model.content.property[key.to_sym] = if val.empty? | |
38 | + nil | |
39 | + else | |
40 | + val | |
41 | + end | |
42 | + end | |
43 | + model.content.save | |
44 | + end | |
33 | 45 | end |
34 | 46 | end |
35 | 47 | end |
@@ -0,0 +1,120 @@ | ||
1 | +# | |
2 | +# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com> | |
3 | +# | |
4 | + | |
5 | +Tenarai::ClassLoader.load_class('Widget::Widget') | |
6 | + | |
7 | +class Widget | |
8 | + class Widget | |
9 | + class CSS < ::Widget | |
10 | + extend Tenarai::ClassLoader | |
11 | + | |
12 | + CSS = Tenarai::Container.new | |
13 | + CSS << Tenarai::Container::Value.new( | |
14 | + 'font', | |
15 | + [ | |
16 | + 'font-family', | |
17 | + 'font-weight', | |
18 | + 'font-size', | |
19 | + 'font-style', | |
20 | + 'font-variant', | |
21 | + ] | |
22 | + ) | |
23 | + CSS << Tenarai::Container::Value.new( | |
24 | + 'text', | |
25 | + [ | |
26 | + 'color', | |
27 | + 'text-indent', | |
28 | + 'text-align', | |
29 | + 'line-height', | |
30 | + 'vertical-align', | |
31 | + 'word-spacing', | |
32 | + 'letter-spacing', | |
33 | + 'text-transform', | |
34 | + 'text-decoration', | |
35 | + 'white-space', | |
36 | + ] | |
37 | + ) | |
38 | + CSS << Tenarai::Container::Value.new( | |
39 | + 'background', | |
40 | + [ | |
41 | + 'background-color', | |
42 | + 'background-image', | |
43 | + 'background-repeat', | |
44 | + 'background-position', | |
45 | + 'background-attachment', | |
46 | + ] | |
47 | + ) | |
48 | + CSS << Tenarai::Container::Value.new( | |
49 | + 'margin', | |
50 | + [ | |
51 | + 'margin', | |
52 | + 'margin-top', | |
53 | + 'margin-right', | |
54 | + 'margin-bottom', | |
55 | + 'margin-left', | |
56 | + ] | |
57 | + ) | |
58 | + CSS << Tenarai::Container::Value.new( | |
59 | + 'border', | |
60 | + [ | |
61 | + 'border', | |
62 | + 'border-top', | |
63 | + 'border-right', | |
64 | + 'border-bottom', | |
65 | + 'border-left', | |
66 | + ] | |
67 | + ) | |
68 | + CSS << Tenarai::Container::Value.new( | |
69 | + 'padding', | |
70 | + [ | |
71 | + 'padding', | |
72 | + 'padding-top', | |
73 | + 'padding-right', | |
74 | + 'padding-bottom', | |
75 | + 'padding-left', | |
76 | + ] | |
77 | + ) | |
78 | + CSS << Tenarai::Container::Value.new( | |
79 | + 'size', | |
80 | + [ | |
81 | + 'width', | |
82 | + 'height', | |
83 | + 'min-width', | |
84 | + 'min-height', | |
85 | + 'max-width', | |
86 | + 'max-height', | |
87 | + ] | |
88 | + ) | |
89 | + CSS << Tenarai::Container::Value.new( | |
90 | + 'layout', | |
91 | + [ | |
92 | + 'float', | |
93 | + 'clear', | |
94 | + 'position', | |
95 | + 'top', | |
96 | + 'right', | |
97 | + 'bottom', | |
98 | + 'left', | |
99 | + 'overflow', | |
100 | + 'clip', | |
101 | + 'visibility', | |
102 | + 'z-index', | |
103 | + 'display', | |
104 | + ] | |
105 | + ) | |
106 | + CSS << Tenarai::Container::Value.new( | |
107 | + 'list', | |
108 | + [ | |
109 | + 'list-style-type', | |
110 | + ] | |
111 | + ) | |
112 | + CSS << Tenarai::Container::Value.new( | |
113 | + 'ui', | |
114 | + [ | |
115 | + 'cursor', | |
116 | + ] | |
117 | + ) | |
118 | + end | |
119 | + end | |
120 | +end |