• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂62 (tree)
時間2008-03-27 20:47:13
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/test/test_css.rb (revision 61)
+++ trunk/test/test_css.rb (revision 62)
@@ -8,13 +8,13 @@
88 class CSSTest < Test::Unit::TestCase
99 def setup
1010 @css = Tenarai::CSS.new
11- @css.style('#id10', 'margin' => '5px') do |s|
11+ @css.selector('#id10', 'margin' => '5px') do |s|
1212 s['padding'] = '10px'
1313 end
14- @css.style('#id5') do |s|
14+ @css.selector('#id5') do |s|
1515 s['padding'] = '20px'
1616 end
17- @css.style('#id10') do |s|
17+ @css.selector('#id10') do |s|
1818 s['padding'] = '6px'
1919 end
2020 end
--- trunk/Rakefile (revision 61)
+++ trunk/Rakefile (revision 62)
@@ -84,7 +84,7 @@
8484 :relation => {'view' => 'view:resource.admin.user.new'},
8585 },
8686 {
87- :name => 'admin.list',
87+ :name => 'admin.user_list',
8888 :class => 'Content',
8989 :row => {
9090 'title' => 'user list',
@@ -93,13 +93,13 @@
9393 :relation => {'view' => 'view:resource.admin.user.list'},
9494 },
9595 {
96- :name => 'admin.list.user',
96+ :name => 'admin.user_list.user_home',
9797 :class => 'Content',
9898 :row => {
9999 'title' => 'user detail',
100100 'body' => '',
101101 },
102- :relation => {'view' => 'view:resource.admin.user.detail'},
102+ :relation => {'view' => 'view:resource.admin.user.home'},
103103 },
104104
105105 {
@@ -148,7 +148,7 @@
148148 :row => {'name' => 'user'},
149149 },
150150 {
151- :name => 'resource.admin.user.detail',
151+ :name => 'resource.admin.user.home',
152152 :class => 'View',
153153 :row => {'name' => 'user'},
154154 },
@@ -375,10 +375,10 @@
375375 }
376376 },
377377 {
378- :name => 'session.user.content.view.html.admin.bd.user.detail',
378+ :name => 'session.user.content.view.html.admin.bd.user.home',
379379 :class => 'Widget::UserAdmin::Form',
380380 :row => {},
381- :relation => {'view' => 'view:resource.admin.user.detail'},
381+ :relation => {'view' => 'view:resource.admin.user.home'},
382382 :preference => {
383383 'box.size.width' => '900px',
384384 'preference.form.type' => 'edit',
--- trunk/lib/tenarai/css.rb (revision 61)
+++ trunk/lib/tenarai/css.rb (revision 62)
@@ -6,7 +6,7 @@
66
77 module Tenarai
88 class CSS < Container
9- class Selecter < Hash
9+ class Selector < Hash
1010 attr_reader :name
1111
1212 def initialize(name)
@@ -32,14 +32,14 @@
3232 block.call(self) if block_given?
3333 end
3434
35- def style(selecter, style={}, &block)
36- obj = if key?(selecter)
37- fetch(selecter)
35+ def selector(name, property={}, &block)
36+ obj = if key?(name)
37+ fetch(name)
3838 else
39- self << Selecter.new(selecter)
39+ self << Selector.new(name)
4040 end
4141
42- style.each do |key, val|
42+ property.each do |key, val|
4343 obj[key] = val
4444 end
4545
--- trunk/webapp/Widget.rb (revision 61)
+++ trunk/webapp/Widget.rb (revision 62)
@@ -120,9 +120,9 @@
120120 end
121121 end
122122
123- def preference_css(name, *selecter)
124- selecter << '' if selecter.empty?
125- meta[:preference_css] << {:name => name, :selecter => selecter}
123+ def preference_css(name, *selector)
124+ selector << '' if selector.empty?
125+ meta[:preference_css] << {:name => name, :selector => selector}
126126
127127 preference name do |css|
128128 PREF_CSS.each do |key, val|
@@ -178,8 +178,8 @@
178178 self.class.meta[:preference_css].each do |prefcss|
179179 preference[prefcss[:name]].each do |val|
180180 val.each do |v|
181- prefcss[:selecter].each do |selecter|
182- css.style(css_id + ' ' + selecter) do |style|
181+ prefcss[:selector].each do |selector|
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/Resource.rb (revision 61)
+++ trunk/webapp/Resource.rb (revision 62)
@@ -13,18 +13,6 @@
1313 @content = service.model[self.class.name.split('::').pop.downcase].fetch(id)
1414 end
1515
16- def build_url(param)
17- if param.empty?
18- if @content
19- @content.id
20- else
21- nil
22- end
23- else
24- param
25- end
26- end
27-
2816 def _build_url(param, _resource, _query)
2917 if view.path.size == 1
3018 _resource.unshift([build_url(param)].join(','))
@@ -39,6 +27,18 @@
3927 end._build_url([], _resource, _query)
4028 end
4129
30+ def build_url(param)
31+ if param.empty?
32+ if @content
33+ @content.id
34+ else
35+ nil
36+ end
37+ else
38+ param
39+ end
40+ end
41+
4242 def url(*param, &block)
4343 query = Tenarai::CGI::Query.new
4444 block.call(query) if block_given?
Show on old repository browser