• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂27 (tree)
時間2007-11-27 23:14:47
作者junkikuchi

Log Message

updated widgets.

Change Summary

差異

--- trunk/Rakefile (revision 26)
+++ trunk/Rakefile (revision 27)
@@ -138,6 +138,62 @@
138138 },
139139 :relations => {'view' => 'views:index_root.index'},
140140 },
141+
142+ ### text contents
143+ {
144+ :name => 'index_root.index.a',
145+ :class => 'Content',
146+ :row => {
147+ 'title' => 'a',
148+ 'body' => 'A',
149+ },
150+ :relations => {'view' => 'views:index_root.index'},
151+ },
152+ {
153+ :name => 'index_root.index.a.a1',
154+ :class => 'Content',
155+ :row => {
156+ 'title' => 'a1',
157+ 'body' => 'A1',
158+ },
159+ :relations => {'view' => 'views:index_root.index'},
160+ },
161+ {
162+ :name => 'index_root.index.a.a2',
163+ :class => 'Content',
164+ :row => {
165+ 'title' => 'a2',
166+ 'body' => 'A2',
167+ },
168+ :relations => {'view' => 'views:index_root.index'},
169+ },
170+ {
171+ :name => 'index_root.index.a.a3',
172+ :class => 'Content',
173+ :row => {
174+ 'title' => 'a3',
175+ 'body' => 'A3',
176+ },
177+ :relations => {'view' => 'views:index_root.index'},
178+ },
179+ {
180+ :name => 'index_root.index.b',
181+ :class => 'Content',
182+ :row => {
183+ 'title' => 'b',
184+ 'body' => 'B',
185+ },
186+ :relations => {'view' => 'views:index_root.index'},
187+ },
188+ {
189+ :name => 'index_root.index.c',
190+ :class => 'Content',
191+ :row => {
192+ 'title' => 'c',
193+ 'body' => 'C',
194+ },
195+ :relations => {'view' => 'views:index_root.index'},
196+ },
141197 ],
142198
143199 'views' => [
@@ -322,6 +378,72 @@
322378 'tab_hover.background.background_color' => '#c3d9ff',
323379 }
324380 },
381+ {
382+ :name => 'admin.html.content',
383+ :class => 'Widget::Content',
384+ :row => {},
385+ :relations => {'view' => 'views:admin_root.admin.content'},
386+ :preference => {
387+ 'content' => :'contents:index_root'
388+ }
389+ },
390+ {
391+ :name => 'admin.html.content.menu',
392+ :class => 'Widget::Content::AdminMenu',
393+ :row => {},
394+ :relations => {'view' => 'views:admin_root.admin.content'},
395+ :preference => {
396+ 'box.border.border_top' => 'solid 5px #c3d9ff',
397+ 'box.border.border_right' => 'solid 5px #c3d9ff',
398+ #'box.border.border_bottom' => 'solid 5px #c3d9ff',
399+ 'box.border.border_left' => 'solid 5px #c3d9ff',
400+ 'menu.padding.padding_top' => '5px',
401+ 'menu.padding.padding_right' => '5px',
402+ 'menu.padding.padding_bottom' => '5px',
403+ 'menu.padding.padding_left' => '5px',
404+ }
405+ },
406+ {
407+ :name => 'admin.html.content.path',
408+ :class => 'Widget::Content::Path',
409+ :row => {},
410+ :relations => {'view' => 'views:admin_root.admin.content'},
411+ :preference => {
412+ 'box.border.border_top' => 'solid 5px #c3d9ff',
413+ 'box.border.border_right' => 'solid 5px #c3d9ff',
414+ #'box.border.border_bottom' => 'solid 5px #c3d9ff',
415+ 'box.border.border_left' => 'solid 5px #c3d9ff',
416+ 'box.padding.padding_top' => '5px',
417+ 'box.padding.padding_right' => '5px',
418+ 'box.padding.padding_bottom' => '5px',
419+ 'box.padding.padding_left' => '5px',
420+ 'box.background.background_color' => '#e8eef7',
421+ 'path.margin.margin_right' => '5px',
422+ }
423+ },
424+ {
425+ :name => 'admin.html.content.admin_list',
426+ :class => 'Widget::Content::AdminList',
427+ :row => {},
428+ :relations => {'view' => 'views:admin_root.admin.content'},
429+ :preference => {
430+ 'box.padding.padding_top' => '5px',
431+ 'box.padding.padding_right' => '5px',
432+ #'box.padding.padding_bottom' => '5px',
433+ 'box.padding.padding_left' => '5px',
434+ 'header.background.background_color' => '#e8eef7',
435+ 'header.padding.padding_top' => '3px',
436+ 'header.padding.padding_right' => '3px',
437+ 'header.padding.padding_bottom' => '3px',
438+ 'header.padding.padding_left' => '3px',
439+ 'body.background.background_color' => '#ffffff',
440+ 'body.border.border_bottom' => 'solid 1px #e8eef7',
441+ 'body.padding.padding_top' => '3px',
442+ 'body.padding.padding_right' => '3px',
443+ 'body.padding.padding_bottom' => '3px',
444+ 'body.padding.padding_left' => '3px',
445+ }
446+ },
325447
326448 {
327449 :name => 'index',
@@ -394,6 +516,11 @@
394516 end if v[:relations]
395517
396518 v[:preference].each do |pk, pv|
519+ if pv.is_a? Symbol
520+ mk, mv = pv.to_s.split(':')
521+ pv = m[mk][mv].primary_key.to_s
522+ end
523+
397524 a = m[key][v[:name]]
398525 if pref = a.preference.find(pk)
399526 pref.value = pv
--- trunk/webapp/Widget/Content/AdminMenu.rb (nonexistent)
+++ trunk/webapp/Widget/Content/AdminMenu.rb (revision 27)
@@ -0,0 +1,24 @@
1+#
2+# Copyright (C) 2007 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget::Content')
6+
7+class Widget
8+ class Content
9+ class AdminMenu < Widget
10+ extend Tenarai::ClassLoader
11+
12+ preference_css 'box'
13+ preference_css 'menu', 'span'
14+
15+ def render_body(xml)
16+ xml.tag('div', 'id' => html_id) do |div|
17+ div.tag('span').text('New')
18+ div.tag('span').text('Edit')
19+ div.tag('span').text('Delete')
20+ end
21+ end
22+ end
23+ end
24+end
--- trunk/webapp/Widget/Content/AdminList.rb (nonexistent)
+++ trunk/webapp/Widget/Content/AdminList.rb (revision 27)
@@ -0,0 +1,50 @@
1+#
2+# Copyright (C) 2007 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget::Content')
6+
7+class Widget
8+ class Content
9+ class AdminList < Widget
10+ extend Tenarai::ClassLoader
11+
12+ preference_css 'box'
13+ preference_css 'header', 'th'
14+ preference_css 'body', 'td'
15+
16+ def render_css(css)
17+ super
18+ css.style(css_id + ' table') do |s|
19+ s['width'] = '100%'
20+ end
21+ end
22+
23+ def render_body(xml)
24+ xml.tag('div', 'id' => html_id) do |div|
25+ div.tag('table') do |table|
26+ table.tag('thead') do |thead|
27+ thead.tag('tr') do |tr|
28+ tr.tag('th').text('ID')
29+ tr.tag('th').text('Title')
30+ tr.tag('th').text('View')
31+ end
32+ end
33+ table.tag('tbody') do |tbody|
34+ model.content.nodes.each do |val|
35+ tbody.tag('tr') do |tr|
36+ tr.tag('td').text(val.id)
37+ tr.tag('td').tag(
38+ 'a',
39+ 'href' => url(:content => val)
40+ ).text(val.title)
41+ tr.tag('td').text(if val.view then val.view.name end)
42+ end
43+ end
44+ end
45+ end
46+ end
47+ end
48+ end
49+ end
50+end
--- trunk/webapp/Widget/Content/Path.rb (revision 26)
+++ trunk/webapp/Widget/Content/Path.rb (revision 27)
@@ -9,6 +9,7 @@
99 class Path < Widget
1010 extend Tenarai::ClassLoader
1111
12+ preference_css 'box'
1213 preference_css 'path', 'a'
1314 preference_css 'path_selected', 'a.selected'
1415 preference_css 'path_hover', 'a:hover'
Show on old repository browser