table-for 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +6 -0
- data/CHANGELOG.rdoc +4 -3
- data/Gemfile +1 -14
- data/Gemfile.lock +8 -10
- data/README.rdoc +398 -49
- data/Rakefile +6 -45
- data/app/views/table_for/_table_for.html.erb +0 -1
- data/example.rdoc +12 -1
- data/lib/table_for.rb +1 -0
- data/lib/table_for/base.rb +17 -3
- data/lib/table_for/version.rb +3 -0
- data/spec/integration/table_for_spec.rb +2 -2
- data/spec/table_for/base_spec.rb +3 -3
- data/table-for.gemspec +26 -86
- metadata +15 -65
- data/VERSION +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Y2Q4OGZmYWRiNTc4Y2MwNDAyMmY3YzAxYmUxOGViMGVjZDg0NGFjNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTY1ZGRlNTVlNjU3M2Q4NGE5ZjgxMDUxNzk5YTFhZjZiMzc5OTFkOQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWVkYzU5MzNmOTlmZTIxZDcyOTk1MWY2NWViMDBjYmQxZDBmMjAzY2QxOGU4
|
10
|
+
YzJiM2M5N2NiNGM5NmQzOTQwOWViNTJhZGQ2YTgxYzRmY2E0N2YzYTA2YmFi
|
11
|
+
OTg3MzEyYjk0NzI5ODFlYmMxZGZkMDc2NTM3MGVhODEwMWVlYjI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MThiNzAzYzg0Y2U5MGNjZmEwODQyMDcwMWU0MGQ4ZGU3YjFjYjhiOTY2OTQ4
|
14
|
+
ZjU5ZTAyYjU2MWUxZTliYWI0MzFlM2NiZTg1ZDUyMDhlZTFhNGY3Y2ZkMmZk
|
15
|
+
Y2Q4OTZjMmU0OTM5MWQyYjhjYzAxMzE5ZjE5NTRmOTUzMDAwMWQ=
|
data/.gitignore
ADDED
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
3.2.1
|
2
|
+
* Added ability to configure sort_mode order, i.e. if sort links generate sort_modes in :asc, :desc order, or have different labels
|
3
|
+
than :asc and :desc
|
4
|
+
|
1
5
|
3.2.0
|
2
6
|
* Changed the way configuration is done for TableFor. It is still done through TableFor.setup {|config|}, but some of the options have changed. Namely, the new configuration options are thead_tag, tbody_tag, tfoot_tag. If you do not want thead, tbody, or tfoot tags to be rendered, you can specify this in the setup block as follows: TableFor.setup {|config| config.thead_tag = nil; config.tbody_tag = nil; config.tfoot_tag = nil }. In addition, you can also globally define styles for the table as follows: TableFor.setup {|config| config.table_html = {:class => "table striped"}}. This undoes what was was released in 2.1.0
|
3
7
|
|
@@ -7,9 +11,6 @@
|
|
7
11
|
3.1.0
|
8
12
|
* Since templating was moved from blocks into its own gem with_template, TableFor::Base now extends WithTemplate::Base instead of Blocks::Base.
|
9
13
|
|
10
|
-
3.0.0
|
11
|
-
* TODO
|
12
|
-
|
13
14
|
2.2.0 (August 16, 2013)
|
14
15
|
* Upgraded to blocks 2.2.0 and modified calls to evaluated_proc and evaluated_procs to call_if_proc and call_each_hash_value_if_proc
|
15
16
|
|
data/Gemfile
CHANGED
@@ -1,16 +1,3 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
gem 'with_template', "~> 0.0.6"
|
5
|
-
|
6
|
-
group :development do
|
7
|
-
gem "rspec-rails", ">= 2.0.0.beta.20"
|
8
|
-
gem 'mocha', '0.10.3'
|
9
|
-
gem 'xml-simple', '1.1.1'
|
10
|
-
gem 'supermodel', '0.1.4'
|
11
|
-
gem "sqlite3"
|
12
|
-
gem "with_model", '0.2.6'
|
13
|
-
gem "bundler", "~> 1.3.5"
|
14
|
-
gem "jeweler", "~> 1.8.4"
|
15
|
-
gem "debugger"
|
16
|
-
end
|
3
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
table-for (3.3.0)
|
5
|
+
rails (>= 3.0.0)
|
6
|
+
with_template (~> 0.0.6)
|
7
|
+
|
1
8
|
GEM
|
2
9
|
remote: http://rubygems.org/
|
3
10
|
specs:
|
@@ -45,15 +52,9 @@ GEM
|
|
45
52
|
debugger-ruby_core_source (1.2.3)
|
46
53
|
diff-lcs (1.2.1)
|
47
54
|
erubis (2.7.0)
|
48
|
-
git (1.2.5)
|
49
55
|
hashie (2.0.5)
|
50
56
|
hike (1.2.1)
|
51
57
|
i18n (0.6.1)
|
52
|
-
jeweler (1.8.4)
|
53
|
-
bundler (~> 1.0)
|
54
|
-
git (>= 1.2.5)
|
55
|
-
rake
|
56
|
-
rdoc
|
57
58
|
journey (1.0.4)
|
58
59
|
json (1.7.7)
|
59
60
|
mail (2.5.3)
|
@@ -132,14 +133,11 @@ PLATFORMS
|
|
132
133
|
ruby
|
133
134
|
|
134
135
|
DEPENDENCIES
|
135
|
-
bundler (~> 1.3.5)
|
136
136
|
debugger
|
137
|
-
jeweler (~> 1.8.4)
|
138
137
|
mocha (= 0.10.3)
|
139
|
-
rails (>= 3.0.0)
|
140
138
|
rspec-rails (>= 2.0.0.beta.20)
|
141
139
|
sqlite3
|
142
140
|
supermodel (= 0.1.4)
|
141
|
+
table-for!
|
143
142
|
with_model (= 0.2.6)
|
144
|
-
with_template (~> 0.0.6)
|
145
143
|
xml-simple (= 1.1.1)
|
data/README.rdoc
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
= table-for
|
2
2
|
|
3
|
-
TableFor is a table builder for a collection of domain objects. It very easily allows the user to specify
|
3
|
+
TableFor is a table builder for a collection of domain objects. It very easily allows the user to specify
|
4
|
+
the columns to render and to override how the table, the header columns, the rows, and the columns are rendered.
|
4
5
|
|
5
6
|
== Installation
|
6
7
|
|
@@ -9,7 +10,8 @@ In <b>Rails 3 or Rails 4</b>, add this to your Gemfile.
|
|
9
10
|
gem "table-for"
|
10
11
|
|
11
12
|
== Example
|
12
|
-
The following example is purposely complex (in many cases, there are easier ways to do what is shown)
|
13
|
+
The following example is purposely complex (in many cases, there are easier ways to do what is shown)
|
14
|
+
in order to show a wide range of features that TableFor is capable of:
|
13
15
|
|
14
16
|
<%= table_for @users, :table_html => { :class => "table table-hover table-bordered" },
|
15
17
|
:sortable => true,
|
@@ -23,17 +25,17 @@ The following example is purposely complex (in many cases, there are easier ways
|
|
23
25
|
<% table.column :data => "Show 2.0", :link => true %>
|
24
26
|
<% table.column :email, :header => "Email Address" %>
|
25
27
|
<% table.column :first_name, :formatter => :downcase %>
|
26
|
-
<% table.column :last_name, :formatter =>
|
28
|
+
<% table.column :last_name, :formatter => lambda { |last_name| last_name.upcase } %>
|
27
29
|
<% table.column :created_at, :formatter => [:strftime, "%m/%d/%y %I:%M %p"] %>
|
28
30
|
<% table.column :updated_at,
|
29
|
-
:header =>
|
31
|
+
:header => lambda {
|
30
32
|
content_tag(:span, :class => "badge badge-success") do
|
31
33
|
"Last Updated"
|
32
34
|
end
|
33
35
|
},
|
34
36
|
:sortable => false,
|
35
37
|
:header_column_html => { :style => "background-color:orange" },
|
36
|
-
:data =>
|
38
|
+
:data => lambda { time_ago_in_words table.current_row.updated_at } %>
|
37
39
|
<% table.column :full_name, :header => "Full Name", :order => "last_name, first_name" do |user| %>
|
38
40
|
<%= "#{user.first_name} #{user.last_name}" %>
|
39
41
|
<% end %>
|
@@ -54,7 +56,8 @@ Produces (with Twitter Bootstrap):
|
|
54
56
|
|
55
57
|
{<img src="https://raw.github.com/hunterae/table-for/master/example_table.png">}[http://example.com]
|
56
58
|
|
57
|
-
For detailed instructions on how to run this example, along with comments on every line of the above table,
|
59
|
+
For detailed instructions on how to run this example, along with comments on every line of the above table,
|
60
|
+
check out the {Example Details}[https://github.com/hunterae/table-for/blob/master/example.rdoc].
|
58
61
|
|
59
62
|
== table_for options
|
60
63
|
The first argument to the table_for call will always be the array of domain objects. The second argument is a hash
|
@@ -64,90 +67,361 @@ sortable::
|
|
64
67
|
(defaults to false)
|
65
68
|
Sets whether all columns are sortable by default.
|
66
69
|
If this field is set to true, each column header will be generated as a link.
|
70
|
+
<%= table_for @users, :sortable => true %>
|
71
|
+
<% table.column :first_name %>
|
72
|
+
<% end %>
|
67
73
|
sort_url::
|
68
|
-
(defaults to
|
74
|
+
(defaults to the current path)
|
69
75
|
Sets the url for the header column links. This will only affect columns that are sortable.
|
76
|
+
<%= table_for @users, :sortable => true,
|
77
|
+
:sort_url => sort_admin_users_path %>
|
78
|
+
<% table.column :first_name %>
|
79
|
+
<% end %>
|
70
80
|
link_namespace::
|
71
81
|
(defaults to nil)
|
72
82
|
Sets the default namespace for any links generated in the columns.
|
73
83
|
For example, a link_namespace of admin would try to build links within the admin namespace in the routes.
|
74
84
|
This can be specified as a string, an array, a domain object, or a symbol,
|
75
|
-
|
85
|
+
<%= table_for @users, :link_namespace => [:admin, @post, :comments] %>
|
86
|
+
<% table.column :first_name, :link => true %>
|
87
|
+
<% end %>
|
76
88
|
table_html::
|
77
89
|
(defaults to nil)
|
78
|
-
Hash to specify the styles, classes, id, and other attributes applied to the table element
|
79
|
-
|
90
|
+
Hash to specify the styles, classes, id, and other attributes applied to the table element.
|
91
|
+
<%= table_for @users, :table_html => { :id => "my-table",
|
92
|
+
:class => "table table-bordered",
|
93
|
+
:cellpadding => 2 } %>
|
94
|
+
<% table.column :first_name %>
|
95
|
+
<% end %>
|
80
96
|
thead_html::
|
81
97
|
(defaults to nil)
|
82
|
-
Hash to specify the styles, classes, id, and other attributes applied to the thead element
|
83
|
-
|
84
|
-
Note: If TableFor.render_thead_element is set to false, the thead surrounding element for the
|
98
|
+
Hash to specify the styles, classes, id, and other attributes applied to the thead element.
|
99
|
+
Note: If TableFor.config.thead_tag is set to nil, the thead surrounding element for the
|
85
100
|
header row will not be rendered.
|
101
|
+
<%= table_for @users, :thead_html => { :id => "thead-id" } %>
|
102
|
+
<% table.column :first_name %>
|
103
|
+
<% end %>
|
86
104
|
header_row_html::
|
87
105
|
(defaults to nil)
|
88
|
-
Hash to specify the styles, classes, id, and other attributes applied to the header row (tr) element
|
89
|
-
|
106
|
+
Hash to specify the styles, classes, id, and other attributes applied to the header row (tr) element.
|
107
|
+
<%= table_for @users, :header_row_html => { :style => 'color: orange' } %>
|
108
|
+
<% table.column :first_name %>
|
109
|
+
<% end %>
|
90
110
|
header_column_html::
|
91
111
|
(defaults to {})
|
92
112
|
Hash to specify the styles, classes, id, and other attributes applied to the header column (th) element.
|
93
|
-
The values in this hash can each be a string or a Proc that takes (optionally) the column object as a parameter
|
94
|
-
|
113
|
+
The values in this hash can each be a string or a Proc that takes (optionally) the column object as a parameter.
|
114
|
+
<%= table_for @users, :header_column_html =>
|
115
|
+
{ :style => "font-weight: bold",
|
116
|
+
:class => lambda {|column| "#{column.name}_header" } %>
|
117
|
+
<% table.column :first_name %>
|
118
|
+
<% end %>
|
95
119
|
tbody_html::
|
96
120
|
(defaults to nil)
|
97
|
-
Hash to specify the styles, classes, id, and other attributes applied to the tbody element
|
98
|
-
|
99
|
-
Note: If TableFor.render_tbody_element is set to false, the tbody surrounding element for the
|
121
|
+
Hash to specify the styles, classes, id, and other attributes applied to the tbody element.
|
122
|
+
Note: If TableFor.config.tbody_tag is set to nil, the tbody surrounding element for the
|
100
123
|
table data rows will not be rendered.
|
124
|
+
<%= table_for @users, :tbody_html => { :id => "body-id" } %>
|
125
|
+
<% table.column :first_name %>
|
126
|
+
<% end %>
|
101
127
|
data_row_html::
|
102
128
|
(defaults to nil)
|
103
129
|
Hash to specify the styles, classes, id, and other attributes applied to each data row element (tr).
|
104
130
|
The values in this hash can each be a string or a Proc that takes (optionally) the current record as a parameter
|
105
|
-
|
131
|
+
<%= table_for @users, :data_row_html =>
|
132
|
+
{ :class => lambda { cycle('success', 'error', 'warning', 'info')},
|
133
|
+
:id => lambda { |user| "user-#{user.id}" } } %>
|
134
|
+
<% table.column :first_name %>
|
135
|
+
<% end %>
|
106
136
|
data_column_html::
|
107
137
|
(defaults to {})
|
108
|
-
Hash to specify the styles, classes, id, and other attributes applied to the
|
109
|
-
The values in this hash can each be a string or a Proc that takes (optionally) the current_record and
|
110
|
-
|
138
|
+
Hash to specify the styles, classes, id, and other attributes applied to the data column (td) element.
|
139
|
+
The values in this hash can each be a string or a Proc that takes (optionally) the current_record and
|
140
|
+
(also optionally) the column object as parameters
|
141
|
+
<%= table_for @users, :data_column_html =>
|
142
|
+
{ :style => "font-weight: bold",
|
143
|
+
:id => lambda { |record, column| "record-#{record.id}-#{column.name}"
|
144
|
+
}} do |table| %>
|
145
|
+
<% table.column :first_name %>
|
146
|
+
<% end %>
|
111
147
|
tfoot_html::
|
112
148
|
(defaults to nil)
|
113
|
-
Hash to specify the styles, classes, id, and other attributes applied to the tfoot element
|
114
|
-
|
115
|
-
Note: If TableFor.render_tfoot_element is set to false, the tfoot surrounding element for the
|
149
|
+
Hash to specify the styles, classes, id, and other attributes applied to the tfoot element.
|
150
|
+
Note: If TableFor.config.tfoot_tag is set to nil, the tfoot surrounding element for the
|
116
151
|
footer row will not be rendered.
|
152
|
+
<%= table_for @users, :tfoot_html => { :id => "tfoot-id" } %>
|
153
|
+
<% table.column :first_name %>
|
154
|
+
<% end %>
|
117
155
|
footer_row_html::
|
118
156
|
(defaults to nil)
|
119
|
-
Hash to specify the styles, classes, id, and other attributes applied to the footer row (tr) element
|
120
|
-
|
157
|
+
Hash to specify the styles, classes, id, and other attributes applied to the footer row (tr) element.
|
158
|
+
<%= table_for @users, :footer_row_html => { :style => 'color: orange' } %>
|
159
|
+
<% table.column :first_name %>
|
160
|
+
<% end %>
|
121
161
|
footer_column_html::
|
122
|
-
|
162
|
+
(defaults to nil)
|
163
|
+
Hash to specify the styles, classes, id, and other attributes applied to the footer column (td) spanning the entire footer row.
|
164
|
+
<%= table_for @users, :footer_column_html =>
|
165
|
+
{ :style => 'color: orange' } %>
|
166
|
+
<% table.column :first_name %>
|
167
|
+
<% end %>
|
123
168
|
|
124
169
|
== table_for column options
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
170
|
+
Each individual table column can specify it's own set of options, which can override any options
|
171
|
+
applied globally in the table options.
|
172
|
+
|
173
|
+
The first argument to the column is optional and represents the name of the column.
|
174
|
+
If specified, it must be unique to the table, and TableFor will attempt to use this
|
175
|
+
field to lookup the value to display in the record, as well as the name to apply to the header column.
|
176
|
+
|
177
|
+
For example, <% table.column :first_name %> will output the first_name field for each record passed to the table.
|
178
|
+
|
179
|
+
If a :header option is not specified for the individual column, it will use this first argument to
|
180
|
+
check for a translation key to give the header of the column a name (see below under Internationalization).
|
181
|
+
Failing to find a translation key, it will titleize "first_name" to "First Name" and use
|
182
|
+
that label for the header of the column.
|
183
|
+
|
184
|
+
The second argument (or first argument if the name of the column is ommitted) to a table column is a hash and is also optional. It is any combination of the following options:
|
185
|
+
|
186
|
+
data::
|
187
|
+
(defaults to nil, unless specified on the entire table)
|
188
|
+
Either an object instance (on which #to_s will be invoked) or a Proc
|
189
|
+
(which can optionally take the current row as an option), representing the text to be shown
|
190
|
+
in the data cell of the column.
|
191
|
+
<%= table_for @users do |table| %>
|
192
|
+
<% table.column :data => "Edit" %>
|
193
|
+
<% table.column :name, :data =>
|
194
|
+
lambda {|user| user.name.underscore.upcase } %>
|
195
|
+
<% end %>
|
196
|
+
formatter::
|
197
|
+
(defaults to nil, unless specified on the entire table)
|
198
|
+
Either a method name, and array with the method to invoke and its arguments,
|
199
|
+
or a Proc (which will be passed the value requiring formatting, based on the current column's name).
|
200
|
+
The :formatter argument will only work if the column name has been specified.
|
201
|
+
In such a case, the current iteration row will be sent the name of the column, and the resulting value will be
|
202
|
+
what's being formatted. If there is a simple method that needs to be applied to the result, that method name can
|
203
|
+
be specified as the formatter, or a series of method names (shown in examples below):
|
204
|
+
<%= table_for @users do |table| %>
|
205
|
+
<% table.column :id, :formatter => :ordinalize %>
|
206
|
+
<% table.column :created_at, :formatter => [:strftime, "%m/%d/%Y"] %>
|
207
|
+
<% table.column :first_name, :formatter =>
|
208
|
+
lambda {|first_name| first_name.downcase } %>
|
209
|
+
<%# THE FOLLOWING IS INVALID %>
|
210
|
+
<% table.column :formatter => :ordinalize %>
|
211
|
+
<% end %>
|
212
|
+
header::
|
213
|
+
(defaults to nil, unless specified on the entire table)
|
214
|
+
Either false, an object instance (on which #to_s will be invoked) or a Proc
|
215
|
+
(which can optionally take the current column as an option),
|
216
|
+
representing the text to be shown in the header cell of the column. If the :header option is not specified,
|
217
|
+
and no column name is specified (the first argument to the column), then no text will be displayed in the
|
218
|
+
header cell.
|
219
|
+
<%= table_for @users,
|
220
|
+
:header => lambda { |column|
|
221
|
+
I18n.t("tables.headers.#{column.name.to_s.underscore}",
|
222
|
+
:default => column.name.to_s.titleize)
|
223
|
+
} do |table| %>
|
224
|
+
<% table.column :id, :header => false %>
|
225
|
+
<% table.column :first_name, :header => "FIRST NAME" %>
|
226
|
+
<% table.column :last_name %>
|
227
|
+
<% end %>
|
228
|
+
sortable::
|
229
|
+
(defaults to false, unless specified on the entire table)
|
230
|
+
Whether this particular column is sortable, which will render a sort link around the header name with a sort_mode
|
231
|
+
field alternating between values 'asc', 'desc', and 'reset'
|
232
|
+
<%= table_for @users, :sortable => true do |table| %>
|
233
|
+
<% table.column :id, :sortable => false %>
|
234
|
+
<% table.column :first_name %>
|
235
|
+
<% end %>
|
236
|
+
sort_url::
|
237
|
+
(defaults to "", a.k.a. the current url, unless specified on the entire table)
|
238
|
+
The sort url that sort links should be generated with
|
239
|
+
<%= table_for @users do |table| %>
|
240
|
+
<% table.column :first_name, :sortable => true,
|
241
|
+
:sort_url => sort_admin_users_path %>
|
242
|
+
<% end %>
|
243
|
+
order::
|
244
|
+
(defaults to the current column's name)
|
245
|
+
The sort order (either a string or symbol) that sort links should be generated with
|
246
|
+
<%= table_for @users, :sortable => true do |table| %>
|
247
|
+
<% table.column :first_name, :order => :fname %>
|
248
|
+
<% table.column :last_name, :order => "lname" %>
|
249
|
+
<% table.column :full_name, :order => "lname,fname" %>
|
250
|
+
<% end %>
|
251
|
+
Note: In the last example, the controller would likely need to split the order param on the comma,
|
252
|
+
and apply the sort_mode to each field in the split, i.e.
|
253
|
+
params[:order].split(",").map do |field|
|
254
|
+
"#{field} #{params[:sort_mode]}"
|
255
|
+
end.join(",")
|
256
|
+
link_url::
|
257
|
+
(defaults to nil, unless specified on the entire table)
|
258
|
+
Either a string or a Proc (which can optionally take the current record being iterated on)
|
259
|
+
which wraps the data columns content in a link.
|
260
|
+
<%= table_for @users do |table| %>
|
261
|
+
<% table.column :id, :link_url =>
|
262
|
+
lambda {|user| edit_admin_user_path(user) } %>
|
263
|
+
<% table.column :header => false,
|
264
|
+
:data => "DELETE",
|
265
|
+
:link_method => :DELETE,
|
266
|
+
:link_url => lambda { admin_user_path(user) } %>
|
267
|
+
<% end %>
|
268
|
+
link_action::
|
269
|
+
(defaults to nil)
|
270
|
+
An alternative to link_url, link_action takes advantage of Rails' url_for method to generate the url to a specific action
|
271
|
+
<%= table_for @users do |table| %>
|
272
|
+
<% table.column :data => "Edit", :link_action => :edit %>
|
273
|
+
<% table.column :data => "Delete", :link_action => :delete
|
274
|
+
# assuming there is a GET delete route defined %>
|
275
|
+
<% table.column :data => "Show", :link => true %>
|
276
|
+
<% end %>
|
277
|
+
link_method::
|
278
|
+
(defaults to nil)
|
279
|
+
The HTML method to be used to trigger the link (GET/PUT/POST/DELETE)
|
280
|
+
<%= table_for @users do |table| %>
|
281
|
+
<% table.column :data => "Delete", :link_method => :DELETE %>
|
282
|
+
<% end %>
|
283
|
+
link_confirm::
|
284
|
+
(defaults to nil)
|
285
|
+
A confirmation message (javascript) that will be displayed when the user clicks the link
|
286
|
+
<%= table_for @users do |table| %>
|
287
|
+
<% table.column :data => "Delete", :link_method => :DELETE,
|
288
|
+
:link_confirm =>
|
289
|
+
"Are you sure you want to delete this user?" %>
|
290
|
+
<% end %>
|
135
291
|
link_html::
|
136
|
-
|
137
|
-
|
138
|
-
|
292
|
+
(defaults to {}, unless specified on the entire table)
|
293
|
+
Hash to specify the styles, classes, id, and other attributes applied to the link element.
|
294
|
+
<%= table_for @users do |table| %>
|
295
|
+
<% table.column :data => "Delete", :link_method => :DELETE,
|
296
|
+
:link_html =>
|
297
|
+
{:style => "color: RED; font-weight: BOLD"} %>
|
298
|
+
<% end %>
|
299
|
+
link_namespace::
|
300
|
+
(defaults to nil, unless specified on the entire table; normally this option would be specified on the entire table)
|
301
|
+
Sets the namespace for the link.
|
302
|
+
For example, a link_namespace of admin would try to build the link within the admin namespace in the routes.
|
303
|
+
This can be specified as a string, an array, a domain object, or a symbol,
|
304
|
+
<%= table_for @users %>
|
305
|
+
<% table.column :first_name, :link_namespace =>
|
306
|
+
[:admin, @post, :comments], :link => true %>
|
307
|
+
<% end %>
|
308
|
+
link::
|
309
|
+
(defaults to false)
|
310
|
+
Sets whether the column's content should render as a link (this can also be accomplished by setting :link_url,
|
311
|
+
:link_action, :link_method, or :link_confirm). Set this to true if you are trying to render a show link, since
|
312
|
+
specifying :link_action as :show would break the call to url_for.
|
313
|
+
<%= table_for @users %>
|
314
|
+
<% table.column :id, :link => true %>
|
315
|
+
<% end %>
|
316
|
+
data_column_html::
|
317
|
+
(defaults to {}, unless specified on the entire table)
|
318
|
+
Hash to specify the styles, classes, id, and other attributes applied to the data column (td) element.
|
319
|
+
The values in this hash can each be a string or a Proc that takes (optionally) the current_record and
|
320
|
+
(also optionally) the column object as parameters
|
321
|
+
<%= table_for @users, :data_column_html =>
|
322
|
+
{ :style => "font-weight: bold",
|
323
|
+
:id => lambda { |record, column| "record-#{record.id}-#{column.name}"
|
324
|
+
}} do |table| %>
|
325
|
+
<% table.column :first_name %>
|
326
|
+
<% table.column :last_name, :data_column_html =>
|
327
|
+
{:style => "color: red"} %>
|
328
|
+
<% end %>
|
329
|
+
header_column_html::
|
330
|
+
(defaults to {}, unless specified on the entire table)
|
331
|
+
Hash to specify the styles, classes, id, and other attributes applied to the header column (th) element.
|
332
|
+
The values in this hash can each be a string or a Proc that takes (optionally) the column object as a parameter.
|
333
|
+
<%= table_for @users, :header_column_html =>
|
334
|
+
{ :style => "font-weight: bold",
|
335
|
+
:class => lambda {|column| "#{column.name}_header" } %>
|
336
|
+
<% table.column :first_name %>
|
337
|
+
<% table.column :last_name, :header_column_html =>
|
338
|
+
{:style => "font-size: 20px"} %>
|
339
|
+
<% end %>
|
139
340
|
|
140
341
|
== table_for header options
|
141
|
-
|
342
|
+
Should you require more control over how a particular header column renders, the default rendering for particular
|
343
|
+
column can easily be replaced. This can be accomplish using the header method within a table_for declaration:
|
344
|
+
|
345
|
+
<%= table_for @users do |table| %>
|
346
|
+
<% table.header :first_name do %>
|
347
|
+
Custom Header Code
|
348
|
+
<% end %>
|
349
|
+
<% table.column :first_name %>
|
350
|
+
<% end %>
|
351
|
+
|
352
|
+
Note: to specify the :header_column_html (the styles / classes to be applied to the th element),
|
353
|
+
this should still be done on the column call:
|
354
|
+
|
355
|
+
<%= table_for @users do |table| %>
|
356
|
+
<% table.header :first_name do %>
|
357
|
+
<%= link_to "First Name", :sort_mode =>
|
358
|
+
(params[:sort_mode] == "asc" ? "desc" :
|
359
|
+
(params[:sort_mode] == "desc" ? "reset" : "asc")) %>
|
360
|
+
<% end %>
|
361
|
+
<% table.column :first_name, :header_column_html => {
|
362
|
+
:class =>
|
363
|
+
lambda { params[:sort_mode] == "asc" ? "sorting_asc" :
|
364
|
+
(params[:sort_mode] == "desc" ? "sorting_desc" : "sorting") }} %>
|
365
|
+
<% end %>
|
366
|
+
|
367
|
+
In the above example, the first name column header will cycle between classes of
|
368
|
+
"sorting_asc", "sorting_desc", and "sorting", while the sort link itself in the header
|
369
|
+
will cycle between sort_mode parameters of "asc", "desc", and "reset". (This is actually
|
370
|
+
the default TableFor sorting behavior)
|
142
371
|
|
143
372
|
== table_for footer options
|
144
|
-
|
373
|
+
There are two ways to specify a footer for a table.
|
374
|
+
|
375
|
+
The first way assumes takes care of rendering the :tfoot element (if TableFor.config.tfoot_tag has not been set to nil),
|
376
|
+
the :tr element, and a single :td element that has its colspan set the number of columns in the table (i.e. it spans the full
|
377
|
+
width of the table):
|
378
|
+
|
379
|
+
<%= table_for @users do |table| %>
|
380
|
+
<% table.column :first_name %>
|
381
|
+
<% table.column :last_name %>
|
382
|
+
<% table.footer do %>
|
383
|
+
<div class="pull-right">
|
384
|
+
<%= will_paginate @users %>
|
385
|
+
</div>
|
386
|
+
<% end %>
|
387
|
+
<% end %>
|
388
|
+
|
389
|
+
The second approach will be described below under "Advanced: Replacing Table Definitions"
|
145
390
|
|
146
391
|
== table_for configuration
|
147
|
-
|
392
|
+
Just as TableFor options can be configured "globally" a single table, it can be configured globally for all tables.
|
393
|
+
|
394
|
+
This is accomplished through the TableFor#setup method. Any options that can be specified in the table_for options
|
395
|
+
can also be specified in an initializer method. For example, consider an application where all tables should
|
396
|
+
automatically have the css class "table table-hover table-bordered". This is easily accomplished in an initializer:
|
397
|
+
|
398
|
+
TableFor.setup do |config|
|
399
|
+
config.table_html = { :class => "table table-hover table-bordered" }
|
400
|
+
end
|
401
|
+
|
402
|
+
Gotcha: At this time, you will not be able to configure any TableFor settings that rely on Rails cycles, as the cycle
|
403
|
+
would be maintained globally and would produce unexpected results.
|
404
|
+
|
405
|
+
Besides the table_for options that may be configured globally, the following addition options may be set:
|
148
406
|
|
149
|
-
|
150
|
-
|
407
|
+
thead_tag::
|
408
|
+
(defaults to :thead)
|
409
|
+
Set this to nil if a thead_tag should not be rendered around the header row of the table.
|
410
|
+
|
411
|
+
tbody_tag::
|
412
|
+
(defaults to :tbody)
|
413
|
+
Set this to nil if a tbody tag should not be rendered around the body data rows of the table.
|
414
|
+
|
415
|
+
tfoot_tag::
|
416
|
+
(defaults to :tfoot)
|
417
|
+
Set this to nil if a tbody tag should not be rendered around the footer row of the table.
|
418
|
+
|
419
|
+
sort_modes::
|
420
|
+
(defaults to [:asc, :desc])
|
421
|
+
Sets the order of sort_mode links. A particular sortable column will, by default, generate a sort link
|
422
|
+
with sort_mode set to :asc. If the sort_mode is already :asc for that column, then it generate the sort
|
423
|
+
link with sort_mode set to :desc. Finally, if the sort_mode is already :desc for that column, it will
|
424
|
+
generate a sort link with sort_mode blank.
|
151
425
|
|
152
426
|
== Internationalization
|
153
427
|
+table-for+ can do some dirty job for you, if you are using i18n by common rails conventions. For example, you have following in your en.yml:
|
@@ -160,8 +434,83 @@ TODO
|
|
160
434
|
name: "Username"
|
161
435
|
bio: "Short biography"
|
162
436
|
|
163
|
-
Then, +table-for+ will automatically
|
437
|
+
Then, +table-for+ will automatically look up correct translations for column headers. If you are not familiar with i18n, you can always pass a custom header to the column:
|
164
438
|
|
165
439
|
<%= table_for @users do |table| %>
|
166
440
|
<% table.column :parent_name, header: "Mr. Smith" %>
|
167
441
|
<% end %>
|
442
|
+
|
443
|
+
== ADVANCED: Replacing table definitions
|
444
|
+
Because TableFor was built on top of {Blocks}[https://github.com/hunterae/blocks],
|
445
|
+
you'll have access to some really cool functionality, such as the ability to replace how any aspect
|
446
|
+
of your table is defined and rendered.
|
447
|
+
|
448
|
+
If you take a cursory look at the file
|
449
|
+
{_table_for.html.erb}[https://github.com/hunterae/table-for/blob/master/app/views/table_for/_table_for.html.erb],
|
450
|
+
you see a series of "table.define" calls. These are defining the various elements of the table, and many are recursive
|
451
|
+
definitions by nature.
|
452
|
+
|
453
|
+
For example, the call to "table.define :table", has calls to "table.render :header", "table.render :body", and "table.render :footer".
|
454
|
+
Below the "table.define :table", you'll find the calls to "table.define :header", "table.define :body", and "table.define :footer".
|
455
|
+
It shouldn't be hard to see the you're defining the table html element, and the table is made up of a header, a body, and a footer.
|
456
|
+
The header is made up a header row, the body is made up of data rows, and the footer is made up of a footer row. Each of those
|
457
|
+
rows is broken down into further definitions.
|
458
|
+
|
459
|
+
A question worth asking then is what is really happening here:
|
460
|
+
<%= table_for @users do |table| %>
|
461
|
+
<% table.column :full_name do |user| %>
|
462
|
+
Overriden: <%= "#{user.first_name} #{user.last_name}" %>
|
463
|
+
<% end %>
|
464
|
+
<% end %>
|
465
|
+
|
466
|
+
By passing a block in the definition of the :full_name column, we are overriding the default definition for
|
467
|
+
the full_name block (the default definition can be found
|
468
|
+
{here}[https://github.com/hunterae/table-for/blob/master/app/views/table_for/_table_for.html.erb#L51-L54]).
|
469
|
+
Should we not have specified the block, it would have called #full_name on the user object
|
470
|
+
for each row. But as it is, we've overridden the default behavior for this column.
|
471
|
+
|
472
|
+
Note: table.column is an alias to the #queue method, inherited from {WithTemplate}[https://github.com/hunterae/with_template].
|
473
|
+
It works very similar to the "table.define" calls, but preserves the order in which blocks are defined. Because the order
|
474
|
+
of table columns is important, this is the reason for using #queue instead of #define.
|
475
|
+
|
476
|
+
Applying the above principle, it shouldn't be much of a stretch to see that any piece of the TableFor definition may easily
|
477
|
+
be replaced. For example, suppose we didn't like the way footers are {defined}[https://github.com/hunterae/table-for/blob/master/app/views/table_for/_table_for.html.erb#L56-L60].
|
478
|
+
|
479
|
+
To replace this definition, simply #define a footer block:
|
480
|
+
|
481
|
+
<%= table_for @users do |table| %>
|
482
|
+
<% table.column :first_name %>
|
483
|
+
<% table.column :last_name %>
|
484
|
+
<% table.define :footer do %>
|
485
|
+
<tfoot>
|
486
|
+
<tr>
|
487
|
+
<td colspan="<%= table.columns.length %>">
|
488
|
+
<div class="pull-right">
|
489
|
+
<%= will_paginate @users %>
|
490
|
+
</div>
|
491
|
+
</td>
|
492
|
+
</tr>
|
493
|
+
</tfoot>
|
494
|
+
<% end %>
|
495
|
+
<% end %>
|
496
|
+
|
497
|
+
== ADVANCED: Using "Before" and "After" hooks
|
498
|
+
Another benefit of TableFor being built on top of {Blocks}[https://github.com/hunterae/blocks] is the ability
|
499
|
+
to define before and after blocks. Before blocks will render code before a particular named block is rendered;
|
500
|
+
after blocks will render code after said block. So suppose we wanted to render an extra row after every data row
|
501
|
+
rendered that provided some additional data. By examining the TableFor
|
502
|
+
{DTD}[https://github.com/hunterae/table-for/blob/master/app/views/table_for/_table_for.html.erb#L38-L43],
|
503
|
+
we can see the block responsible for rendering an individual data row is called :data_row. With this knowledge,
|
504
|
+
we can easily render an extra row after each data_row:
|
505
|
+
|
506
|
+
<%= table_for @users do |table| %>
|
507
|
+
<% table.column :first_name %>
|
508
|
+
<% table.column :last_name %>
|
509
|
+
<% table.after :data_row do %>
|
510
|
+
<tr>
|
511
|
+
<td colspan="<%= table.columns.length %>">
|
512
|
+
Some extra data
|
513
|
+
</td>
|
514
|
+
</tr>
|
515
|
+
<% end %>
|
516
|
+
<% end %>
|
data/Rakefile
CHANGED
@@ -1,49 +1,10 @@
|
|
1
1
|
require 'rspec/core/rake_task'
|
2
|
+
require 'bundler/gem_tasks'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
task
|
7
|
-
|
8
|
-
require 'rubygems'
|
9
|
-
require 'bundler'
|
10
|
-
begin
|
11
|
-
Bundler.setup(:default, :development)
|
12
|
-
rescue Bundler::BundlerError => e
|
13
|
-
$stderr.puts e.message
|
14
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
15
|
-
exit e.status_code
|
4
|
+
# Default directory to look in is `/specs`
|
5
|
+
# Run with `rake spec`
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
+
task.rspec_opts = ['--color', '--format', 'nested']
|
16
8
|
end
|
17
|
-
require 'rake'
|
18
9
|
|
19
|
-
|
20
|
-
Jeweler::Tasks.new do |gem|
|
21
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
22
|
-
gem.name = "table-for"
|
23
|
-
gem.homepage = "http://github.com/hunterae/table-for"
|
24
|
-
gem.license = "MIT"
|
25
|
-
gem.summary = "table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated"
|
26
|
-
gem.description = "table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated"
|
27
|
-
gem.email = "hunterae@gmail.com"
|
28
|
-
gem.authors = ["Andrew Hunter"]
|
29
|
-
# dependencies defined in Gemfile
|
30
|
-
end
|
31
|
-
Jeweler::RubygemsDotOrgTasks.new
|
32
|
-
|
33
|
-
require 'rake/testtask'
|
34
|
-
Rake::TestTask.new(:test) do |test|
|
35
|
-
test.libs << 'lib' << 'test'
|
36
|
-
test.pattern = 'test/**/test_*.rb'
|
37
|
-
test.verbose = true
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
require 'rdoc/task'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "table-for #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
10
|
+
task :default => :spec
|
@@ -2,7 +2,6 @@
|
|
2
2
|
<%= content_tag :table, options[:table_html] do %>
|
3
3
|
<%= table.render :header %>
|
4
4
|
<%= table.render :body %>
|
5
|
-
<%# Purposely no default implementation for the tfoot block given, since most tables do not have footers (provided to for easy hook to add a footer). %>
|
6
5
|
<%= table.render :footer %>
|
7
6
|
<% end %>
|
8
7
|
<% end %>
|
data/example.rdoc
CHANGED
@@ -27,6 +27,17 @@ From console:
|
|
27
27
|
rake db:create && rake db:migrate && rake db:seed && rake db:seed && rake db:seed && rake db:seed
|
28
28
|
rails s
|
29
29
|
|
30
|
+
NOTE:
|
31
|
+
It does not appear that nifty-generators has been ported over to Rails 4. If you are using Rails 4, you will
|
32
|
+
need to remove this gem from the Gemfile, and run the following commands from the console instead of the preceding
|
33
|
+
commands:
|
34
|
+
bundle install
|
35
|
+
rails generate controller admin/users index
|
36
|
+
rails generate model user email:string first_name:string last_name:string
|
37
|
+
rails generate bootstrap:install less
|
38
|
+
rake db:create && rake db:migrate && rake db:seed && rake db:seed && rake db:seed && rake db:seed
|
39
|
+
rails s
|
40
|
+
|
30
41
|
In routes.rb:
|
31
42
|
namespace :admin do
|
32
43
|
resources :users do
|
@@ -135,4 +146,4 @@ In views/admin/users/index.html.erb
|
|
135
146
|
<%= will_paginate @users %>
|
136
147
|
</div>
|
137
148
|
<% end %>
|
138
|
-
<% end %>
|
149
|
+
<% end %>
|
data/lib/table_for.rb
CHANGED
data/lib/table_for/base.rb
CHANGED
@@ -25,7 +25,12 @@ module TableFor
|
|
25
25
|
header_column_html = call_each_hash_value_with_params(options[:header_column_html], column)
|
26
26
|
if options[:sortable]
|
27
27
|
order = options[:order] ? options[:order].to_s : column.name.to_s
|
28
|
-
|
28
|
+
|
29
|
+
sort_modes = TableFor.config.sort_modes
|
30
|
+
current_sort_mode = (view.params[:order] != order || view.params[:sort_mode].blank?) ? nil : view.params[:sort_mode]
|
31
|
+
current_sort_mode = sort_modes[sort_modes.index(current_sort_mode.to_sym)] rescue nil if current_sort_mode
|
32
|
+
sort_class = "sorting#{"_#{current_sort_mode}" if current_sort_mode}"
|
33
|
+
|
29
34
|
header_column_html[:class] = (header_column_html[:class] ? "#{header_column_html[:class]} #{sort_class}" : sort_class)
|
30
35
|
end
|
31
36
|
header_column_html
|
@@ -76,8 +81,17 @@ module TableFor
|
|
76
81
|
def header_sort_link(column, options={}, &block)
|
77
82
|
if options[:sortable] && (options[:header] || !column.anonymous)
|
78
83
|
order = options[:order] ? options[:order].to_s : column.name.to_s
|
79
|
-
|
80
|
-
|
84
|
+
|
85
|
+
sort_modes = TableFor.config.sort_modes
|
86
|
+
current_sort_mode = (view.params[:order] != order || view.params[:sort_mode].blank?) ? nil : view.params[:sort_mode]
|
87
|
+
next_sort_mode_index = sort_modes.index(current_sort_mode.to_sym) + 1 rescue 0
|
88
|
+
if next_sort_mode_index == sort_modes.length
|
89
|
+
next_sort_mode = nil
|
90
|
+
else
|
91
|
+
next_sort_mode = sort_modes[next_sort_mode_index]
|
92
|
+
end
|
93
|
+
|
94
|
+
parameters = view.params.merge(:order => order, :sort_mode => next_sort_mode)
|
81
95
|
parameters.delete(:action)
|
82
96
|
parameters.delete(:controller)
|
83
97
|
url = options[:sort_url] ? options[:sort_url] : ""
|
@@ -396,14 +396,14 @@ describe "table_for" do
|
|
396
396
|
end
|
397
397
|
xml = XmlSimple.xml_in(%%
|
398
398
|
<table>
|
399
|
-
<thead><tr><th class="sorting_desc"><a href="?order=email&sort_mode=
|
399
|
+
<thead><tr><th class="sorting_desc"><a href="?order=email&sort_mode=">Email</a></th></tr></thead>
|
400
400
|
<tbody><tr><td>andrew.hunter@livingsocial.com</td></tr></tbody>
|
401
401
|
</table>%)
|
402
402
|
XmlSimple.xml_in(buffer, 'NormaliseSpace' => 2).should eql xml
|
403
403
|
end
|
404
404
|
|
405
405
|
it "should add a 'sorting' class to the 'th' element and a link around the header content if a column is sortable and the sort_mode is in reset mode" do
|
406
|
-
@view.expects(:params).at_least_once.returns({:order => "email", :sort_mode => "
|
406
|
+
@view.expects(:params).at_least_once.returns({:order => "email", :sort_mode => ""})
|
407
407
|
buffer = @view.table_for @users[0,1] do |table|
|
408
408
|
table.column :email, :sortable => true
|
409
409
|
end
|
data/spec/table_for/base_spec.rb
CHANGED
@@ -100,8 +100,8 @@ describe TableFor::Base do
|
|
100
100
|
header_column_html[:class].should eql "sorting_desc"
|
101
101
|
end
|
102
102
|
|
103
|
-
it "should add a 'sorting' class to the header_column_html class if a column is sortable and it is
|
104
|
-
@view.expects(:params).at_least_once.returns(:order => @column.name.to_s, :sort_mode => "
|
103
|
+
it "should add a 'sorting' class to the header_column_html class if a column is sortable and it is blank sort mode" do
|
104
|
+
@view.expects(:params).at_least_once.returns(:order => @column.name.to_s, :sort_mode => "")
|
105
105
|
header_column_html = @base.header_column_html(@column, :sortable => true)
|
106
106
|
header_column_html[:class].should eql "sorting"
|
107
107
|
end
|
@@ -126,7 +126,7 @@ describe TableFor::Base do
|
|
126
126
|
|
127
127
|
it "should be able to generate a sort link for a column if that column is sortable and it is already sorted in desc order" do
|
128
128
|
@view.expects(:params).at_least_once.returns(:order => @column.name.to_s, :sort_mode => "desc")
|
129
|
-
@view.expects(:link_to).with(@column.name.to_s.titleize, "?order=#{@column.name}&sort_mode=
|
129
|
+
@view.expects(:link_to).with(@column.name.to_s.titleize, "?order=#{@column.name}&sort_mode=").returns "my link"
|
130
130
|
@base.header_sort_link(@column, :sortable => true).should eql "my link"
|
131
131
|
end
|
132
132
|
|
data/table-for.gemspec
CHANGED
@@ -1,91 +1,31 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'table_for/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "table-for"
|
8
|
+
spec.version = TableFor::VERSION
|
9
|
+
spec.authors = ["Andrew Hunter"]
|
10
|
+
spec.email = ["hunterae@gmail.com"]
|
11
|
+
spec.summary = %q{table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated}
|
12
|
+
spec.description = %q{table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated}
|
13
|
+
spec.homepage = "http://github.com/hunterae/table-for"
|
14
|
+
spec.license = "MIT"
|
9
15
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
s.email = "hunterae@gmail.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.rdoc"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
".rspec",
|
20
|
-
".ruby-gemset",
|
21
|
-
".ruby-version",
|
22
|
-
"CHANGELOG.rdoc",
|
23
|
-
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
|
-
"README.rdoc",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"app/views/table_for/_table_for.html.erb",
|
29
|
-
"example.rdoc",
|
30
|
-
"example_table.png",
|
31
|
-
"lib/table-for.rb",
|
32
|
-
"lib/table_for.rb",
|
33
|
-
"lib/table_for/base.rb",
|
34
|
-
"lib/table_for/engine.rb",
|
35
|
-
"lib/table_for/view_additions.rb",
|
36
|
-
"rails/init.rb",
|
37
|
-
"spec/integration/table_for_spec.rb",
|
38
|
-
"spec/spec_helper.rb",
|
39
|
-
"spec/table_for/base_spec.rb",
|
40
|
-
"spec/table_for/view_additions_spec.rb",
|
41
|
-
"table-for.gemspec"
|
42
|
-
]
|
43
|
-
s.homepage = "http://github.com/hunterae/table-for"
|
44
|
-
s.licenses = ["MIT"]
|
45
|
-
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = "1.8.25"
|
47
|
-
s.summary = "table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated"
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
48
20
|
|
49
|
-
|
50
|
-
|
21
|
+
spec.add_dependency "rails", ">= 3.0.0"
|
22
|
+
spec.add_dependency "with_template", "~> 0.0.6"
|
51
23
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
60
|
-
s.add_development_dependency(%q<with_model>, ["= 0.2.6"])
|
61
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.3.5"])
|
62
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
63
|
-
s.add_development_dependency(%q<debugger>, [">= 0"])
|
64
|
-
else
|
65
|
-
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
66
|
-
s.add_dependency(%q<with_template>, ["~> 0.0.6"])
|
67
|
-
s.add_dependency(%q<rspec-rails>, [">= 2.0.0.beta.20"])
|
68
|
-
s.add_dependency(%q<mocha>, ["= 0.10.3"])
|
69
|
-
s.add_dependency(%q<xml-simple>, ["= 1.1.1"])
|
70
|
-
s.add_dependency(%q<supermodel>, ["= 0.1.4"])
|
71
|
-
s.add_dependency(%q<sqlite3>, [">= 0"])
|
72
|
-
s.add_dependency(%q<with_model>, ["= 0.2.6"])
|
73
|
-
s.add_dependency(%q<bundler>, ["~> 1.3.5"])
|
74
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
75
|
-
s.add_dependency(%q<debugger>, [">= 0"])
|
76
|
-
end
|
77
|
-
else
|
78
|
-
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
79
|
-
s.add_dependency(%q<with_template>, ["~> 0.0.6"])
|
80
|
-
s.add_dependency(%q<rspec-rails>, [">= 2.0.0.beta.20"])
|
81
|
-
s.add_dependency(%q<mocha>, ["= 0.10.3"])
|
82
|
-
s.add_dependency(%q<xml-simple>, ["= 1.1.1"])
|
83
|
-
s.add_dependency(%q<supermodel>, ["= 0.1.4"])
|
84
|
-
s.add_dependency(%q<sqlite3>, [">= 0"])
|
85
|
-
s.add_dependency(%q<with_model>, ["= 0.2.6"])
|
86
|
-
s.add_dependency(%q<bundler>, ["~> 1.3.5"])
|
87
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
88
|
-
s.add_dependency(%q<debugger>, [">= 0"])
|
89
|
-
end
|
24
|
+
spec.add_development_dependency "rspec-rails", ">= 2.0.0.beta.20"
|
25
|
+
spec.add_development_dependency "mocha", "0.10.3"
|
26
|
+
spec.add_development_dependency "xml-simple", "1.1.1"
|
27
|
+
spec.add_development_dependency "supermodel", "0.1.4"
|
28
|
+
spec.add_development_dependency "sqlite3"
|
29
|
+
spec.add_development_dependency "with_model", "0.2.6"
|
30
|
+
spec.add_development_dependency "debugger"
|
90
31
|
end
|
91
|
-
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table-for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
5
|
-
prerelease:
|
4
|
+
version: 3.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrew Hunter
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: with_template
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec-rails
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: mocha
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - '='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - '='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: xml-simple
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - '='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - '='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: supermodel
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - '='
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - '='
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: sqlite3
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ! '>='
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ! '>='
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -126,7 +111,6 @@ dependencies:
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: with_model
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - '='
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,47 +118,13 @@ dependencies:
|
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - '='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: 0.2.6
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: bundler
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ~>
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: 1.3.5
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ~>
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: 1.3.5
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: jeweler
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ~>
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: 1.8.4
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ~>
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: 1.8.4
|
174
125
|
- !ruby/object:Gem::Dependency
|
175
126
|
name: debugger
|
176
127
|
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
128
|
requirements:
|
179
129
|
- - ! '>='
|
180
130
|
- !ruby/object:Gem::Version
|
@@ -182,19 +132,19 @@ dependencies:
|
|
182
132
|
type: :development
|
183
133
|
prerelease: false
|
184
134
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
135
|
requirements:
|
187
136
|
- - ! '>='
|
188
137
|
- !ruby/object:Gem::Version
|
189
138
|
version: '0'
|
190
139
|
description: table-for is a table builder for an array of objects, easily allowing
|
191
140
|
overriding of how any aspect of the table is generated
|
192
|
-
email:
|
141
|
+
email:
|
142
|
+
- hunterae@gmail.com
|
193
143
|
executables: []
|
194
144
|
extensions: []
|
195
|
-
extra_rdoc_files:
|
196
|
-
- README.rdoc
|
145
|
+
extra_rdoc_files: []
|
197
146
|
files:
|
147
|
+
- .gitignore
|
198
148
|
- .rspec
|
199
149
|
- .ruby-gemset
|
200
150
|
- .ruby-version
|
@@ -203,7 +153,6 @@ files:
|
|
203
153
|
- Gemfile.lock
|
204
154
|
- README.rdoc
|
205
155
|
- Rakefile
|
206
|
-
- VERSION
|
207
156
|
- app/views/table_for/_table_for.html.erb
|
208
157
|
- example.rdoc
|
209
158
|
- example_table.png
|
@@ -211,6 +160,7 @@ files:
|
|
211
160
|
- lib/table_for.rb
|
212
161
|
- lib/table_for/base.rb
|
213
162
|
- lib/table_for/engine.rb
|
163
|
+
- lib/table_for/version.rb
|
214
164
|
- lib/table_for/view_additions.rb
|
215
165
|
- rails/init.rb
|
216
166
|
- spec/integration/table_for_spec.rb
|
@@ -221,30 +171,30 @@ files:
|
|
221
171
|
homepage: http://github.com/hunterae/table-for
|
222
172
|
licenses:
|
223
173
|
- MIT
|
174
|
+
metadata: {}
|
224
175
|
post_install_message:
|
225
176
|
rdoc_options: []
|
226
177
|
require_paths:
|
227
178
|
- lib
|
228
179
|
required_ruby_version: !ruby/object:Gem::Requirement
|
229
|
-
none: false
|
230
180
|
requirements:
|
231
181
|
- - ! '>='
|
232
182
|
- !ruby/object:Gem::Version
|
233
183
|
version: '0'
|
234
|
-
segments:
|
235
|
-
- 0
|
236
|
-
hash: -2937228185400889819
|
237
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
|
-
none: false
|
239
185
|
requirements:
|
240
186
|
- - ! '>='
|
241
187
|
- !ruby/object:Gem::Version
|
242
188
|
version: '0'
|
243
189
|
requirements: []
|
244
190
|
rubyforge_project:
|
245
|
-
rubygems_version:
|
191
|
+
rubygems_version: 2.2.2
|
246
192
|
signing_key:
|
247
|
-
specification_version:
|
193
|
+
specification_version: 4
|
248
194
|
summary: table-for is a table builder for an array of objects, easily allowing overriding
|
249
195
|
of how any aspect of the table is generated
|
250
|
-
test_files:
|
196
|
+
test_files:
|
197
|
+
- spec/integration/table_for_spec.rb
|
198
|
+
- spec/spec_helper.rb
|
199
|
+
- spec/table_for/base_spec.rb
|
200
|
+
- spec/table_for/view_additions_spec.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.2.0
|