table_helper 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,15 @@
1
1
  == master
2
2
 
3
+ == 0.2.0 / 2009-04-25
4
+
5
+ * Reorganize documentation
6
+ * Allow css classes to be customized
7
+ * Use the jQuery UI css naming convention
8
+ * Allow multiple headers to be created at once
9
+ * No longer allow pre-existing headers to be customized (instead must re-define all headers)
10
+ * Remove :header / :footer options
11
+ * Simplify public interface
12
+
3
13
  == 0.1.0 / 2008-12-14
4
14
 
5
15
  * Remove the PluginAWeek namespace
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2008 Aaron Pfeifer
1
+ Copyright (c) 2006-2009 Aaron Pfeifer
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -35,27 +35,27 @@ these types of tables by DRYing much of the html being generated.
35
35
 
36
36
  ...is compiled to (formatted here for the sake of sanity):
37
37
 
38
- <table cellpadding="0" cellspacing="0">
38
+ <table cellpadding="0" cellspacing="0" class="people ui-collection">
39
39
  <thead>
40
40
  <tr>
41
- <th class="first_name" scope="col">First Name</th>
42
- <th class="last_name" scope="col">Last Name</th>
43
- <th class="company_id" scope="col">Company</th>
44
- <th class="role" scope="col">Role</th>
41
+ <th class="person-first_name" scope="col">First Name</th>
42
+ <th class="person-last_name" scope="col">Last Name</th>
43
+ <th class="person-company_id" scope="col">Company</th>
44
+ <th class="person-role" scope="col">Role</th>
45
45
  </tr>
46
46
  </thead>
47
47
  <tbody>
48
- <tr class="row">
49
- <td class="first_name">John</td>
50
- <td class="last_name">Doe</td>
51
- <td class="company_id">1</td>
52
- <td class="role">President</td>
48
+ <tr class="person ui-collection-result">
49
+ <td class="person-first_name">John</td>
50
+ <td class="person-last_name">Doe</td>
51
+ <td class="person-company_id">1</td>
52
+ <td class="person-role">President</td>
53
53
  </tr>
54
- <tr class="row">
55
- <td class="first_name">Jane</td>
56
- <td class="last_name">Doe</td>
57
- <td class="company_id">1</td>
58
- <td class="role">Vice-President</td>
54
+ <tr class="person ui-collection-result">
55
+ <td class="person-first_name">Jane</td>
56
+ <td class="person-last_name">Doe</td>
57
+ <td class="person-company_id">1</td>
58
+ <td class="person-role">Vice-President</td>
59
59
  </tr>
60
60
  </tbody>
61
61
  <table>
@@ -63,79 +63,90 @@ these types of tables by DRYing much of the html being generated.
63
63
  === Advanced Example
64
64
 
65
65
  <%=
66
- collection_table(@posts, {}, :id => 'posts', :class => 'summary') do |header, body|
67
- header.column :title
68
- header.column :category
69
- header.column :author
70
- header.column :publish_date, 'Date<br \>Published'
71
- header.column :num_comments, '# Comments'
72
- header.column :num_trackbacks, '# Trackbacks'
66
+ collection_table(@posts, :id => 'posts', :class => 'summary') do |t|
67
+ t.header :title
68
+ t.header :category
69
+ t.header :author
70
+ t.header :publish_date, 'Date<br \>Published'
71
+ t.header :num_comments, '# Comments'
72
+ t.header :num_trackbacks, '# Trackbacks'
73
73
 
74
- body.alternate = true
75
- body.build do |row, post, index|
74
+ t.rows.alternate = :odd
75
+ t.rows.each do |row, post, index|
76
+ # Notice there's no need to explicitly define the title
76
77
  row.category post.category.name
77
78
  row.author post.author.name
78
- row.publish_date time_ago_in_words(post.published_on)
79
+ row.publish_date time_ago_in_words(post.published_at)
79
80
  row.num_comments post.comments.empty? ? '-' : post.comments.size
80
81
  row.num_trackbacks post.trackbacks.empty? ? '-' : post.trackbacks.size
81
82
  end
83
+
84
+ t.footer :num_comments, @posts.inject(0) {|sum, post| sum += post.comments.size}
85
+ t.footer :num_trackbacks, @posts.inject(0) {|sum, post| sum += post.trackbacks.size}
82
86
  end
83
87
  %>
84
88
 
85
89
  ...is compiled to (formatted here for the sake of sanity):
86
90
 
87
- <table cellpadding="0" cellspacing="0" class="summary" id="posts">
91
+ <table cellpadding="0" cellspacing="0" class="summary posts ui-collection" id="posts">
88
92
  <thead>
89
93
  <tr>
90
- <th class="title" scope="col">Title</th>
91
- <th class="category" scope="col">Category</th>
92
- <th class="author" scope="col">Author</th>
93
- <th class="publish_date" scope="col">Date<br \>Published</th>
94
- <th class="num_comments" scope="col"># Comments</th>
95
- <th class="num_trackbacks" scope="col"># Trackbacks</th>
94
+ <th class="post-title" scope="col">Title</th>
95
+ <th class="post-category" scope="col">Category</th>
96
+ <th class="post-author" scope="col">Author</th>
97
+ <th class="post-publish_date" scope="col">Date<br \>Published</th>
98
+ <th class="post-num_comments" scope="col"># Comments</th>
99
+ <th class="post-num_trackbacks" scope="col"># Trackbacks</th>
96
100
  </tr>
97
101
  </thead>
98
- <tbody class="alternate">
99
- <tr class="row">
100
- <td class="title">Open-source projects: The good, the bad, and the ugly</td>
101
- <td class="category">General</td>
102
- <td class="author">John Doe</td>
103
- <td class="publish_date">23 days</td>
104
- <td class="num_comments">-</td>
105
- <td class="num_trackbacks">-</td>
102
+ <tbody>
103
+ <tr class="post ui-collection-result">
104
+ <td class="post-title">Open-source projects: The good, the bad, and the ugly</td>
105
+ <td class="post-category">General</td>
106
+ <td class="post-author">John Doe</td>
107
+ <td class="post-publish_date">23 days</td>
108
+ <td class="post-num_comments">-</td>
109
+ <td class="post-num_trackbacks">-</td>
106
110
  </tr>
107
- <tr class="row alternate">
108
- <td class="title">5 reasons you should care about Rails</td>
109
- <td class="category">Rails</td><td class="author">John Q. Public</td>
110
- <td class="publish_date">21 days</td>
111
- <td class="num_comments">-</td>
112
- <td class="num_trackbacks">-</td>
111
+ <tr class="post ui-collection-result ui-state-alternate">
112
+ <td class="post-title">5 reasons you should care about Rails</td>
113
+ <td class="post-category">Rails</td>
114
+ <td class="post-author">John Q. PUblic</td>
115
+ <td class="post-publish_date">21 days</td>
116
+ <td class="post-num_comments">-</td>
117
+ <td class="post-num_trackbacks">-</td>
113
118
  </tr>
114
- <tr class="row">
115
- <td class="title">Deprecation: Stop digging yourself a hole</td>
116
- <td class="category">Rails</td>
117
- <td class="author">Jane Doe</td>
118
- <td class="publish_date">17 days</td>
119
- <td class="num_comments">-</td>
120
- <td class="num_trackbacks">-</td>
119
+ <tr class="post ui-collection-result">
120
+ <td class="post-title">Deprecation: Stop digging yourself a hole</td>
121
+ <td class="post-category">Rails</td>
122
+ <td class="post-author">Jane Doe</td>
123
+ <td class="post-publish_date">17 days</td>
124
+ <td class="post-num_comments">-</td>
125
+ <td class="post-num_trackbacks">-</td>
121
126
  </tr>
122
- <tr class="row alternate">
123
- <td class="title">Jumpstart your Rails career at RailsConf 2007</td>
124
- <td class="category">Conferences</td>
125
- <td class="author">Jane Doe</td>
126
- <td class="publish_date">4 days</td>
127
- <td class="num_comments">-</td>
128
- <td class="num_trackbacks">-</td>
127
+ <tr class="post ui-collection-result ui-state-alternate">
128
+ <td class="post-title">Jumpstart your Rails career at RailsConf 2007</td>
129
+ <td class="post-category">Conferences</td>
130
+ <td class="post-author">Jane Doe</td>
131
+ <td class="post-publish_date">4 days</td>
132
+ <td class="post-num_comments">-</td>
133
+ <td class="post-num_trackbacks">-</td>
129
134
  </tr>
130
- <tr class="row">
131
- <td class="title">Getting some REST</td>
132
- <td class="category">Rails</td>
133
- <td class="author">John Doe</td>
134
- <td class="publish_date">about 18 hours</td>
135
- <td class="num_comments">-</td>
136
- <td class="num_trackbacks">-</td>
135
+ <tr class="post ui-collection-result">
136
+ <td class="post-title">Getting some REST</td>
137
+ <td class="post-category">Rails</td>
138
+ <td class="post-author">John Doe</td>
139
+ <td class="post-publish_date">about 18 hours</td>
140
+ <td class="post-num_comments">-</td>
141
+ <td class="post-num_trackbacks">-</td>
137
142
  </tr>
138
143
  </tbody>
144
+ <tfoot>
145
+ <tr>
146
+ <td class="post-num_comments">0</td>
147
+ <td class="post-num_trackbacks">0</td>
148
+ </tr>
149
+ </tfoot>
139
150
  </table>
140
151
 
141
152
  === Caveat Emptor
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/contrib/sshpublisher'
5
5
 
6
6
  spec = Gem::Specification.new do |s|
7
7
  s.name = 'table_helper'
8
- s.version = '0.1.0'
8
+ s.version = '0.2.0'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.summary = 'Adds a helper method for generating HTML tables from collections'
11
11
 
data/lib/table_helper.rb CHANGED
@@ -1,177 +1,208 @@
1
1
  require 'table_helper/collection_table'
2
2
 
3
- # Provides a set of methods for turning a collection into a table.
4
- #
5
- # == Basic Example
6
- #
7
- # This example shows the most basic usage of +collection_table+ which takes
8
- # information about a collection, the objects in them, the columns defined
9
- # for the class, and generates a table based on that.
10
- #
11
- # Suppose you have a table generated by a migration like so:
12
- #
13
- # class CreatePeople < ActiveRecord::Base
14
- # def self.up
15
- # create_table do |t|
16
- # t.string :first_name
17
- # t.string :last_name
18
- # t.integer :company_id
19
- # t.string :role
20
- # end
21
- # end
22
- # end
23
- #
24
- # ...then invoking the helper within a view:
25
- #
26
- # <%= collection_table Person.find(:all) %>
27
- #
28
- # ...is compiled to (formatted here for the sake of sanity):
29
- #
30
- # <table cellpadding="0" cellspacing="0">
31
- # <thead>
32
- # <tr>
33
- # <th class="first_name" scope="col">First Name</th>
34
- # <th class="last_name" scope="col">Last Name</th>
35
- # <th class="company_id" scope="col">Company</th>
36
- # <th class="role" scope="col">Role</th>
37
- # </tr>
38
- # </thead>
39
- # <tbody>
40
- # <tr class="row">
41
- # <td class="first_name">John</td>
42
- # <td class="last_name">Doe</td>
43
- # <td class="company_id">1</td>
44
- # <td class="role">President</td>
45
- # </tr>
46
- # <tr class="row">
47
- # <td class="first_name">Jane</td>
48
- # <td class="last_name">Doe</td>
49
- # <td class="company_id">1</td>
50
- # <td class="role">Vice-President</td>
51
- # </tr>
52
- # </tbody>
53
- # <table>
54
- #
55
- # == Advanced Example
56
- #
57
- # This example below shows how +collection_table+ can be customized to show
58
- # specific headers, content, and footers.
59
- #
60
- # <%=
61
- # collection_table(@posts, {}, :id => 'posts', :class => 'summary') do |header, body|
62
- # header.column :title
63
- # header.column :category
64
- # header.column :author
65
- # header.column :publish_date, 'Date<br \>Published'
66
- # header.column :num_comments, '# Comments'
67
- # header.column :num_trackbacks, '# Trackbacks'
68
- #
69
- # body.alternate = true
70
- # body.build do |row, post, index|
71
- # row.category post.category.name
72
- # row.author post.author.name
73
- # row.publish_date time_ago_in_words(post.published_on)
74
- # row.num_comments post.comments.empty? ? '-' : post.comments.size
75
- # row.num_trackbacks post.trackbacks.empty? ? '-' : post.trackbacks.size
76
- # end
77
- # end
78
- # %>
79
- #
80
- # ...is compiled to (formatted here for the sake of sanity):
81
- #
82
- # <table cellpadding="0" cellspacing="0" class="summary" id="posts">
83
- # <thead>
84
- # <tr>
85
- # <th class="title" scope="col">Title</th>
86
- # <th class="category" scope="col">Category</th>
87
- # <th class="author" scope="col">Author</th>
88
- # <th class="publish_date" scope="col">Date<br \>Published</th>
89
- # <th class="num_comments" scope="col"># Comments</th>
90
- # <th class="num_trackbacks" scope="col"># Trackbacks</th>
91
- # </tr>
92
- # </thead>
93
- # <tbody class="alternate">
94
- # <tr class="row">
95
- # <td class="title">Open-source projects: The good, the bad, and the ugly</td>
96
- # <td class="category">General</td>
97
- # <td class="author">John Doe</td>
98
- # <td class="publish_date">23 days</td>
99
- # <td class="num_comments">-</td>
100
- # <td class="num_trackbacks">-</td>
101
- # </tr>
102
- # <tr class="row alternate">
103
- # <td class="title">5 reasons you should care about Rails</td>
104
- # <td class="category">Rails</td><td class="author">John Q. Public</td>
105
- # <td class="publish_date">21 days</td>
106
- # <td class="num_comments">-</td>
107
- # <td class="num_trackbacks">-</td>
108
- # </tr>
109
- # <tr class="row">
110
- # <td class="title">Deprecation: Stop digging yourself a hole</td>
111
- # <td class="category">Rails</td>
112
- # <td class="author">Jane Doe</td>
113
- # <td class="publish_date">17 days</td>
114
- # <td class="num_comments">-</td>
115
- # <td class="num_trackbacks">-</td>
116
- # </tr>
117
- # <tr class="row alternate">
118
- # <td class="title">Jumpstart your Rails career at RailsConf 2007</td>
119
- # <td class="category">Conferences</td>
120
- # <td class="author">Jane Doe</td>
121
- # <td class="publish_date">4 days</td>
122
- # <td class="num_comments">-</td>
123
- # <td class="num_trackbacks">-</td>
124
- # </tr>
125
- # <tr class="row">
126
- # <td class="title">Getting some REST</td>
127
- # <td class="category">Rails</td>
128
- # <td class="author">John Doe</td>
129
- # <td class="publish_date">about 18 hours</td>
130
- # <td class="num_comments">-</td>
131
- # <td class="num_trackbacks">-</td>
132
- # </tr>
133
- # </tbody>
134
- # </table>
135
- #
136
- # == Creating footers
137
- #
138
- # Footers allow you to show some sort of summary information based on the
139
- # data displayed in the body of the table. Below is an example:
140
- #
141
- # <%
142
- # collection_table(@posts, :footer => true) do |header, body, footer|
143
- # header.column :title
144
- # header.column :category
145
- # header.column :author
146
- # header.column :publish_date, 'Date<br \>Published'
147
- # header.column :num_comments, '# Comments'
148
- # header.column :num_trackbacks, '# Trackbacks'
149
- #
150
- # body.alternate = true
151
- # body.build do |row, post, index|
152
- # row.category post.category.name
153
- # row.author post.author.name
154
- # row.publish_date time_ago_in_words(post.published_on)
155
- # row.num_comments post.comments.empty? ? '-' : post.comments.size
156
- # row.num_trackbacks post.trackbacks.empty? ? '-' : post.trackbacks.size
157
- # end
158
- #
159
- # footer.cell :num_comments, @posts.inject(0) {|sum, post| sum += post.comments.size}
160
- # footer.cell :num_trackbacks, @posts.inject(0) {|sum, post| sum += post.trackbacks.size}
161
- # end
162
- # %>
3
+ # Provides a set of methods for turning a collection into a table
163
4
  module TableHelper
164
- # Creates a new table based on the objects in the given collection
5
+ # Generates a new table for the given collection.
165
6
  #
166
- # Configuration options:
7
+ # == Basic Example
167
8
  #
168
- # * +class+ - Specify the type of objects expected in the collection if it can't be guessed from its contents.
169
- # * +header+ - Specify if a header (thead) should be built into the table. Default is true.
170
- # * +footer+ - Specify if a footer (tfoot) should be built into the table. Default is false.
171
- def collection_table(collection, options = {}, html_options = {}, &block)
172
- table = CollectionTable.new(collection, options, html_options)
173
- table.build(&block)
174
- table.html
9
+ # This example shows the most basic usage of +collection_table+ which takes
10
+ # information about a collection, the objects in them, the columns defined
11
+ # for the class, and generates a table based on that.
12
+ #
13
+ # Suppose you have a table generated by a migration like so:
14
+ #
15
+ # class CreatePeople < ActiveRecord::Base
16
+ # def self.up
17
+ # create_table do |t|
18
+ # t.string :first_name
19
+ # t.string :last_name
20
+ # t.integer :company_id
21
+ # t.string :role
22
+ # end
23
+ # end
24
+ # end
25
+ #
26
+ # ...then invoking the helper within a view:
27
+ #
28
+ # <%= collection_table Person.find(:all) %>
29
+ #
30
+ # ...is compiled to (formatted here for the sake of sanity):
31
+ #
32
+ # <table cellpadding="0" cellspacing="0" class="posts ui-collection">
33
+ # <thead>
34
+ # <tr>
35
+ # <th class="person-first_name" scope="col">First Name</th>
36
+ # <th class="person-last_name" scope="col">Last Name</th>
37
+ # <th class="person-company_id" scope="col">Company</th>
38
+ # <th class="person-role" scope="col">Role</th>
39
+ # </tr>
40
+ # </thead>
41
+ # <tbody>
42
+ # <tr class="person ui-collection-result">
43
+ # <td class="person-first_name">John</td>
44
+ # <td class="person-last_name">Doe</td>
45
+ # <td class="person-company_id">1</td>
46
+ # <td class="person-role">President</td>
47
+ # </tr>
48
+ # <tr class="person ui-collection-result">
49
+ # <td class="first_name">Jane</td>
50
+ # <td class="last_name">Doe</td>
51
+ # <td class="company_id">1</td>
52
+ # <td class="role">Vice-President</td>
53
+ # </tr>
54
+ # </tbody>
55
+ # <table>
56
+ #
57
+ # == Advanced Example
58
+ #
59
+ # This example below shows how +collection_table+ can be customized to show
60
+ # specific headers, content, and footers.
61
+ #
62
+ # <%=
63
+ # collection_table(@posts, :id => 'posts', :class => 'summary') do |t|
64
+ # t.header :title
65
+ # t.header :category
66
+ # t.header :author
67
+ # t.header :publish_date, 'Date<br \>Published'
68
+ # t.header :num_comments, '# Comments'
69
+ # t.header :num_trackbacks, '# Trackbacks'
70
+ #
71
+ # t.rows.alternate = :odd
72
+ # t.rows.each do |row, post, index|
73
+ # row.category post.category.name
74
+ # row.author post.author.name
75
+ # row.publish_date time_ago_in_words(post.published_at)
76
+ # row.num_comments post.comments.empty? ? '-' : post.comments.size
77
+ # row.num_trackbacks post.trackbacks.empty? ? '-' : post.trackbacks.size
78
+ # end
79
+ # end
80
+ # %>
81
+ #
82
+ # ...is compiled to (formatted here for the sake of sanity):
83
+ #
84
+ # <table cellpadding="0" cellspacing="0" class="summary posts ui-collection" id="posts">
85
+ # <thead>
86
+ # <tr>
87
+ # <th class="post-title" scope="col">Title</th>
88
+ # <th class="post-category" scope="col">Category</th>
89
+ # <th class="post-author" scope="col">Author</th>
90
+ # <th class="post-publish_date" scope="col">Date<br \>Published</th>
91
+ # <th class="post-num_comments" scope="col"># Comments</th>
92
+ # <th class="post-num_trackbacks" scope="col"># Trackbacks</th>
93
+ # </tr>
94
+ # </thead>
95
+ # <tbody>
96
+ # <tr class="post ui-collection-result">
97
+ # <td class="post-title">Open-source projects: The good, the bad, and the ugly</td>
98
+ # <td class="post-category">General</td>
99
+ # <td class="post-author">John Doe</td>
100
+ # <td class="post-publish_date">23 days</td>
101
+ # <td class="post-num_comments">-</td>
102
+ # <td class="post-num_trackbacks">-</td>
103
+ # </tr>
104
+ # <tr class="post ui-collection-result ui-state-alternate">
105
+ # <td class="post-title">5 reasons you should care about Rails</td>
106
+ # <td class="post-category">Rails</td>
107
+ # <td class="author">John Q. Public</td>
108
+ # <td class="post-publish_date">21 days</td>
109
+ # <td class="post-num_comments">-</td>
110
+ # <td class="post-num_trackbacks">-</td>
111
+ # </tr>
112
+ # <tr class="post ui-collection-result">
113
+ # <td class="post-title">Deprecation: Stop digging yourself a hole</td>
114
+ # <td class="post-category">Rails</td>
115
+ # <td class="post-author">Jane Doe</td>
116
+ # <td class="post-publish_date">17 days</td>
117
+ # <td class="post-num_comments">-</td>
118
+ # <td class="post-num_trackbacks">-</td>
119
+ # </tr>
120
+ # <tr class="post ui-collection-result ui-state-alternate">
121
+ # <td class="post-title">Jumpstart your Rails career at RailsConf 2007</td>
122
+ # <td class="post-category">Conferences</td>
123
+ # <td class="post-author">Jane Doe</td>
124
+ # <td class="post-publish_date">4 days</td>
125
+ # <td class="post-num_comments">-</td>
126
+ # <td class="post-num_trackbacks">-</td>
127
+ # </tr>
128
+ # <tr class="post ui-collection-result">
129
+ # <td class="post-title">Getting some REST</td>
130
+ # <td class="post-category">Rails</td>
131
+ # <td class="post-author">John Doe</td>
132
+ # <td class="post-publish_date">about 18 hours</td>
133
+ # <td class="post-num_comments">-</td>
134
+ # <td class="post-num_trackbacks">-</td>
135
+ # </tr>
136
+ # </tbody>
137
+ # </table>
138
+ #
139
+ # == Creating footers
140
+ #
141
+ # Footers allow you to show some sort of summary information based on the
142
+ # data displayed in the body of the table. Below is an example:
143
+ #
144
+ # <%
145
+ # collection_table(@posts) do |t|
146
+ # t.header :title
147
+ # t.header :category
148
+ # t.header :author
149
+ # t.header :publish_date, 'Date<br \>Published'
150
+ # t.header :num_comments, '# Comments'
151
+ # t.header :num_trackbacks, '# Trackbacks'
152
+ #
153
+ # t.rows.alternate = :odd
154
+ # t.rows.each do |row, post, index|
155
+ # row.category post.category.name
156
+ # row.author post.author.name
157
+ # row.publish_date time_ago_in_words(post.published_at)
158
+ # row.num_comments post.comments.empty? ? '-' : post.comments.size
159
+ # row.num_trackbacks post.trackbacks.empty? ? '-' : post.trackbacks.size
160
+ # end
161
+ #
162
+ # t.footer :num_comments, @posts.inject(0) {|sum, post| sum += post.comments.size}
163
+ # t.footer :num_trackbacks, @posts.inject(0) {|sum, post| sum += post.trackbacks.size}
164
+ # end
165
+ # %>
166
+ #
167
+ # ...is compiled to:
168
+ #
169
+ # <table cellpadding="0" cellspacing="0" class="posts ui-collection">
170
+ # <thead>
171
+ # <tr>
172
+ # <th class="post-title" scope="col">Title</th>
173
+ # <th class="post-category" scope="col">Category</th>
174
+ # <th class="post-author" scope="col">Author</th>
175
+ # <th class="post-publish_date" scope="col">Date<br \>Published</th>
176
+ # <th class="post-num_comments" scope="col"># Comments</th>
177
+ # <th class="post-num_trackbacks" scope="col"># Trackbacks</th>
178
+ # </tr>
179
+ # </thead>
180
+ # <tbody>
181
+ # <tr class="post ui-collection-result">
182
+ # <td class="post-title">Open-source projects: The good, the bad, and the ugly</td>
183
+ # <td class="post-category">General</td>
184
+ # <td class="post-author">John Doe</td>
185
+ # <td class="post-publish_date">23 days</td>
186
+ # <td class="post-num_comments">-</td>
187
+ # <td class="post-num_trackbacks">-</td>
188
+ # </tr>
189
+ # <tr class="post ui-collection-result ui-state-alternate">
190
+ # <td class="post-title">5 reasons you should care about Rails</td>
191
+ # <td class="post-category">Rails</td><td class="author">John Q. Public</td>
192
+ # <td class="post-publish_date">21 days</td>
193
+ # <td class="post-num_comments">-</td>
194
+ # <td class="post-num_trackbacks">-</td>
195
+ # </tr>
196
+ # </tbody>
197
+ # <tfoot>
198
+ # <tr>
199
+ # <td class="post-num_comments">0</td>
200
+ # <td class="post-num_trackbacks">0</td>
201
+ # </tr>
202
+ # </tfoot>
203
+ # <table>
204
+ def collection_table(collection, klass = nil, html_options = {}, &block)
205
+ CollectionTable.new(collection, klass, html_options, &block).html
175
206
  end
176
207
  end
177
208