Module: StepRender::ViewHelper
- Defined in:
- lib/step_render/view_helper.rb
Instance Method Summary collapse
Instance Method Details
#import_step_render ⇒ Object
24 25 26 |
# 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) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/step_render/view_helper.rb', line 13 def step_cache(key, **) 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, ** do yield end end end |
#step_render(*options) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/step_render/view_helper.rb', line 6 def step_render(*) key = CGI.escape(Marshal.dump(ActiveJob::Arguments.serialize())) 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 |