public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
Revert partial counter and yielding.
wycats (author)
Tue Jun 10 21:58:45 -0700 2008
commit  ce9a7f1e77fcb633db0f936467a77d2fdf687437
tree    f73adff0bffce1cdbe493a99ca4ecba9b685889e
parent  a09128eac56b9333324692a2ddf2be688c33de85
...
230
231
232
233
234
235
236
237
238
...
241
242
243
244
245
246
247
248
249
 
250
251
252
...
269
270
271
272
 
273
274
275
276
277
 
 
278
279
280
...
230
231
232
 
 
 
233
234
235
...
238
239
240
 
 
 
 
 
 
241
242
243
244
...
261
262
263
 
264
265
 
 
 
 
266
267
268
269
270
0
@@ -230,9 +230,6 @@ module Merb::RenderMixin
0
   # Merb will search for it relative to the current controller.
0
   # opts<Hash>:: A hash of options (see below)
0
   #
0
- # ==== Block parameters
0
- # temp:: Current :with Object being handled inside of the partial.
0
- #
0
   # ==== Options (opts)
0
   # :with<Object, Array>::
0
   # An object or an array of objects that will be passed into the partial.
0
@@ -241,12 +238,7 @@ module Merb::RenderMixin
0
   # others::
0
   # A Hash object names and values that will be the local names and values
0
   # inside the partial.
0
- #
0
- # ==== Notes
0
- # The following local variables are available inside of the partial when :with is specified:
0
- # partial_counter:: The current partial iteration (starting at 1).
0
- # partial_size:: The number of times the partial will be iterated.
0
- #
0
+ #
0
   # ==== Example
0
   # partial :foo, :hello => @object
0
   #
0
@@ -269,12 +261,10 @@ module Merb::RenderMixin
0
     (@_old_partial_locals ||= []).push @_merb_partial_locals
0
 
0
     if opts.key?(:with)
0
- with = [opts.delete(:with)].flatten
0
+ with = opts.delete(:with)
0
       as = opts.delete(:as) || template_location.match(%r[.*/_([^\.]*)])[1]
0
- @_merb_partial_locals = opts.merge(:partial_size => with.size, :partial_counter => 0)
0
- sent_template = with.map do |temp|
0
- yield temp if block_given?
0
- @_merb_partial_locals[:partial_counter] += 1
0
+ @_merb_partial_locals = opts
0
+ sent_template = [with].flatten.map do |temp|
0
         @_merb_partial_locals[as.to_sym] = temp
0
         if template_method && self.respond_to?(template_method)
0
           send(template_method)
...
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
...
66
67
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
70
71
0
@@ -66,23 +66,6 @@ module Merb::Test::Fixtures
0
       end
0
     end
0
 
0
- class PartialWithCollectionsAndCounter < RenderIt
0
-
0
- def index
0
- @foo = %w{ 1 2 3 4 5 }
0
- render
0
- end
0
- end
0
-
0
- class PartialWithCollectionsAndYield < RenderIt
0
-
0
- def index
0
- @foo = %w{ Y I E L D I N G }
0
- render
0
- end
0
-
0
- end
0
-
0
     class PartialWithLocals < RenderIt
0
 
0
       def index
...
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
50
51
52
 
 
 
 
 
 
 
 
53
54
55
0
@@ -50,14 +50,6 @@ describe Merb::AbstractController, " Partials" do
0
     dispatch_should_make_body("BasicPartialWithMultipleRoots", "Base Index: Alt Partial")
0
   end
0
   
0
- it "should be able to count collections" do
0
- dispatch_should_make_body("PartialWithCollectionsAndCounter", "Partial counting: 1/5 2/5 3/5 4/5 5/5 ")
0
- end
0
-
0
- it "should be able to yield to each item in a collection" do
0
- dispatch_should_make_body("PartialWithCollectionsAndYield", "Partial yielding")
0
- end
0
-
0
   it "should render a partial using an absolute path" do
0
     dispatch_should_make_body("WithAbsolutePartial", "Index Absolute Partial")
0
   end

Comments

  • reframeit Fri Jun 20 10:33:36 -0700 2008

    What’s the reasoning behind removing this?