module DryHamlHandlebars::ViewHelpers::ActionView
Public Instance Methods
handlebars_content_for(name, content = nil, flush = false)
click to toggle source
WARNING: content_for is ignored in caches. So you shouldn’t use it for elements that will be fragment cached.
# File lib/dry_haml_handlebars/view_helpers/action_view.rb, line 7 def handlebars_content_for(name, content = nil, flush = false) if content flush ? @view_flow.set(name, content) : @view_flow.append(name, content) nil else @view_flow.get(name) end end
handlebars_render(*args, &block)
click to toggle source
# File lib/dry_haml_handlebars/view_helpers/action_view.rb, line 18 def handlebars_render(*args, &block) #we simply wrap render so that we can detect that 'handlebars_render' was the calling function #we do this by adding a local variable :handlebars_partial => true if args.first.is_a?(Hash) options = args.first options[:locals] ||= {} options[:locals].merge!(:__handlebars_partial => true) elsif args.last.is_a?(Hash) locals = args.last locals[:__handlebars_partial] = true else args << {:__handlebars_partial => true} end render(*args, &block) end