Changeset 76
- Timestamp:
- 08/23/2006 12:17:11 (2 years ago)
- Location:
- trunk/lib/markaby
- Files:
-
- 2 modified
-
builder.rb (modified) (1 diff)
-
rails.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/markaby/builder.rb
r75 r76 127 127 builder.target = @streams.last 128 128 str 129 end130 131 # Content_for will store the given block in an instance variable for later use132 # in another template or in the layout.133 #134 # The name of the instance variable is content_for_<name> to stay consistent135 # with @content_for_layout which is used by ActionView's layouts.136 #137 # Example:138 #139 # content_for("header") do140 # h1 "Half Shark and Half Lion"141 # end142 #143 # If used several times, the variable will contain all the parts concatenated.144 def content_for(name, &block)145 @helpers.assigns["content_for_#{name}"] =146 eval("@content_for_#{name} = (@content_for_#{name} || '') + capture(&block)")147 129 end 148 130 -
trunk/lib/markaby/rails.rb
r62 r76 39 39 # If used several times, the variable will contain all the parts concatenated. 40 40 def content_for(name, &block) 41 eval "@content_for_#{name} = (@content_for_#{name} || '') + capture(&block)" 41 @helpers.assigns["content_for_#{name}"] = 42 eval("@content_for_#{name} = (@content_for_#{name} || '') + capture(&block)") 42 43 end 43 44 end