diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-02-13 05:39:27 +0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-02-13 05:50:25 +0800 |
commit | e2b99eb1a77b1b2d8c1ede5239a2f72ef0898cd0 (patch) | |
tree | 562b82f221893809e72a6df97882adb157ef76e8 /actionpack/lib/action_view | |
parent | 1363bb8f7215fadb65e9296217be2ae96e82dd7e (diff) | |
download | rails-e2b99eb1a77b1b2d8c1ede5239a2f72ef0898cd0.tar.gz rails-e2b99eb1a77b1b2d8c1ede5239a2f72ef0898cd0.tar.bz2 rails-e2b99eb1a77b1b2d8c1ede5239a2f72ef0898cd0.zip |
Applied changes to stylesheet_link_tag from javascript_include_tag which corrects issues with ordering and duplicates.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb | 18 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb | 11 |
2 files changed, 15 insertions, 14 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb index fc0cca28b9..52eb43a1cd 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb @@ -71,9 +71,21 @@ module ActionView if sources.first == :all collect_asset_files(custom_dir, ('**' if recursive), "*.#{extension}") else - sources.collect do |source| - determine_source(source, expansions) - end.flatten + sources.inject([]) do |list, source| + determined_source = determine_source(source, expansions) + update_source_list(list, determined_source) + end + end + end + + def update_source_list(list, source) + case source + when String + list.delete(source) + list << source + when Array + updated_sources = source - list + list.concat(updated_sources) end end diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb index 4781832711..b9126af944 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb @@ -42,17 +42,6 @@ module ActionView end end - def update_source_list(list, source) - case source - when String - list.delete(source) - list << source - when Array - updated_sources = source - list - list.concat(updated_sources) - end - end - def add_application_js(expanded_sources, sources) if sources.include?(:defaults) && File.exist?(File.join(custom_dir, "application.#{extension}")) expanded_sources.delete('application') |