public
Description: Uber lightweight Merb blogging engine. Make sure you check out the feather-plugins repo as well!
Homepage:
Clone URL: git://github.com/mleung/feather.git
Click here to lend your support to: feather and make a donation at www.pledgie.com !
Somehow my render_plugin_views fix was lost in the Ether.

From my original commit:

Fixed the render_plugin_views helper to correctly render plugin hooks on
Merb edge.

Unfortunately we have to perform a fairly large assumption here, that is,
we have to assume that you'd like to use the Object being passed (with
:with =>) inside the partial as the singular, downcased version.

e.g., you use <%= render_plugin_views "last_article_in_list",
:with => {:last => @articles.last} %>. In your plugin hook
partial, you *have* to use the singular downcased representation of the
Object(s) you're passing.

Articles => article

11:48 < fujin> e.g. the view I'm testing uses 'article.something',
because it's expecting an Articles to be passed in /as/ 'article'
11:51 < fujin> very hard assumption to make - I either have to
*blanket* say that we'll be passing a singular downcased version of the
Object you're passing to :with
11:51 < fujin> or work out something else to do
11:52 < TheWordNerd> Doesn't seem like a bad assumption.
11:53 < fujin> output << partial(template_location, { :with
=> options[:with], :as =>
options[:with].class.to_s.downcase.singular })
fujin (author)
Sun Jul 20 04:43:43 -0700 2008
commit  261681fe782c39aa65ec41c33f9ff94e1886bf10
tree    680cac669a14d84a0b3e13b0e6f101a5bf313b7b
parent  d9fdcdc6d8770b111dbf9df8835d92c89aeec166
...
132
133
134
135
136
137
 
 
138
139
140
...
132
133
134
 
 
 
135
136
137
138
139
0
@@ -132,9 +132,8 @@ module Merb
0
           if view[:partial]
0
             # Set the template root, create the template method and call the partial
0
             _template_root = File.join(view[:plugin].path, "views")
0
-            template_location = _template_root / _template_location("_#{view[:partial]}", content_type, view[:name])
0
-            template_method = Merb::Template.template_for(template_location)
0
-            output << send(template_method, options)
0
+            template_location = _template_root / _template_location("#{view[:partial]}", content_type, view[:name])
0
+            output << partial(template_location, { :with => options[:with], :as => options[:with].class.to_s.downcase.singular })
0
           else
0
             # Render the specified text using ERB and the options
0
             output << Proc.new { |args| ERB.new(view[:content]).result(binding) }.call(options[:with])

Comments