Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

pre-render footer macro needs controller sometimes #177

Closed
catmando opened this issue Oct 24, 2016 · 0 comments
Closed

pre-render footer macro needs controller sometimes #177

catmando opened this issue Oct 24, 2016 · 0 comments

Comments

@catmando
Copy link
Contributor

this patch does it all: please incorporate:

module React
  # make it so the prerender_footer macro will receive the controller
  module IsomorphicHelpers
    def self.prerender_footers(controller = nil)
      footer = Context.prerender_footer_blocks.collect { |block| block.call controller }.join("\n")
      if RUBY_ENGINE != 'opal'
        footer = (footer + @context.send_to_opal(:prerender_footers).to_s) if @context
        footer = footer.html_safe
      end
      footer
    end
  end
end
module ReactiveRuby
  module Rails
    # pass controller to the prerender_footers method
    class ComponentMount < React::Rails::ComponentMount
      def footers
        React::IsomorphicHelpers.prerender_footers(controller)
      end
    end
  end
end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants