• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂79 (tree)
時間2008-04-15 18:51:41
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/init_model.rb (revision 78)
+++ trunk/init_model.rb (revision 79)
@@ -167,9 +167,7 @@
167167 :class => 'Widget::YUI::ResetFontsGrids',
168168 :row => {},
169169 :relation => {'view' => 'view:resource.index'},
170- :preference => {
171- 'yui.src.uri' => 'http://localhost/pub/yui-2.4.1/build/reset-fonts-grids/reset-fonts-grids.css'
172- }
170+ :preference => {}
173171 },
174172 {
175173 :name => 'session.user.content.view.html.doc',
@@ -204,8 +202,8 @@
204202 :preference => {}
205203 },
206204 {
207- :name => 'session.user.content.view.html.doc.hd.menu',
208- :class => 'Widget::View::Menu',
205+ :name => 'session.user.content.view.html.doc.hd.list',
206+ :class => 'Widget::View::List',
209207 :row => {},
210208 :relation => {'view' => 'view:resource.index'},
211209 :preference => {
@@ -212,7 +210,7 @@
212210 'ul.text.text_align' => 'right',
213211 'ul.padding.padding_bottom' => '5px',
214212
215- 'li.layout.display' => 'inline',
213+ 'ul_li.layout.display' => 'inline',
216214
217215 'a.text.text_decoration' => 'none',
218216
@@ -243,8 +241,8 @@
243241 }
244242 },
245243 {
246- :name => 'session.user.content.view.html.doc.bd.sidebar.list',
247- :class => 'Widget::Content::List',
244+ :name => 'session.user.content.view.html.doc.bd.sidebar.tree',
245+ :class => 'Widget::Content::Tree',
248246 :row => {},
249247 :relation => {'view' => 'view:resource.index'},
250248 :preference => {
--- trunk/main.rb (revision 78)
+++ trunk/main.rb (revision 79)
@@ -137,6 +137,11 @@
137137 Main.new(CONFIG).uninstall
138138 when 'load'
139139 Main.new(CONFIG).load
140+when 'reload'
141+ main = Main.new(CONFIG)
142+ main.uninstall
143+ main.install
144+ main.load
140145 when 'cgi'
141146 Main.new(CONFIG).cgi
142147 when 'mongrel'
--- trunk/webapp/Widget/JQuery.rb (revision 78)
+++ trunk/webapp/Widget/JQuery.rb (revision 79)
@@ -11,7 +11,7 @@
1111 preference 'jquery' do |jquery|
1212 jquery.group 'js' do |js|
1313 js.edit 'uri' do |uri|
14- uri.value = 'http://localhost/pub/jquery-1.2.3.js'
14+ uri.value = '/jquery-1.2.3.min.js'
1515 end
1616 end
1717 end
--- trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 78)
+++ trunk/webapp/Widget/YUI/ResetFontsGrids.rb (revision 79)
@@ -10,7 +10,7 @@
1010 preference 'yui' do |yui|
1111 yui.group 'src' do |rfg|
1212 rfg.edit 'uri' do |uri|
13- uri.value = 'http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css'
13+ uri.value = '/yui/build/reset-fonts-grids/reset-fonts-grids.css'
1414 end
1515 end
1616 end
--- trunk/webapp/Widget/View/Menu.rb (revision 78)
+++ trunk/webapp/Widget/View/Menu.rb (nonexistent)
@@ -1,38 +0,0 @@
1-#
2-# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3-#
4-
5-Tenarai::ClassLoader.load_class('Widget::View')
6-
7-class Widget
8- class View
9- class Menu < ::Widget
10- extend Tenarai::ClassLoader
11-
12- preference_css 'box'
13- preference_css 'ul', 'ul'
14- preference_css 'li', 'li'
15- preference_css 'a', 'a'
16- preference_css 'a_selected', 'a.selected'
17- preference_css 'a_hover', 'a:hover'
18-
19- def render_html(xml, builder, content=nil)
20- content = resource.content.parent if content.nil?
21-
22- xml.tag('div', 'id' => html_id) do |div|
23- div.tag('ul') do |ul|
24- content.node.each do |c|
25- ul.tag('li') do |li|
26- li.tag('a') do |a|
27- a['href'] = uri(c.id)
28- a['class'] = 'selected' if resource.content.equal?(c)
29- end.text(c.name)
30- render_html(li, builder, c) unless c.node.empty?
31- end
32- end
33- end
34- end
35- end
36- end
37- end
38-end
--- trunk/webapp/Widget/View/Tree.rb (nonexistent)
+++ trunk/webapp/Widget/View/Tree.rb (revision 79)
@@ -0,0 +1,49 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget::View')
6+
7+class Widget
8+ class View
9+ class Tree < ::Widget
10+ extend Tenarai::ClassLoader
11+
12+ preference_css 'box'
13+ preference_list
14+
15+ def render_html(xml, builder, content=nil)
16+ if content.nil?
17+ content = resource.content.root
18+ xml.tag('div', 'id' => html_id) do |div|
19+ div.tag('ul') do |ul|
20+ ul.tag('li') do |li|
21+ li.tag('a') do |a|
22+ a['href'] = uri(content.id)
23+ a['class'] = 'selected' if resource.content.equal?(content)
24+ end.text(content.name)
25+ if resource.content.path.include?(content)
26+ render_html(li, builder, content)
27+ end unless content.node.empty?
28+ end
29+ end
30+ end
31+ else
32+ xml.tag('ul') do |ul|
33+ content.node.each do |c|
34+ ul.tag('li') do |li|
35+ li.tag('a') do |a|
36+ a['href'] = uri(c.id)
37+ a['class'] = 'selected' if resource.content.equal?(c)
38+ end.text(c.name)
39+ if resource.content.path.include?(c)
40+ render_html(li, builder, c)
41+ end unless c.node.empty?
42+ end
43+ end
44+ end
45+ end
46+ end
47+ end
48+ end
49+end
--- trunk/webapp/Widget/View/List.rb (revision 78)
+++ trunk/webapp/Widget/View/List.rb (revision 79)
@@ -10,28 +10,13 @@
1010 extend Tenarai::ClassLoader
1111
1212 preference_css 'box'
13- preference_css 'list', 'a'
14- preference_css 'list_selected', 'a.selected'
15- preference_css 'list_hover', 'a:hover'
13+ preference_list
1614
1715 def render_html(xml, builder, content=nil)
18- if content.nil?
19- content = resource.content.root
20- xml.tag('div', 'id' => html_id) do |div|
21- div.tag('ul') do |ul|
22- ul.tag('li') do |li|
23- li.tag('a') do |a|
24- a['href'] = uri(content.id)
25- a['class'] = 'selected' if resource.content.equal?(content)
26- end.text(content.name)
27- if resource.content.path.include?(content)
28- render_html(li, builder, content)
29- end unless content.node.empty?
30- end
31- end
32- end
33- else
34- xml.tag('ul') do |ul|
16+ content = resource.content.parent if content.nil?
17+
18+ xml.tag('div', 'id' => html_id) do |div|
19+ div.tag('ul') do |ul|
3520 content.node.each do |c|
3621 ul.tag('li') do |li|
3722 li.tag('a') do |a|
@@ -38,9 +23,7 @@
3823 a['href'] = uri(c.id)
3924 a['class'] = 'selected' if resource.content.equal?(c)
4025 end.text(c.name)
41- if resource.content.path.include?(c)
42- render_html(li, builder, c)
43- end unless c.node.empty?
26+ render_html(li, builder, c) unless c.node.empty?
4427 end
4528 end
4629 end
--- trunk/webapp/Widget/Content/List.rb (revision 78)
+++ trunk/webapp/Widget/Content/List.rb (nonexistent)
@@ -1,54 +0,0 @@
1-#
2-# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3-#
4-
5-Tenarai::ClassLoader.load_class('Widget::Content')
6-
7-class Widget
8- class Content
9- class List < ::Widget
10- extend Tenarai::ClassLoader
11-
12- preference_css 'box'
13- preference_css 'ul', 'ul'
14- preference_css 'li_ul', 'li ul'
15- preference_css 'ul_li', 'ul li'
16- preference_css 'a', 'a'
17- preference_css 'a_selected', 'a.selected'
18- preference_css 'a_hover', 'a:hover'
19-
20- def render_html(xml, builder, content=nil)
21- if content.nil?
22- content = resource.content.root
23- xml.tag('div', 'id' => html_id) do |div|
24- div.tag('ul') do |ul|
25- ul.tag('li') do |li|
26- li.tag('a') do |a|
27- a['href'] = uri(content.id)
28- a['class'] = 'selected' if resource.content.equal?(content)
29- end.text(content.title)
30- if resource.content.path.include?(content)
31- render_html(li, builder, content)
32- end unless content.node.empty?
33- end
34- end
35- end
36- else
37- xml.tag('ul') do |ul|
38- content.node.each do |c|
39- ul.tag('li') do |li|
40- li.tag('a') do |a|
41- a['href'] = uri(c.id)
42- a['class'] = 'selected' if resource.content.equal?(c)
43- end.text(c.title)
44- if resource.content.path.include?(c)
45- render_html(li, builder, c)
46- end unless c.node.empty?
47- end
48- end
49- end
50- end
51- end
52- end
53- end
54-end
--- trunk/webapp/Widget/Content/Tree.rb (nonexistent)
+++ trunk/webapp/Widget/Content/Tree.rb (revision 79)
@@ -0,0 +1,49 @@
1+#
2+# Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
3+#
4+
5+Tenarai::ClassLoader.load_class('Widget::Content')
6+
7+class Widget
8+ class Content
9+ class Tree < ::Widget
10+ extend Tenarai::ClassLoader
11+
12+ preference_css 'box'
13+ preference_list
14+
15+ def render_html(xml, builder, content=nil)
16+ if content.nil?
17+ content = resource.content.root
18+ xml.tag('div', 'id' => html_id) do |div|
19+ div.tag('ul') do |ul|
20+ ul.tag('li') do |li|
21+ li.tag('a') do |a|
22+ a['href'] = uri(content.id)
23+ a['class'] = 'selected' if resource.content.equal?(content)
24+ end.text(content.title)
25+ if resource.content.path.include?(content)
26+ render_html(li, builder, content)
27+ end unless content.node.empty?
28+ end
29+ end
30+ end
31+ else
32+ xml.tag('ul') do |ul|
33+ content.node.each do |c|
34+ ul.tag('li') do |li|
35+ li.tag('a') do |a|
36+ a['href'] = uri(c.id)
37+ a['class'] = 'selected' if resource.content.equal?(c)
38+ end.text(c.title)
39+ if resource.content.path.include?(c)
40+ render_html(li, builder, c)
41+ end unless c.node.empty?
42+ end
43+ end
44+ end
45+ end
46+ end
47+ end
48+ end
49+end
--- trunk/webapp/Widget/Content/Tab.rb (revision 78)
+++ trunk/webapp/Widget/Content/Tab.rb (revision 79)
@@ -10,9 +10,7 @@
1010 extend Tenarai::ClassLoader
1111
1212 preference_css 'box'
13- preference_css 'tab', 'a'
14- preference_css 'tab_selected', 'a.selected'
15- preference_css 'tab_hover', 'a:hover'
13+ preference_list
1614
1715 def render_html(xml, builder)
1816 c = resource.content.root
--- trunk/webapp/Widget/Content/Path.rb (revision 78)
+++ trunk/webapp/Widget/Content/Path.rb (revision 79)
@@ -10,13 +10,7 @@
1010 extend Tenarai::ClassLoader
1111
1212 preference_css 'box'
13- preference_css 'ul', 'ul'
14- preference_css 'ul_li', 'ul li'
15- preference_css 'li_ul', 'li ul'
16- preference_css 'li_ul_li', 'li ul li'
17- preference_css 'a', 'a'
18- preference_css 'a_selected', 'a.selected'
19- preference_css 'a_hover', 'a:hover'
13+ preference_list
2014
2115 def render_html(xml, builder)
2216 xml.tag('div', 'id' => html_id) do |t|
--- trunk/webapp/Widget.rb (revision 78)
+++ trunk/webapp/Widget.rb (revision 79)
@@ -124,7 +124,7 @@
124124 end
125125 end
126126
127- def preference_css(name, *selector)
127+ def preference_css(name, *selector, &block)
128128 selector << '' if selector.empty?
129129 meta[:preference_css] << {:name => name, :selector => selector}
130130
@@ -136,8 +136,19 @@
136136 end
137137 end
138138 end
139+
140+ block.call(css) if block_given?
139141 end
140142 end
143+
144+ def preference_list(&block)
145+ preference_css 'ul', 'ul', &block
146+ preference_css 'li_ul', 'li ul', &block
147+ preference_css 'ul_li', 'ul li', &block
148+ preference_css 'a', 'a', &block
149+ preference_css 'a_selected', 'a.selected', &block
150+ preference_css 'a_hover', 'a:hover', &block
151+ end
141152 end
142153
143154 attr_accessor :service
--- trunk/webapp/ServiceTable.rb (revision 78)
+++ trunk/webapp/ServiceTable.rb (revision 79)
@@ -5,6 +5,13 @@
55 class ServiceTable < Tenarai::DB::Table
66 extend Tenarai::ClassLoader
77
8+ MIME = {
9+ '.txt' => 'text/plain',
10+ '.js' => 'text/javascript',
11+ '.css' => 'text/css',
12+ '.swf' => 'application/x-shockwave-flash',
13+ }
14+
815 attr_accessor :pub_dir
916
1017 def fetch_by_name(name)
@@ -26,19 +33,13 @@
2633
2734 return unless @pub_dir
2835
29- file = File.expand_path(@pub_dir + path_info)
30- return unless (%r!^#{@pub_dir}!.match(file) && File.file?(file))
36+ dir = File.expand_path(@pub_dir)
37+ file = File.expand_path(dir + path_info)
3138
32- ct = case File.extname(file).downcase
33- when '.txt'
34- 'text/plain'
35- when '.js'
36- 'text/javascript'
37- when '.css'
38- 'text/css'
39- when '.swf'
40- 'application/x-shockwave-flash'
41- end
39+ return unless (%r!^#{dir}!.match(file) && File.file?(file))
40+
41+ ct = MIME[File.extname(file).downcase]
42+
4243 unless ct.nil?
4344 response.code = 200
4445 response['content-type'] = ct
Show on old repository browser