table_helpers 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/table_helpers.rb +3 -3
- data/lib/table_list.rb +2 -2
- data/test/table_helpers_test.rb +10 -31
- metadata +24 -42
data/lib/table_helpers.rb
CHANGED
@@ -11,12 +11,12 @@ module TableHelpers
|
|
11
11
|
if widths.has_key?(i)
|
12
12
|
headers.push(content_tag(:th, column_name, :width => widths[i]))
|
13
13
|
else
|
14
|
-
headers.push(content_tag(:th, column_name))
|
14
|
+
headers.push(content_tag(:th, column_name.html_safe).html_safe)
|
15
15
|
end
|
16
16
|
i += 1
|
17
17
|
end
|
18
18
|
|
19
|
-
headers.
|
19
|
+
headers.join.html_safe
|
20
20
|
end
|
21
21
|
|
22
22
|
def get_sortable_table_headers(columns=[], widths={})
|
@@ -47,7 +47,7 @@ module TableHelpers
|
|
47
47
|
j += 1
|
48
48
|
end
|
49
49
|
|
50
|
-
headers.
|
50
|
+
headers.join.html_safe
|
51
51
|
end
|
52
52
|
|
53
53
|
def table_list(html_options = {}, &block)
|
data/lib/table_list.rb
CHANGED
@@ -5,13 +5,13 @@ class TableList
|
|
5
5
|
|
6
6
|
def sortable_headers(columns=[], widths={})
|
7
7
|
@instance.content_tag :tr do
|
8
|
-
@instance.get_sortable_table_headers(columns, widths)
|
8
|
+
@instance.concat(@instance.get_sortable_table_headers(columns, widths))
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
def headers(columns=[], widths={})
|
13
13
|
@instance.content_tag :tr do
|
14
|
-
@instance.get_table_headers(columns, widths)
|
14
|
+
@instance.concat(@instance.get_table_headers(columns, widths))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
data/test/table_helpers_test.rb
CHANGED
@@ -22,22 +22,11 @@ class TableHelpersTest < ActionView::TestCase
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
expected =
|
26
|
-
<
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
</tr>
|
31
|
-
<tr>
|
32
|
-
<td>Example 1</td>
|
33
|
-
<td class="options">Example 2</td>
|
34
|
-
</tr>
|
35
|
-
<tr>
|
36
|
-
<td>Example 3</td>
|
37
|
-
<td class="options">Example 4</td>
|
38
|
-
</tr>
|
39
|
-
</table>
|
40
|
-
EOF
|
25
|
+
expected = '<table class="list">'
|
26
|
+
expected << '<tr><th>Column 1</th><th>Column 2</th></tr>'
|
27
|
+
expected << '<tr><td>Example 1</td><td class="options">Example 2</td></tr>'
|
28
|
+
expected << '<tr><td>Example 3</td><td class="options">Example 4</td></tr>'
|
29
|
+
expected << '</table>'
|
41
30
|
|
42
31
|
assert_dom_equal expected, result
|
43
32
|
end
|
@@ -49,21 +38,11 @@ EOF
|
|
49
38
|
t.row('Client Name:', 'Bill Gates')
|
50
39
|
end
|
51
40
|
|
52
|
-
expected =
|
53
|
-
<
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
</tr>
|
58
|
-
<tr>
|
59
|
-
<td colspan="2"><hr class="section" /></td>
|
60
|
-
</tr>
|
61
|
-
<tr>
|
62
|
-
<td class="label">Client Name:</td>
|
63
|
-
<td>Bill Gates</td>
|
64
|
-
</tr>
|
65
|
-
</table>
|
66
|
-
EOF
|
41
|
+
expected = '<table class="info">'
|
42
|
+
expected << '<tr><td class="label" width="200">Firm:</td><td>Test</td></tr>'
|
43
|
+
expected << '<tr><td colspan="2"><hr class="section" /></td></tr>'
|
44
|
+
expected << '<tr><td class="label">Client Name:</td><td>Bill Gates</td></tr>'
|
45
|
+
expected << '</table>'
|
67
46
|
|
68
47
|
assert_dom_equal expected, result
|
69
48
|
end
|
metadata
CHANGED
@@ -1,72 +1,54 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_helpers
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.6'
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
version: "0.5"
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
7
|
+
authors:
|
8
|
+
- Damian Baćkowski
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2012-02-17 00:00:00 Z
|
12
|
+
date: 2012-02-18 00:00:00.000000000 Z
|
18
13
|
dependencies: []
|
19
|
-
|
20
|
-
|
14
|
+
description: The table_helpers library provides a simple helpers to create table lists
|
15
|
+
with headers and presenting data in tables.
|
21
16
|
email: damianbackowski@gmail.com
|
22
17
|
executables: []
|
23
|
-
|
24
18
|
extensions: []
|
25
|
-
|
26
19
|
extra_rdoc_files: []
|
27
|
-
|
28
|
-
files:
|
20
|
+
files:
|
29
21
|
- Rakefile
|
30
|
-
- lib/table_data.rb
|
31
22
|
- lib/tasks/table_helpers.rake
|
32
|
-
- lib/table_helpers.rb
|
33
23
|
- lib/table_list.rb
|
24
|
+
- lib/table_data.rb
|
25
|
+
- lib/table_helpers.rb
|
34
26
|
- rails/init.rb
|
35
|
-
- test/table_helpers_test.rb
|
36
27
|
- test/test_helper.rb
|
28
|
+
- test/table_helpers_test.rb
|
37
29
|
- README
|
38
30
|
homepage: https://github.com/paki-paki/table_helpers
|
39
31
|
licenses: []
|
40
|
-
|
41
32
|
post_install_message:
|
42
33
|
rdoc_options: []
|
43
|
-
|
44
|
-
require_paths:
|
34
|
+
require_paths:
|
45
35
|
- lib
|
46
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
37
|
none: false
|
48
|
-
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
|
52
|
-
|
53
|
-
- 0
|
54
|
-
version: "0"
|
55
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
43
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
version: "0"
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
64
48
|
requirements: []
|
65
|
-
|
66
49
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.8.
|
50
|
+
rubygems_version: 1.8.15
|
68
51
|
signing_key:
|
69
52
|
specification_version: 3
|
70
53
|
summary: Table helpers for Rails 3.0.x
|
71
54
|
test_files: []
|
72
|
-
|