module StepRender::ViewHelper

Public Instance Methods

import_step_render() click to toggle source
# File lib/step_render/view_helper.rb, line 24
def import_step_render
  '<script src="https://cdnjs.cloudflare.com/ajax/libs/lazysizes/3.0.0/lazysizes.min.js" async></script><script src="https://cdnjs.cloudflare.com/ajax/libs/lazysizes/3.0.0/plugins/include/ls.include.min.js" async></script>'.html_safe
end
step_cache(key, **options) { || ... } click to toggle source
# File lib/step_render/view_helper.rb, line 13
def step_cache(key, **options)
  if Rails.cache.exist?("views/#{key}")
    %(<div class= "related-articles lazyload" data-include="#{step_cache_path(key)}">loading</div>).html_safe
    # content_tag(:div, 'loading', class: 'related-articles lazyload', "data-include" => "#{delayed_cache_path(key)}")
  else
    cache key, **options do
      yield
    end
  end
end
step_render(*options) click to toggle source
# File lib/step_render/view_helper.rb, line 6
def step_render(*options)
  key = CGI.escape(Marshal.dump(ActiveJob::Arguments.serialize(options)))
  path = step_render_path(key)
  raise StepRender::RequestURITooLarge if path.to_s.size > 2083
  %(<div class= "related-articles lazyload" data-include="#{path}">loading</div>).html_safe
end