• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂59 (tree)
時間2008-03-14 01:04:26
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/Rakefile (revision 58)
+++ trunk/Rakefile (revision 59)
@@ -297,13 +297,13 @@
297297
298298 {
299299 :name => 'session.user.content.view.html.admin.bd.user',
300- :class => 'Widget::User',
300+ :class => 'Widget::UserAdmin',
301301 :row => {},
302302 :relation => {'view' => 'view:resource.admin.user'},
303303 },
304304 {
305305 :name => 'session.user.content.view.html.admin.bd.user.list',
306- :class => 'Widget::User::List',
306+ :class => 'Widget::UserAdmin::List',
307307 :row => {},
308308 :relation => {'view' => 'view:resource.admin.user'},
309309 :preference => {}
--- trunk/webapp/Service.rb (revision 58)
+++ trunk/webapp/Service.rb (revision 59)
@@ -88,8 +88,10 @@
8888 end
8989
9090 rs.inject({}) do |ret, (wid, val)|
91- w = @model['widget'].fetch(wid)
92- ret[w] = val unless w.nil?
91+ if w = @model['widget'].fetch(wid)
92+ w.service = self
93+ ret[w] = val
94+ end
9395 ret
9496 end.sort do |(aw, aval), (bw, bval)|
9597 aw.min <=> bw.min
@@ -102,6 +104,7 @@
102104
103105 ws.each do |wid, query|
104106 if w = @model['widget'].fetch(wid)
107+ w.service = self
105108 w.__send__(method, self, query)
106109 end
107110 end
--- trunk/webapp/Widget/UserAdmin/List.rb (nonexistent)
+++ trunk/webapp/Widget/UserAdmin/List.rb (revision 59)
@@ -0,0 +1,40 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget::UserAdmin')
6+
7+class Widget
8+ class UserAdmin
9+ class List < ::Widget
10+ extend Tenarai::ClassLoader
11+
12+ preference_css 'box'
13+ preference_css 'head', 'thead th'
14+ preference_css 'body', 'tbody td'
15+
16+ def render_html(xml, builder, content=nil)
17+ xml.tag('div', 'id' => html_id) do |div|
18+ div.tag('table') do |table|
19+ table.tag('thead') do |th|
20+ th.tag('tr') do |th|
21+ th.tag('th').text('id')
22+ th.tag('th').text('name')
23+ th.tag('th').text('active')
24+ end
25+ end
26+ table.tag('tbody') do |tb|
27+ resource.each do |user|
28+ tb.tag('tr') do |th|
29+ th.tag('td').text(user.id)
30+ th.tag('td').text(user.name)
31+ th.tag('td').text(user.active)
32+ end
33+ end
34+ end
35+ end
36+ end
37+ end
38+ end
39+ end
40+end
--- trunk/webapp/Widget/UserAdmin.rb (nonexistent)
+++ trunk/webapp/Widget/UserAdmin.rb (revision 59)
@@ -0,0 +1,22 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Resource')
6+
7+class Widget
8+ class UserAdmin < Resource
9+ extend Tenarai::ClassLoader
10+
11+ def new(row)
12+ u = ::User.new(@service.model['user'])
13+ u.name = row['name']
14+ u.password = row['password']
15+ u.save
16+ end
17+
18+ def each(&block)
19+ @service.model['user'].each(&block)
20+ end
21+ end
22+end
--- trunk/webapp/Widget/View.rb (revision 58)
+++ trunk/webapp/Widget/View.rb (revision 59)
@@ -15,8 +15,9 @@
1515
1616 unless resource.content.view.include?(@content)
1717 @content = resource.content.view
18- @content.widget.load(@service)
1918 end unless resource.content.nil?
19+
20+ @content.widget.load(@service)
2021 end
2122 end
2223 end
--- trunk/webapp/Widget.rb (revision 58)
+++ trunk/webapp/Widget.rb (revision 59)
@@ -84,7 +84,11 @@
8484 'visibility',
8585 'z_index',
8686 'display',
87- ]
87+ ],
88+
89+ 'ui' => [
90+ 'cursor'
91+ ],
8892 }
8993
9094 class << self
@@ -141,8 +145,17 @@
141145 self.class.fetch_resource(self)
142146 end
143147
148+ def _build_url(param, _resource, _query)
149+ if parent.nil?
150+ @service
151+ else
152+ parent
153+ end._build_url([], _resource, _query)
154+ end
155+
144156 def url(*param, &block)
145- resource.url(*param, &block)
157+ #resource.url(*param, &block)
158+ parent.url(*param, &block)
146159 end
147160
148161 def init(*param)
--- trunk/webapp/Resource.rb (revision 58)
+++ trunk/webapp/Resource.rb (revision 59)
@@ -34,11 +34,7 @@
3434 _query[html_id] = _param
3535 end
3636
37- if resource.nil?
38- @service
39- else
40- resource
41- end._build_url([], _resource, _query)
37+ super
4238 end
4339
4440 def url(*param, &block)
Show on old repository browser