Sha256: a8d7e57eec4ad1d7439e1ac56c92126330e65de50cc2d0bf6e640deefae06100

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

require "non-stupid-digest-assets"

# rubocop:disable  Metrics/CyclomaticComplexity
module SharingTags
  module ActionView
    module 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  
  end    
end
# rubocop:enable  Metrics/CyclomaticComplexity

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sharing_tags-0.0.18 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.17 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.16 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.15 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.14 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.13 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.12 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.11 lib/sharing_tags/action_view/asset_helper.rb
sharing_tags-0.0.10 lib/sharing_tags/action_view/asset_helper.rb