GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
Fixed issue with class variable assignment in partials.


git-svn-id: svn://hamptoncatlin.com/haml/branches/1.0rc@181 
7063305b-7217-0410-af8c-cdc13e5119b9
nex3 (author)
Fri Dec 01 22:46:55 -0800 2006
commit  ec6eeae24c7fca4c0a0c110fc2c13c3a6b48398e
tree    d979ab9ca0d5b177f31c22e5422327f4c945a577
parent  a53f023af7151f1da15c98f3fa95cbb2a68c64b3
...
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
 
 
 
 
 
 
 
 
62
 
 
63
64
65
...
47
48
49
 
 
 
 
 
 
 
 
 
 
 
 
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
0
@@ -47,19 +47,18 @@ module Haml
0
     # with <tt>local_assigns</tt> available as local variables within the template.
0
     # Returns the result as a string.
0
     def render(template, local_assigns={})
0
- assigns = @view.assigns.dup
0
-
0
- # Do content for layout on its own to keep things working in partials
0
- if content_for_layout = @view.instance_variable_get("@content_for_layout")
0
- assigns['content_for_layout'] = content_for_layout
0
- end
0
-
0
- # Get inside the view object's world
0
- @view.instance_eval do
0
- # Set all the instance variables
0
- assigns.each do |key,val|
0
- instance_variable_set "@#{key}", val
0
+ unless @view.instance_variable_get("@assigns_added")
0
+ assigns = @view.assigns.dup
0
+
0
+ # Get inside the view object's world
0
+ @view.instance_eval do
0
+ # Set all the instance variables
0
+ assigns.each do |key,val|
0
+ instance_variable_set "@#{key}", val
0
+ end
0
         end
0
+
0
+ @view.instance_variable_set("@assigns_added", true)
0
       end
0
 
0
       options = @@options.dup
...
9
10
11
12
13
14
 
 
 
15
16
17
18
19
 
20
21
22
...
9
10
11
 
 
 
12
13
14
15
16
17
18
19
20
21
22
23
0
@@ -9,14 +9,15 @@ require File.dirname(__FILE__) + '/../lib/haml/template'
0
 require File.dirname(__FILE__) + '/mocks/article'
0
 
0
 class TemplateTest < Test::Unit::TestCase
0
- @@templates = %w{ very_basic standard helpers
0
- whitespace_handling original_engine list helpful
0
- silent_script tag_parsing just_stuff}
0
+ @@templates = %w{ very_basic standard helpers
0
+ whitespace_handling original_engine list helpful
0
+ silent_script tag_parsing just_stuff partials }
0
 
0
   def setup
0
     ActionView::Base.register_template_handler("haml", Haml::Template)
0
     @base = ActionView::Base.new(File.dirname(__FILE__) + "/../test/templates/")
0
     @base.instance_variable_set("@article", Article.new)
0
+ @base.instance_variable_set("@foo", 'value one')
0
   end
0
 
0
   def render(text)

Comments

    No one has commented yet.