• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂49 (tree)
時間2008-02-18 22:21:51
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/Rakefile (revision 48)
+++ trunk/Rakefile (revision 49)
@@ -18,7 +18,7 @@
1818 :host => 'localhost',
1919 :user => 'root',
2020 :password => 'root',
21- :echo => true,
21+ #:echo => true,
2222 },
2323
2424 :server => {
@@ -56,7 +56,7 @@
5656 :class => 'Service',
5757 :row => {'name' => 'user'},
5858 :relation => {
59- 'widget' => 'widget:session.user.content.view.widget.html',
59+ 'widget' => 'widget:session.user.content.view.html',
6060 },
6161 },
6262 ],
@@ -221,15 +221,7 @@
221221 },
222222
223223 {
224- :name => 'session.user.content.view.widget',
225- :class => 'Widget::Widget',
226- :row => {},
227- :relation => {'view' => 'view:resource'},
228- :preference => {}
229- },
230-
231- {
232- :name => 'session.user.content.view.widget.html',
224+ :name => 'session.user.content.view.html',
233225 :class => 'Widget::HTML',
234226 :row => {},
235227 :relation => {'view' => 'view:resource'},
@@ -239,7 +231,7 @@
239231 },
240232
241233 {
242- :name => 'session.user.content.view.widget.html.login',
234+ :name => 'session.user.content.view.html.login',
243235 :class => 'Widget',
244236 :row => {},
245237 :relation => {'view' => 'view:resource.login'},
@@ -247,7 +239,7 @@
247239 },
248240
249241 {
250- :name => 'session.user.content.view.widget.html.login.title',
242+ :name => 'session.user.content.view.html.login.title',
251243 :class => 'Widget::Content::Title',
252244 :row => {},
253245 :relation => {'view' => 'view:resource.login'},
@@ -259,12 +251,12 @@
259251 :row => {},
260252 :relation => {'view' => 'view:resource.login'},
261253 :preference => {
262- 'yui.reset_fonts_grids.url' => 'http://localhost/yui/build/reset-fonts-grids/reset-fonts-grids.css',
254+ 'yui.reset_fonts_grids.url' => 'http://localhost/pub/yui-2.4.1/build/reset-fonts-grids/reset-fonts-grids.css',
263255 }
264256 },
265257 =end
266258 {
267- :name => 'session.user.content.view.widget.html.login.header',
259+ :name => 'session.user.content.view.html.login.header',
268260 :class => 'Widget::Content::Header',
269261 :row => {},
270262 :relation => {'view' => 'view:resource.login'},
@@ -271,7 +263,7 @@
271263 },
272264
273265 {
274- :name => 'session.user.content.view.widget.html.login.login_form',
266+ :name => 'session.user.content.view.html.login.login_form',
275267 :class => 'Widget::User::LoginForm',
276268 :row => {},
277269 :relation => {'view' => 'view:resource.login'},
@@ -278,7 +270,7 @@
278270 },
279271
280272 {
281- :name => 'session.user.content.view.widget.html.admin',
273+ :name => 'session.user.content.view.html.admin',
282274 :class => 'Widget',
283275 :row => {},
284276 :relation => {'view' => 'view:resource.admin'},
@@ -286,7 +278,7 @@
286278 },
287279
288280 {
289- :name => 'session.user.content.view.widget.html.admin.logout',
281+ :name => 'session.user.content.view.html.admin.logout',
290282 :class => 'Widget::User::Logout',
291283 :row => {},
292284 :relation => {'view' => 'view:resource.admin'},
@@ -293,7 +285,7 @@
293285 },
294286
295287 {
296- :name => 'session.user.content.view.widget.html.admin.title',
288+ :name => 'session.user.content.view.html.admin.title',
297289 :class => 'Widget::Content::Title',
298290 :row => {},
299291 :relation => {'view' => 'view:resource.admin'},
@@ -300,17 +292,17 @@
300292 },
301293 =begin
302294 {
303- :name => 'session.user.content.view.widget.html.admin.reset_style',
295+ :name => 'session.user.content.view.html.admin.reset_style',
304296 :class => 'Widget::YUI::ResetFontsGrids',
305297 :row => {},
306298 :relation => {'view' => 'view:resource.admin'},
307299 :preference => {
308- 'yui.reset_fonts_grids.url' => 'http://localhost/yui/build/reset-fonts-grids/reset-fonts-grids.css',
300+ 'yui.reset_fonts_grids.url' => 'http://localhost/pub/yui-2.4.1/build/reset-fonts-grids/reset-fonts-grids.css',
309301 }
310302 },
311303 =end
312304 {
313- :name => 'session.user.content.view.widget.html.admin.header',
305+ :name => 'session.user.content.view.html.admin.header',
314306 :class => 'Widget::Content::Header',
315307 :row => {},
316308 :relation => {'view' => 'view:resource.admin'},
@@ -317,7 +309,7 @@
317309 },
318310
319311 {
320- :name => 'session.user.content.view.widget.html.admin.tab',
312+ :name => 'session.user.content.view.html.admin.tab',
321313 :class => 'Widget::Content::Tab',
322314 :row => {},
323315 :relation => {'view' => 'view:resource.admin'},
@@ -324,7 +316,7 @@
324316 },
325317
326318 {
327- :name => 'session.user.content.view.widget.html.admin.path',
319+ :name => 'session.user.content.view.html.admin.path',
328320 :class => 'Widget::Content::Path',
329321 :row => {},
330322 :relation => {'view' => 'view:resource.admin'},
@@ -331,7 +323,7 @@
331323 },
332324
333325 {
334- :name => 'session.user.content.view.widget.html.admin.list',
326+ :name => 'session.user.content.view.html.admin.list',
335327 :class => 'Widget::Content::List',
336328 :row => {},
337329 :relation => {'view' => 'view:resource.admin'},
@@ -338,7 +330,7 @@
338330 },
339331
340332 {
341- :name => 'session.user.content.view.widget.html.admin.newform',
333+ :name => 'session.user.content.view.html.admin.newform',
342334 :class => 'Widget::Content::Form',
343335 :row => {},
344336 :relation => {'view' => 'view:resource.admin'},
@@ -346,7 +338,7 @@
346338 },
347339
348340 {
349- :name => 'session.user.content.view.widget.html.admin.editform',
341+ :name => 'session.user.content.view.html.admin.editform',
350342 :class => 'Widget::Content::Form',
351343 :row => {},
352344 :relation => {'view' => 'view:resource.admin'},
@@ -354,7 +346,7 @@
354346 },
355347
356348 {
357- :name => 'session.user.content.view.widget.html.admin.view',
349+ :name => 'session.user.content.view.html.admin.view',
358350 :class => 'Widget::View::List',
359351 :row => {},
360352 :relation => {'view' => 'view:resource.admin'},
@@ -361,7 +353,15 @@
361353 },
362354
363355 {
364- :name => 'session.user.content.view.widget.html.admin.widget',
356+ :name => 'session.user.content.view.html.admin.widget',
357+ :class => 'Widget::Widget',
358+ :row => {},
359+ :relation => {'view' => 'view:resource.admin'},
360+ :preference => {}
361+ },
362+
363+ {
364+ :name => 'session.user.content.view.html.admin.widget.list',
365365 :class => 'Widget::Widget::List',
366366 :row => {},
367367 :relation => {'view' => 'view:resource.admin'},
@@ -368,7 +368,7 @@
368368 },
369369
370370 {
371- :name => 'session.user.content.view.widget.html.admin.panel',
371+ :name => 'session.user.content.view.html.admin.panel',
372372 :class => 'Widget::Panel',
373373 :row => {},
374374 :relation => {'view' => 'view:resource.admin'},
@@ -384,7 +384,7 @@
384384 },
385385
386386 {
387- :name => 'session.user.content.view.widget.html.admin.panel.panel',
387+ :name => 'session.user.content.view.html.admin.panel.panel',
388388 :class => 'Widget::Panel',
389389 :row => {},
390390 :relation => {'view' => 'view:resource.admin'},
@@ -398,6 +398,25 @@
398398 'box.background.background_color' => 'green',
399399 }
400400 },
401+
402+ {
403+ :name => 'session.user.content.view.html.admin.jquery',
404+ :class => 'Widget::JQuery',
405+ :row => {},
406+ :relation => {'view' => 'view:resource.admin'},
407+ :preference => {}
408+ },
409+
410+ {
411+ :name => 'session.user.content.view.html.admin.gmaps',
412+ :class => 'Widget::GoogleMaps',
413+ :row => {},
414+ :relation => {'view' => 'view:resource.admin'},
415+ :preference => {
416+ 'box.size.width' => '500px',
417+ 'box.size.height' => '500px',
418+ }
419+ },
401420 ],
402421 }
403422
--- trunk/webapp/Widget/GoogleMaps.rb (nonexistent)
+++ trunk/webapp/Widget/GoogleMaps.rb (revision 49)
@@ -0,0 +1,47 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget')
6+
7+class Widget
8+ class GoogleMaps < ::Widget
9+ extend Tenarai::ClassLoader
10+
11+ preference_css 'box'
12+
13+ preference 'preference' do |pref|
14+ pref.group 'googlemaps' do |gmap|
15+ gmap.edit 'key' do |key|
16+ key.value = 'ABQIAAAAfZwvb09MEQqvWKTm8jvLtRTwM0brOpm-All5BF6PoaKBxRWWERRia6i9gSHSmIyQL2x1OB3bLqIzNQ'
17+ end
18+ end
19+ end
20+
21+ def render_html_head(xml, builder)
22+ xml.tag(
23+ 'script',
24+ 'type'=> 'text/javascript',
25+ 'src' => 'http://maps.google.com/maps?file=api&amp;v=2&amp;key=%s' % preference.preference.googlemaps.key.value
26+ ).text('')
27+ end
28+
29+ def render_html(xml, builder)
30+ xml.tag('div', 'id' => html_id).text('')
31+ xml.tag('script', 'type' => 'text/javascript') do |js|
32+ js.code <<-END
33+$(document).ready(function() {
34+ if(GBrowserIsCompatible()) {
35+ var map = new GMap2(document.getElementById('#{html_id}'));
36+ map.setCenter(new GLatLng(37.4419, -122.1419), 13);
37+ }
38+});
39+
40+$(document).unload(function() {
41+ GUnload();
42+});
43+ END
44+ end
45+ end
46+ end
47+end
--- trunk/webapp/Widget/Panel.rb (revision 48)
+++ trunk/webapp/Widget/Panel.rb (revision 49)
@@ -12,7 +12,11 @@
1212
1313 def render_html(xml, builder)
1414 xml.tag('div', 'id' => html_id) do |div|
15- super(div, builder)
15+ if builder.empty?(self)
16+ div.text('')
17+ else
18+ super(div, builder)
19+ end
1620 end
1721 end
1822 end
--- trunk/webapp/Widget/JQuery.rb (nonexistent)
+++ trunk/webapp/Widget/JQuery.rb (revision 49)
@@ -0,0 +1,27 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget')
6+
7+class Widget
8+ class JQuery < ::Widget
9+ extend Tenarai::ClassLoader
10+
11+ preference 'jquery' do |jquery|
12+ jquery.group 'js' do |js|
13+ js.edit 'url' do |url|
14+ url.value = 'http://localhost/pub/jquery-1.2.3.js'
15+ end
16+ end
17+ end
18+
19+ def render_html_head(xml, builder)
20+ xml.tag(
21+ 'script',
22+ 'type' => 'text/javascript',
23+ 'src' => preference.jquery.js.url.value
24+ ).text('')
25+ end
26+ end
27+end
--- trunk/webapp/Widget/HTML.rb (revision 48)
+++ trunk/webapp/Widget/HTML.rb (revision 49)
@@ -8,7 +8,7 @@
88 class HTML < Resource
99 extend Tenarai::ClassLoader
1010
11- resource 'Widget::Widget'
11+ resource 'Widget::View'
1212 preference_css 'box'
1313
1414 def init(service, markup='html')
@@ -28,14 +28,14 @@
2828 end
2929
3030 def get(service, query={})
31- unless resource.resource.content.nil?
32- service.response.content << resource.resource.content.__send__('to_' + @markup)
31+ unless resource.content.nil?
32+ service.response.content << resource.content.__send__('to_' + @markup)
3333 end
3434 end
3535
3636 def post(service, query={})
3737 unless resource.resource.content.nil?
38- service.response.content << resource.resource.content.__send__('to_' + @markup)
38+ service.response.content << resource.content.__send__('to_' + @markup)
3939 end
4040 end
4141
--- trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 48)
+++ trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 49)
@@ -10,7 +10,7 @@
1010 preference 'yui' do |yui|
1111 yui.group 'reset_fonts_grids' do |rfg|
1212 rfg.edit 'url' do |url|
13- url.value = 'http://yui.yahooapis.com/2.3.1/build/reset-fonts-grids/reset-fonts-grids.css'
13+ url.value = 'http://yui.yahooapis.com/2.4.1/build/reset-fonts-grids/reset-fonts-grids.css'
1414 end
1515 end
1616 end
--- trunk/webapp/View/Builder.rb (revision 48)
+++ trunk/webapp/View/Builder.rb (revision 49)
@@ -56,13 +56,13 @@
5656 def to_css
5757 Tenarai::CSS.new do |css|
5858 widget.render_css(css, self)
59- end.to_s(0)
59+ end.to_s(2)
6060 end
6161
6262 def to_html
6363 Tenarai::XML.new do |xml|
6464 widget.render_html(xml, self)
65- end.to_s(0)
65+ end.to_s(2)
6666 end
6767 end
6868 end
Show on old repository browser