require 'securerandom'

module LjaxRails
  module LjaxRenderer
    def render_partial(context, options, &block)
      if options[:locals] && options[:locals].delete(:remote)
        partial = options.delete :partial
        url = options[:locals].delete :remote_url
        id = SecureRandom.uuid
        context.flash[id] = partial
        loading = block.call if block

        %Q!<div id="#{id}" class="ljax-container"#{ data-remote-url="#{url}" if url}>#{loading}</div>!.html_safe
      else
        super
      end
    end
  end
end

ActionView::Renderer.send :prepend, LjaxRails::LjaxRenderer

require 'securerandom'

module LjaxRails
  module LjaxRenderer
    def render_partial(context, options, &block)
      if options[:locals] && options[:locals].delete(:remote)
        partial = options.delete :partial
        url = options[:locals].delete :remote_url
        id = "ljax-#{SecureRandom.uuid}"
        context.flash[id] = partial
        loading = block.call if block

        %Q!<div id="#{id}" class="ljax-container"#{ data-remote-url="#{url}" if url}>#{loading}</div>!.html_safe
      else
        super
      end
    end
  end
end

ActionView::Renderer.send :prepend, LjaxRails::LjaxRenderer

Mark as an ljax element
Mark as an ljax element
