table-for 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
1
  1.1.0 (February 4, 2012)
2
2
 
3
- * Removed dependency on rails 3.1, switched to >= 3.0.0
3
+ * Removed dependency on rails 3.1, switched to >= 3.0.0
4
+
5
+ 1.2.0 (February 5, 2012)
6
+
7
+ * Upgraded dependency on BuildingBlocks to at least version 1.2.0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -1,31 +1,31 @@
1
1
  <% table.define :table do |options| %>
2
2
  <%= content_tag :table, options[:table_html] do %>
3
- <%= table.use :thead %>
4
- <%= table.use :tbody %>
3
+ <%= table.render :thead %>
4
+ <%= table.render :tbody %>
5
5
  <% end %>
6
6
  <% end %>
7
7
 
8
8
  <% table.define :thead do |options| %>
9
9
  <%= content_tag :thead, options[:thead_html] do %>
10
- <%= table.use :header_row %>
10
+ <%= table.render :header_row %>
11
11
  <% end %>
12
12
  <% end %>
13
13
 
14
14
  <% table.define :header_row do |options| %>
15
15
  <%= content_tag :tr, options[:header_row_html] do %>
16
- <%= table.use :header_columns %>
16
+ <%= table.render :header_columns %>
17
17
  <% end %>
18
18
  <% end %>
19
19
 
20
20
  <% table.define :header_columns do |options| %>
21
21
  <% table.columns.each do |column| %>
22
- <%= table.use :header_column, column, column.options %>
22
+ <%= table.render :header_column, column, column.options %>
23
23
  <% end %>
24
24
  <% end %>
25
25
 
26
26
  <% table.define :header_column do |column, options| %>
27
27
  <%= content_tag :th, table_for_header_html(column, options) do %>
28
- <%= table.use "#{column.name}_header", column, column.options %>
28
+ <%= table.render "#{column.name}_header", column, column.options %>
29
29
  <% end %>
30
30
  <% end %>
31
31
 
@@ -47,31 +47,31 @@
47
47
 
48
48
  <% table.define :tbody do |options| %>
49
49
  <%= content_tag :tbody, options[:tbody_html] do %>
50
- <%= table.use :rows %>
50
+ <%= table.render :rows %>
51
51
  <% end %>
52
52
  <% end %>
53
53
 
54
54
  <% table.define :rows do |options| %>
55
55
  <% records.each do |record| %>
56
- <%= table.use :row, record %>
56
+ <%= table.render :row, record %>
57
57
  <% end %>
58
58
  <% end %>
59
59
 
60
60
  <% table.define :row do |record, options| %>
61
61
  <%= content_tag :tr, table_for_evaluated_options(record, options[:row_html]) do %>
62
- <%= table.use :columns, record %>
62
+ <%= table.render :columns, record %>
63
63
  <% end %>
64
64
  <% end %>
65
65
 
66
66
  <% table.define :columns do |record, options| %>
67
67
  <% table.columns.each do |column| %>
68
- <%= table.use :column, record, column, column.options %>
68
+ <%= table.render :column, record, column, column.options %>
69
69
  <% end %>
70
70
  <% end %>
71
71
 
72
72
  <% table.define :column do |record, column, options| %>
73
73
  <%= content_tag :td, table_for_evaluated_options(record, column, options[:column_html]) do %>
74
- <%= table.use column.name, record, column, column.options %>
74
+ <%= table.render column.name, record, column, column.options %>
75
75
  <% end %>
76
76
  <% end %>
77
77
 
@@ -95,4 +95,4 @@
95
95
  <% end %>
96
96
  <% end %>
97
97
 
98
- <%= table.use :table %>
98
+ <%= table.render :table %>
@@ -2,11 +2,7 @@ module TableFor
2
2
  module ViewAdditions
3
3
  module ClassMethods
4
4
  def table_for(records, options={}, &block)
5
- options[:records] = records
6
- options[:template] = "table_for/table_for"
7
- options[:variable] = "table"
8
-
9
- TableFor::Base.new(self, options, &block).render
5
+ TableFor::Base.new(self, options.merge(:variable => "table", :records => records)).render_template("table_for/table_for", &block)
10
6
  end
11
7
 
12
8
  def table_for_evaluated_options(*args)
@@ -11,33 +11,33 @@ describe TableFor::ViewAdditions do
11
11
  end
12
12
 
13
13
  describe "table_for method" do
14
- it "should call render on the TableFor::Base instance" do
15
- TableFor::Base.expects(:new).returns(mock(:render => ""))
14
+ it "should call render_template on the TableFor::Base instance" do
15
+ TableFor::Base.expects(:new).returns(mock(:render_template => ""))
16
16
  @view.table_for(@records)
17
17
  end
18
18
 
19
19
  it "should pass the view as the first parameter to TableFor::Base initialization" do
20
- TableFor::Base.expects(:new).with {|view, options| view == @view}.returns(mock(:render => ""))
20
+ TableFor::Base.expects(:new).with {|view, options| view == @view}.returns(mock(:render_template => ""))
21
21
  @view.table_for(@records)
22
22
  end
23
23
 
24
24
  it "should default the template to render" do
25
- TableFor::Base.expects(:new).with {|view, options| options[:template] == "table_for/table_for"}.returns(mock(:render => ""))
25
+ TableFor::Base.any_instance.expects(:render_template).with {|template| template == "table_for/table_for"}.returns("")
26
26
  @view.table_for(@records)
27
27
  end
28
28
 
29
29
  it "should default the variable to 'table' to render" do
30
- TableFor::Base.expects(:new).with {|view, options| options[:variable] == "table"}.returns(mock(:render => ""))
30
+ TableFor::Base.expects(:new).with {|view, options| options[:variable] == "table"}.returns(mock(:render_template => ""))
31
31
  @view.table_for(@records)
32
32
  end
33
33
 
34
34
  it "should default the records to the collection passed in" do
35
- TableFor::Base.expects(:new).with {|view, options| options[:records] == @records}.returns(mock(:render => ""))
35
+ TableFor::Base.expects(:new).with {|view, options| options[:records] == @records}.returns(mock(:render_template => ""))
36
36
  @view.table_for(@records)
37
37
  end
38
38
 
39
39
  it "should add any runtime options to the options initialized for TableFor::Base" do
40
- TableFor::Base.expects(:new).with {|view, options| options[:option1] == 1 && options[:option2] == "2"}.returns(mock(:render => ""))
40
+ TableFor::Base.expects(:new).with {|view, options| options[:option1] == 1 && options[:option2] == "2"}.returns(mock(:render_template => ""))
41
41
  @view.table_for(@records, :option1 => 1, :option2 => "2")
42
42
  end
43
43
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table-for
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Hunter
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-04 00:00:00 -05:00
18
+ date: 2012-02-05 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -55,12 +55,12 @@ dependencies:
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- hash: 23
58
+ hash: 31
59
59
  segments:
60
60
  - 1
61
+ - 2
61
62
  - 0
62
- - 0
63
- version: 1.0.0
63
+ version: 1.2.0
64
64
  prerelease: false
65
65
  type: :runtime
66
66
  requirement: *id003
@@ -79,21 +79,25 @@ dependencies:
79
79
  type: :development
80
80
  requirement: *id004
81
81
  - !ruby/object:Gem::Dependency
82
- name: jeweler
82
+ name: rspec-rails
83
83
  version_requirements: &id005 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- hash: 3
88
+ hash: -1271655756
89
89
  segments:
90
+ - 2
90
91
  - 0
91
- version: "0"
92
+ - 0
93
+ - beta
94
+ - 20
95
+ version: 2.0.0.beta.20
92
96
  prerelease: false
93
97
  type: :development
94
98
  requirement: *id005
95
99
  - !ruby/object:Gem::Dependency
96
- name: jeweler
100
+ name: mocha
97
101
  version_requirements: &id006 !ruby/object:Gem::Requirement
98
102
  none: false
99
103
  requirements:
@@ -107,7 +111,7 @@ dependencies:
107
111
  type: :development
108
112
  requirement: *id006
109
113
  - !ruby/object:Gem::Dependency
110
- name: jeweler
114
+ name: xml-simple
111
115
  version_requirements: &id007 !ruby/object:Gem::Requirement
112
116
  none: false
113
117
  requirements:
@@ -121,7 +125,7 @@ dependencies:
121
125
  type: :development
122
126
  requirement: *id007
123
127
  - !ruby/object:Gem::Dependency
124
- name: jeweler
128
+ name: supermodel
125
129
  version_requirements: &id008 !ruby/object:Gem::Requirement
126
130
  none: false
127
131
  requirements:
@@ -135,7 +139,7 @@ dependencies:
135
139
  type: :development
136
140
  requirement: *id008
137
141
  - !ruby/object:Gem::Dependency
138
- name: jeweler
142
+ name: sqlite3
139
143
  version_requirements: &id009 !ruby/object:Gem::Requirement
140
144
  none: false
141
145
  requirements:
@@ -148,6 +152,224 @@ dependencies:
148
152
  prerelease: false
149
153
  type: :development
150
154
  requirement: *id009
155
+ - !ruby/object:Gem::Dependency
156
+ name: with_model
157
+ version_requirements: &id010 !ruby/object:Gem::Requirement
158
+ none: false
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ hash: 3
163
+ segments:
164
+ - 0
165
+ version: "0"
166
+ prerelease: false
167
+ type: :development
168
+ requirement: *id010
169
+ - !ruby/object:Gem::Dependency
170
+ name: jeweler
171
+ version_requirements: &id011 !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ hash: 3
177
+ segments:
178
+ - 0
179
+ version: "0"
180
+ prerelease: false
181
+ type: :development
182
+ requirement: *id011
183
+ - !ruby/object:Gem::Dependency
184
+ name: rspec-rails
185
+ version_requirements: &id012 !ruby/object:Gem::Requirement
186
+ none: false
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ hash: -1271655756
191
+ segments:
192
+ - 2
193
+ - 0
194
+ - 0
195
+ - beta
196
+ - 20
197
+ version: 2.0.0.beta.20
198
+ prerelease: false
199
+ type: :development
200
+ requirement: *id012
201
+ - !ruby/object:Gem::Dependency
202
+ name: mocha
203
+ version_requirements: &id013 !ruby/object:Gem::Requirement
204
+ none: false
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ hash: 3
209
+ segments:
210
+ - 0
211
+ version: "0"
212
+ prerelease: false
213
+ type: :development
214
+ requirement: *id013
215
+ - !ruby/object:Gem::Dependency
216
+ name: xml-simple
217
+ version_requirements: &id014 !ruby/object:Gem::Requirement
218
+ none: false
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ hash: 3
223
+ segments:
224
+ - 0
225
+ version: "0"
226
+ prerelease: false
227
+ type: :development
228
+ requirement: *id014
229
+ - !ruby/object:Gem::Dependency
230
+ name: supermodel
231
+ version_requirements: &id015 !ruby/object:Gem::Requirement
232
+ none: false
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ hash: 3
237
+ segments:
238
+ - 0
239
+ version: "0"
240
+ prerelease: false
241
+ type: :development
242
+ requirement: *id015
243
+ - !ruby/object:Gem::Dependency
244
+ name: sqlite3
245
+ version_requirements: &id016 !ruby/object:Gem::Requirement
246
+ none: false
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ hash: 3
251
+ segments:
252
+ - 0
253
+ version: "0"
254
+ prerelease: false
255
+ type: :development
256
+ requirement: *id016
257
+ - !ruby/object:Gem::Dependency
258
+ name: with_model
259
+ version_requirements: &id017 !ruby/object:Gem::Requirement
260
+ none: false
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ hash: 3
265
+ segments:
266
+ - 0
267
+ version: "0"
268
+ prerelease: false
269
+ type: :development
270
+ requirement: *id017
271
+ - !ruby/object:Gem::Dependency
272
+ name: jeweler
273
+ version_requirements: &id018 !ruby/object:Gem::Requirement
274
+ none: false
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ hash: 3
279
+ segments:
280
+ - 0
281
+ version: "0"
282
+ prerelease: false
283
+ type: :development
284
+ requirement: *id018
285
+ - !ruby/object:Gem::Dependency
286
+ name: rspec-rails
287
+ version_requirements: &id019 !ruby/object:Gem::Requirement
288
+ none: false
289
+ requirements:
290
+ - - ">="
291
+ - !ruby/object:Gem::Version
292
+ hash: -1271655756
293
+ segments:
294
+ - 2
295
+ - 0
296
+ - 0
297
+ - beta
298
+ - 20
299
+ version: 2.0.0.beta.20
300
+ prerelease: false
301
+ type: :development
302
+ requirement: *id019
303
+ - !ruby/object:Gem::Dependency
304
+ name: mocha
305
+ version_requirements: &id020 !ruby/object:Gem::Requirement
306
+ none: false
307
+ requirements:
308
+ - - ">="
309
+ - !ruby/object:Gem::Version
310
+ hash: 3
311
+ segments:
312
+ - 0
313
+ version: "0"
314
+ prerelease: false
315
+ type: :development
316
+ requirement: *id020
317
+ - !ruby/object:Gem::Dependency
318
+ name: xml-simple
319
+ version_requirements: &id021 !ruby/object:Gem::Requirement
320
+ none: false
321
+ requirements:
322
+ - - ">="
323
+ - !ruby/object:Gem::Version
324
+ hash: 3
325
+ segments:
326
+ - 0
327
+ version: "0"
328
+ prerelease: false
329
+ type: :development
330
+ requirement: *id021
331
+ - !ruby/object:Gem::Dependency
332
+ name: supermodel
333
+ version_requirements: &id022 !ruby/object:Gem::Requirement
334
+ none: false
335
+ requirements:
336
+ - - ">="
337
+ - !ruby/object:Gem::Version
338
+ hash: 3
339
+ segments:
340
+ - 0
341
+ version: "0"
342
+ prerelease: false
343
+ type: :development
344
+ requirement: *id022
345
+ - !ruby/object:Gem::Dependency
346
+ name: sqlite3
347
+ version_requirements: &id023 !ruby/object:Gem::Requirement
348
+ none: false
349
+ requirements:
350
+ - - ">="
351
+ - !ruby/object:Gem::Version
352
+ hash: 3
353
+ segments:
354
+ - 0
355
+ version: "0"
356
+ prerelease: false
357
+ type: :development
358
+ requirement: *id023
359
+ - !ruby/object:Gem::Dependency
360
+ name: with_model
361
+ version_requirements: &id024 !ruby/object:Gem::Requirement
362
+ none: false
363
+ requirements:
364
+ - - ">="
365
+ - !ruby/object:Gem::Version
366
+ hash: 3
367
+ segments:
368
+ - 0
369
+ version: "0"
370
+ prerelease: false
371
+ type: :development
372
+ requirement: *id024
151
373
  description: table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated
152
374
  email: hunterae@gmail.com
153
375
  executables: []