Permalink
Browse files

Merge pull request #91 from fullbridge-batkins/railtie_improvement

Refactored code on the Railtie

Conflicts:
	CHANGELOG.md
  • Loading branch information...
2 parents 8c06dc0 + f06344b commit cf47e7141fec4ee6f2a75f43c6664d11d0e5ca50 @indirect indirect committed Nov 27, 2012
Showing with 12 additions and 13 deletions.
  1. +1 −1 CHANGELOG.md
  2. +11 −12 lib/jquery/rails/railtie.rb
View
@@ -3,8 +3,8 @@
- Updated to jQuery 1.8.3
- Updated to jQuery UI 1.9.2
- Rails 4 compatibility
+ - Rails 3.1 compatibility (without asset pipeline)
- Rails 3.0 compatibility
- - Rails 3.1 (without asset pipeline) compatibility
## 2.1.3 (24 September 2012)
@@ -4,21 +4,20 @@ module Jquery
module Rails
class Railtie < ::Rails::Railtie
- config.before_configuration do
+ if config.action_view.javascript_expansions
+ config.before_configuration do
- if ::Rails.root.join("public/javascripts/jquery-ui.min.js").exist?
- jq_defaults = %w(jquery jquery-ui)
- jq_defaults.map!{|a| a + ".min" } if ::Rails.env.production? || ::Rails.env.test?
- else
- jq_defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(jquery.min) : %w(jquery)
- end
+ if ::Rails.root.join("public/javascripts/jquery-ui.min.js").exist?
+ jq_defaults = %w(jquery jquery-ui)
+ jq_defaults.map!{|a| a + ".min" } if ::Rails.env.production? || ::Rails.env.test?
+ else
+ jq_defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(jquery.min) : %w(jquery)
+ end
- # Merge the jQuery scripts, remove the Prototype defaults and finally add 'jquery_ujs'
- # at the end, because load order is important
- if config.action_view.javascript_expansions
+ # Merge the jQuery scripts, remove the Prototype defaults and finally add 'jquery_ujs'
+ # at the end, because load order is important
config.action_view.javascript_expansions[:defaults] -= PROTOTYPE_JS + ['rails']
- config.action_view.javascript_expansions[:defaults] |= jq_defaults
- config.action_view.javascript_expansions[:defaults] << 'jquery_ujs'
+ config.action_view.javascript_expansions[:defaults] |= jq_defaults + ['jquery_ujs']
end
end
end

0 comments on commit cf47e71

Please sign in to comment.