From a9f22dc272ad5b7fe23b4648b825fd454ad230a3 Mon Sep 17 00:00:00 2001 From: wycats Date: Mon, 23 May 2011 16:43:58 -0700 Subject: Move the last pockets of Sprockets stuff into the Sprockets directory --- actionpack/lib/sprockets/helpers/rails_helper.rb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/sprockets/helpers') diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index 5f2854995f..3b64be67d9 100644 --- a/actionpack/lib/sprockets/helpers/rails_helper.rb +++ b/actionpack/lib/sprockets/helpers/rails_helper.rb @@ -1,3 +1,6 @@ +require "action_view/helpers/asset_paths" +require "action_view/helpers/asset_tag_helper" + module Sprockets module Helpers module RailsHelper @@ -9,12 +12,6 @@ module Sprockets end end - def asset_path(source, default_ext = nil, body = false) - source = source.logical_path if source.respond_to?(:logical_path) - path = asset_paths.compute_public_path(source, 'assets', default_ext, true) - body ? "#{path}?body=1" : path - end - def javascript_include_tag(source, options = {}) debug = options.key?(:debug) ? options.delete(:debug) : debug_assets? body = options.key?(:body) ? options.delete(:body) : false @@ -53,6 +50,18 @@ module Sprockets end end + private + def debug_assets? + params[:debug_assets] == '1' || + params[:debug_assets] == 'true' + end + + def asset_path(source, default_ext = nil, body = false) + source = source.logical_path if source.respond_to?(:logical_path) + path = asset_paths.compute_public_path(source, 'assets', default_ext, true) + body ? "#{path}?body=1" : path + end + class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc: def compute_public_path(source, dir, ext=nil, include_host=true) super(source, 'assets', ext, include_host) -- cgit v1.2.3