Sha256: f27c28c789815b35bb03316d41f06eaef1ef31c3057dc93c685c0276c01c69a4
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
module ActionController::PartialHelper def self.disable_localite @no_localite = true end def self.localite? defined?(Localite) && !@no_localite end def partial_for(name) case name when String then name when Array then partial_for name.first else "sh/#{name.class.name.underscore}" end end # # partial <partial-name>, <object>, <locals> or # partial <object>, <locals> # def partial(partial, object=nil, locals=nil) # # set up object and locals unless partial.is_a?(String) object, locals = partial, object end if !locals && object.is_a?(Hash) locals, object = object, nil end opts = { :partial => partial_for(partial), :locals => locals } if object opts[:object] = object elsif locals && locals[:collection] opts[:collection] = locals[:collection] end render_vex_partial(opts) end def partial?(*args) partial *args rescue ActionView::MissingTemplate logger.debug $!.to_s nil end end ActionController::Base.helper ActionController::PartialHelper class ActionController::Base def render_vex_partial(opts) render_to_string(opts) end end class ActionView::Base def render_vex_partial(opts) render(opts) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vex-0.6.2 | lib/vex/action_controller/partial_helper.rb |