tableasy 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -11,8 +11,9 @@ module Tableasy
11
11
  end.join
12
12
  end
13
13
 
14
- content << list.collect do |item|
14
+ content << list.each_with_index.collect do |item, index|
15
15
  row = Row.new(item, columns)
16
+ row.html[:class] = index.odd? ? 'even' : 'odd'
16
17
  yield row if block_given?
17
18
  content_row(item, row)
18
19
  end.join
@@ -5,7 +5,7 @@ describe Tableasy::TablesHelper do
5
5
  build :project
6
6
  output = helper.table_for(Project, [@project], :name)
7
7
 
8
- output.should == "<table><tr><th>Name</th></tr><tr class=\"project\" id=\"row_project_1\"><td>project</td></tr></table>"
8
+ output.should == "<table><tr><th>Name</th></tr><tr class=\"project odd\" id=\"row_project_1\"><td>project</td></tr></table>"
9
9
  end
10
10
 
11
11
  it "should yield row object with columns and record when creating table using block" do
@@ -15,7 +15,7 @@ describe Tableasy::TablesHelper do
15
15
  row.columns[1].value = 'xxxxx'
16
16
  end
17
17
 
18
- output.should == "<table><tr><th>Name</th><th>Leader</th></tr><tr class=\"project\" id=\"row_project_1\"><td>project</td><td>xxxxx</td></tr></table>"
18
+ output.should == "<table><tr><th>Name</th><th>Leader</th></tr><tr class=\"project odd\" id=\"row_project_1\"><td>project</td><td>xxxxx</td></tr></table>"
19
19
  end
20
20
 
21
21
  it "should allow passing custom html options for row and columns" do
@@ -36,8 +36,8 @@ describe Tableasy::TablesHelper do
36
36
 
37
37
  output.should == "<table>\
38
38
  <tr><th>Name</th><th>Id</th></tr>\
39
- <tr class=\"person\" id=\"row_person_1\"><td>Admin</td><td>1</td></tr>\
40
- <tr class=\"person\" id=\"row_person_1\"><td>Andrius</td><td>1</td></tr>\
39
+ <tr class=\"person odd\" id=\"row_person_1\"><td>Admin</td><td>1</td></tr>\
40
+ <tr class=\"person even\" id=\"row_person_1\"><td>Andrius</td><td>1</td></tr>\
41
41
  <tr class=\"tableasy_total total-row\" id=\"row_tableasy_total_2\"><th>Total: </th><td>2</td></tr>\
42
42
  </table>"
43
43
  end
@@ -51,8 +51,8 @@ describe Tableasy::TablesHelper do
51
51
 
52
52
  output.should == "<table>\
53
53
  <tr><th>Name</th><th>Id</th></tr>\
54
- <tr class=\"person\" id=\"row_person_1\"><td>Admin</td><td>@1</td></tr>\
55
- <tr class=\"person\" id=\"row_person_1\"><td>Andrius</td><td>@1</td></tr>\
54
+ <tr class=\"person odd\" id=\"row_person_1\"><td>Admin</td><td>@1</td></tr>\
55
+ <tr class=\"person even\" id=\"row_person_1\"><td>Andrius</td><td>@1</td></tr>\
56
56
  <tr class=\"tableasy_total total-row\" id=\"row_tableasy_total_2\"><th>Total of:</th><td>@2</td></tr>\
57
57
  </table>"
58
58
  end
@@ -61,7 +61,7 @@ describe Tableasy::TablesHelper do
61
61
  build :andrius
62
62
  output = helper.table_for(Person, [@andrius], helper.linked(:name))
63
63
 
64
- output.should == "<table><tr><th>Name</th></tr><tr class=\"person\" id=\"row_person_1\"><td><a href=\"/people/Andrius\">Andrius</a></td></tr></table>"
64
+ output.should == "<table><tr><th>Name</th></tr><tr class=\"person odd\" id=\"row_person_1\"><td><a href=\"/people/Andrius\">Andrius</a></td></tr></table>"
65
65
  end
66
66
 
67
67
  it "should allow using formatters with totals" do
@@ -72,8 +72,8 @@ describe Tableasy::TablesHelper do
72
72
 
73
73
  output.should == "<table>\
74
74
  <tr><th>Name</th><th>Id2</th><th>Id</th></tr>\
75
- <tr class=\"person\" id=\"row_person_1\"><td>Admin</td><td>2</td><td>1 (50.000%)</td></tr>\
76
- <tr class=\"person\" id=\"row_person_1\"><td>Andrius</td><td>2</td><td>1 (50.000%)</td></tr>\
75
+ <tr class=\"person odd\" id=\"row_person_1\"><td>Admin</td><td>2</td><td>1 (50.000%)</td></tr>\
76
+ <tr class=\"person even\" id=\"row_person_1\"><td>Andrius</td><td>2</td><td>1 (50.000%)</td></tr>\
77
77
  <tr class=\"tableasy_total total-row\" id=\"row_tableasy_total_2\"><th>Total: </th><td>4</td><td>2 (50.000%)</td></tr>\
78
78
  </table>"
79
79
  end
@@ -82,6 +82,6 @@ describe Tableasy::TablesHelper do
82
82
  build :andrius
83
83
  output = helper.table_for(Person, [@andrius], helper.tail_link('show'))
84
84
 
85
- output.should == "<table><tr></tr><tr class=\"person\" id=\"row_person_1\"><td><a href=\"/people/Andrius\">show</a></td></tr></table>"
85
+ output.should == "<table><tr></tr><tr class=\"person odd\" id=\"row_person_1\"><td><a href=\"/people/Andrius\">show</a></td></tr></table>"
86
86
  end
87
87
  end
data/tableasy.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tableasy}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrius Chamentauskas"]
12
- s.date = %q{2010-02-22}
12
+ s.date = %q{2010-02-23}
13
13
  s.description = %q{Rails tables builder gem that makes creating tables painless. Includes ability to write custom column formatters or even customize row completely.
14
14
  Includes library of predefined column formatters. Also has ability to generate "totals" row.}
15
15
  s.email = %q{sinsiliux@gmail.com}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tableasy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrius Chamentauskas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-22 00:00:00 +02:00
12
+ date: 2010-02-23 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency