Sha256: 76ab6a04d476f7e31592539ca46917af7d8e32e07b7298f9de0ba96e1f900441

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 Bytes

Contents

module LazyRender
  module LazyloadHelper
    def lazy_render(name, locals: {}, cache: false, callback: false, parallel: false)
      data = { 'lazy-render-name' => name }
      data['lazy-render-params'] = locals if locals.instance_of?(Hash) && locals.presence
      data['lazy-render-cache'] = cache.to_i if cache
      data['lazy-render-callback'] = callback if callback
      data['lazy-render-parallel'] = parallel if parallel
      content_tag :span, nil, class: "js-lazy-render-#{name}", data: data
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lazy_render-0.2.1 app/helpers/lazy_render/lazyload_helper.rb
lazy_render-0.2.0 app/helpers/lazy_render/lazyload_helper.rb