• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂68 (tree)
時間2008-04-01 22:41:14
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/webapp/Widget/GoogleMaps.rb (revision 67)
+++ trunk/webapp/Widget/GoogleMaps.rb (nonexistent)
@@ -1,47 +0,0 @@
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/GMap.rb (nonexistent)
+++ trunk/webapp/Widget/GMap.rb (revision 68)
@@ -0,0 +1,52 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget')
6+
7+class Widget
8+ class GMap < ::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.addControl(new GLargeMapControl());
37+ map.addControl(new GScaleControl());
38+ map.addControl(new GMapTypeControl());
39+ map.addControl(new GOverviewMapControl());
40+ map.setCenter(new GLatLng(37.4419, -122.1419), 13);
41+ map.enableScrollWheelZoom();
42+ }
43+});
44+
45+$(document).unload(function() {
46+ GUnload();
47+});
48+ END
49+ end
50+ end
51+ end
52+end
--- trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 67)
+++ trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 68)
@@ -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.4.1/build/reset-fonts-grids/reset-fonts-grids.css'
13+ url.value = 'http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css'
1414 end
1515 end
1616 end
--- trunk/webapp/Widget/HTML.rb (revision 67)
+++ trunk/webapp/Widget/HTML.rb (revision 68)
@@ -10,7 +10,8 @@
1010
1111 resource 'Widget::View'
1212
13- preference_css 'box'
13+ preference_css 'html', 'html'
14+ preference_css 'body', 'body'
1415
1516 def init(markup='html')
1617 case markup
@@ -40,6 +41,13 @@
4041 end
4142 end
4243
44+ def render_css(css, builder)
45+ render_preference_css(css)
46+ builder.each(self) do |w|
47+ w.render_css(css, builder)
48+ end
49+ end
50+
4351 def render_html(xml, builder)
4452 xml.xml('1.0', 'utf-8')
4553 xml.doctype(
--- trunk/webapp/Widget.rb (revision 67)
+++ trunk/webapp/Widget.rb (revision 68)
@@ -174,12 +174,12 @@
174174 end
175175 end
176176
177- def render_preference_css(css, css_id)
177+ def render_preference_css(css, _css_id='')
178178 self.class.meta[:preference_css].each do |prefcss|
179179 preference[prefcss[:name]].each do |val|
180180 val.each do |v|
181181 prefcss[:selector].each do |selector|
182- css.selector(css_id + ' ' + selector) do |style|
182+ css.selector(_css_id + ' ' + selector) do |style|
183183 style[v.name.gsub('_', '-')] = v.value unless v.value.to_s.empty?
184184 end
185185 end
--- trunk/webapp/TrackLog.rb (nonexistent)
+++ trunk/webapp/TrackLog.rb (revision 68)
@@ -0,0 +1,18 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+class TrackLog < Tenarai::DB::Row
6+ extend Tenarai::ClassLoader
7+
8+ class << self
9+ def create_row(class_name, table, row)
10+ Tenarai::ClassLoader[class_name].new(table, row)
11+ end
12+ end
13+
14+ column Tenarai::DB::Date.new('log_date')
15+ column Tenarai::DB::Float.new('lat', :precision => 10, :scale => 6)
16+ column Tenarai::DB::Float.new('lng', :precision => 10, :scale => 6)
17+ column Tenarai::DB::Reference.new('content')
18+end
--- trunk/webapp/Content.rb (revision 67)
+++ trunk/webapp/Content.rb (revision 68)
@@ -14,6 +14,8 @@
1414 end
1515
1616 column Tenarai::DB::String.new('title', :length => 255)
17+ column Tenarai::DB::String.new('mime_type', :length => 255)
1718 column Tenarai::DB::String.new('body')
1819 column Tenarai::DB::Reference.new('view')
20+ column Tenarai::DB::Reference.new('tracklog', :multiple => true)
1921 end
Show on old repository browser