table_helpers 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -28,9 +28,9 @@ will output:
28
28
  </table>
29
29
 
30
30
  <% table_data :label_size => 150 do |t| %>
31
- <% t.row 'Label name:', 'Data' %>
32
- <% t.section 'Next section:' %>
33
- <% t.row 'Label name 2:', 'Data 2' %>
31
+ <%= t.row 'Label name:', 'Data' %>
32
+ <%= t.section 'Next section:' %>
33
+ <%= t.row 'Label name 2:', 'Data 2' %>
34
34
  <% end %>
35
35
 
36
36
  will output:
data/lib/table_data.rb CHANGED
@@ -15,7 +15,7 @@ class TableData < ActionView::Base
15
15
  end
16
16
  else
17
17
  result = content_tag :tr do
18
- content_tag(:td, content_tag(:span, label, :class => "label") << data, :colspan => 2, :width => @label_size)
18
+ content_tag(:td, content_tag(:span, label, :class => "label", :style => "display: block; float: left; width: #{@label_size}px;") << data, :colspan => 2, :width => @label_size)
19
19
  end
20
20
  end
21
21
 
@@ -28,7 +28,7 @@ class TableData < ActionView::Base
28
28
  end
29
29
  else
30
30
  result = content_tag :tr do
31
- content_tag(:td, content_tag(:span, label, :class => "label") << data, :colspan => 2, :width => @label_size)
31
+ content_tag(:td, content_tag(:span, label, :class => "label", :style => "display: block; float: left; width: #{@label_size}px;") << data, :colspan => 2, :width => @label_size)
32
32
  end
33
33
  end
34
34
  end
@@ -47,4 +47,4 @@ class TableData < ActionView::Base
47
47
  end
48
48
  end
49
49
  end
50
- end
50
+ end
data/lib/table_list.rb CHANGED
@@ -22,6 +22,12 @@ class TableList
22
22
  def tr(&block)
23
23
  raise "need a block" unless block_given?
24
24
 
25
- @instance.content_tag(:tr, block.call(self))
25
+ result = @instance.capture do
26
+ @instance.content_tag :tr do
27
+ block.call(self)
28
+ end
29
+ end
30
+
31
+ @instance.concat(result)
26
32
  end
27
- end
33
+ end
@@ -13,10 +13,18 @@ class TableHelpersTest < ActionView::TestCase
13
13
  result = capture do
14
14
  table_list(:class => 'list') do |t|
15
15
  t.headers(['Column 1', 'Column 2']) +
16
- t.tr do |tr|
17
- tr.td('Example 1') +
18
- tr.td('Example 2')
19
- end
16
+ capture do
17
+ t.tr do |tr|
18
+ tr.td('Example 1') +
19
+ tr.td('Example 2')
20
+ end
21
+ end +
22
+ capture do
23
+ t.tr do |tr|
24
+ tr.td('Example 3') +
25
+ tr.td('Example 4')
26
+ end
27
+ end
20
28
  end
21
29
  end
22
30
 
@@ -30,6 +38,10 @@ class TableHelpersTest < ActionView::TestCase
30
38
  <td>Example 1</td>
31
39
  <td>Example 2</td>
32
40
  </tr>
41
+ <tr>
42
+ <td>Example 3</td>
43
+ <td>Example 4</td>
44
+ </tr>
33
45
  </table>
34
46
  EOF
35
47
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_helpers
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
4
+ hash: 21
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- version: "0.2"
9
+ - 1
10
+ version: 0.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - "Damian Ba\xC4\x87kowski"
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-02-03 00:00:00 +01:00
18
+ date: 2011-03-24 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -66,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
67
  requirements: []
67
68
 
68
69
  rubyforge_project:
69
- rubygems_version: 1.3.7
70
+ rubygems_version: 1.6.0
70
71
  signing_key:
71
72
  specification_version: 3
72
73
  summary: Table helpers for Rails