jquery-rails 3.1.4 → 4.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,50 +0,0 @@
1
- require 'rails'
2
-
3
- # Supply generator for Rails 3.0.x or if asset pipeline is not enabled
4
- if ::Rails.version < "3.1" || !::Rails.application.config.assets.enabled
5
- module Jquery
6
- module Generators
7
- class InstallGenerator < ::Rails::Generators::Base
8
-
9
- desc "This generator installs jQuery #{Jquery::Rails::JQUERY_VERSION} and jQuery-ujs"
10
- source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)
11
-
12
- def remove_prototype
13
- Rails::PROTOTYPE_JS.each do |name|
14
- remove_file "public/javascripts/#{name}.js"
15
- end
16
- end
17
-
18
- def copy_jquery
19
- say_status("copying", "jQuery (#{Jquery::Rails::JQUERY_VERSION})", :green)
20
- copy_file "jquery.js", "public/javascripts/jquery.js"
21
- copy_file "jquery.min.js", "public/javascripts/jquery.min.js"
22
- end
23
-
24
- def copy_ujs_driver
25
- say_status("copying", "jQuery UJS adapter (#{Jquery::Rails::JQUERY_UJS_VERSION[0..5]})", :green)
26
- remove_file "public/javascripts/rails.js"
27
- copy_file "jquery_ujs.js", "public/javascripts/jquery_ujs.js"
28
- end
29
-
30
- end
31
- end
32
- end
33
- else
34
- module Jquery
35
- module Generators
36
- class InstallGenerator < ::Rails::Generators::Base
37
- desc "Just show instructions so people will know what to do when mistakenly using generator for Rails 3.1 apps"
38
-
39
- def do_nothing
40
- say_status("deprecated", "You are using Rails 3.1 with the asset pipeline enabled, so this generator is not needed.")
41
- say_status("", "The necessary files are already in your asset pipeline.")
42
- say_status("", "Just add `//= require jquery` and `//= require jquery_ujs` to your app/assets/javascripts/application.js")
43
- say_status("", "If you upgraded your app from Rails 3.0 and still have jquery.js, rails.js, or jquery_ujs.js in your javascripts, be sure to remove them.")
44
- say_status("", "If you do not want the asset pipeline enabled, you may turn it off in application.rb and re-run this generator.")
45
- # ok, nothing
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,18 +0,0 @@
1
- # Used to ensure that Rails 3.0.x, as well as Rails >= 3.1 with asset pipeline disabled
2
- # get the minified version of the scripts included into the layout in production.
3
- module Jquery
4
- module Rails
5
- class Railtie < ::Rails::Railtie
6
- config.before_configuration do
7
- if config.action_view.javascript_expansions
8
- jq_defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(jquery.min) : %w(jquery)
9
-
10
- # Merge the jQuery scripts, remove the Prototype defaults and finally add 'jquery_ujs'
11
- # at the end, because load order is important
12
- config.action_view.javascript_expansions[:defaults] -= PROTOTYPE_JS + ['rails']
13
- config.action_view.javascript_expansions[:defaults] |= jq_defaults + ['jquery_ujs']
14
- end
15
- end
16
- end
17
- end
18
- end