Sha256: b1123d3e30a8263b209022ad90ced3586af05058fbdaac37a72270436c952bf3

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

require "non-stupid-digest-assets"

module SharingTags::ActionView::AssetHelper

  def without_digest_asset_url(path, options = {})
    options.merge!(digested: false)

    add_image_to_non_digest_list(path)
    url_to_image(path, options)
  end

  # redefine method Sprockets::Rails::Helper
  # Computes asset path to public directory.
  #
  # Override this method for non digested assets
  #
  def compute_asset_path(path, options = {})
    digested = options.delete(:digested)
    digested = true if digested.nil?

    if digest_path = asset_digest_path(path, options)
      path = digest_path if digested && digest_assets
      path += "?body=1" if options[:debug]
      File.join(assets_prefix || "/", path)
    else
      super
    end
  end

  private

  def add_image_to_non_digest_list(asset_name)
    return if ::NonStupidDigestAssets.whitelist.include?(asset_name)
    ::NonStupidDigestAssets.whitelist += [ asset_name ]
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sharing_tags-0.0.9 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.8 lib/sharing_tags/action_view/asset_helper.rb