jQuery 3 integration
This commit is contained in:
parent
ca6ce912d3
commit
c90cb3328e
6 changed files with 15 additions and 13 deletions
4
Gemfile
4
Gemfile
|
|
@ -86,13 +86,13 @@ gem "entypo-rails", "3.0.0"
|
|||
# JavaScript
|
||||
|
||||
gem "handlebars_assets", "0.23.1"
|
||||
gem "jquery-rails", "4.2.1"
|
||||
gem "jquery-rails", "4.2.2"
|
||||
gem "jquery-ui-rails", "5.0.5"
|
||||
gem "js-routes", "1.3.3"
|
||||
gem "js_image_paths", "0.1.0"
|
||||
|
||||
source "https://rails-assets.org" do
|
||||
gem "rails-assets-jquery", "2.2.4" # Should be kept in sync with jquery-rails
|
||||
gem "rails-assets-jquery", "3.1.1" # Should be kept in sync with jquery-rails
|
||||
|
||||
gem "rails-assets-highlightjs", "9.9.0"
|
||||
gem "rails-assets-markdown-it", "8.3.0"
|
||||
|
|
|
|||
10
Gemfile.lock
10
Gemfile.lock
|
|
@ -324,7 +324,7 @@ GEM
|
|||
rake
|
||||
jasmine-core (2.5.2)
|
||||
jasmine-jquery-rails (2.0.3)
|
||||
jquery-rails (4.2.1)
|
||||
jquery-rails (4.2.2)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
|
|
@ -540,7 +540,7 @@ GEM
|
|||
rails-assets-jasmine (2.5.2)
|
||||
rails-assets-jasmine-ajax (3.3.1)
|
||||
rails-assets-jasmine (~> 2)
|
||||
rails-assets-jquery (2.2.4)
|
||||
rails-assets-jquery (3.1.1)
|
||||
rails-assets-jquery-colorbox (1.6.4)
|
||||
rails-assets-jquery (>= 1.3.2)
|
||||
rails-assets-jquery-fullscreen-plugin (0.5.0)
|
||||
|
|
@ -831,7 +831,7 @@ DEPENDENCIES
|
|||
i18n-inflector-rails (= 1.0.7)
|
||||
jasmine (= 2.5.2)
|
||||
jasmine-jquery-rails (= 2.0.3)
|
||||
jquery-rails (= 4.2.1)
|
||||
jquery-rails (= 4.2.2)
|
||||
jquery-ui-rails (= 5.0.5)
|
||||
js-routes (= 1.3.3)
|
||||
js_image_paths (= 0.1.0)
|
||||
|
|
@ -878,7 +878,7 @@ DEPENDENCIES
|
|||
rails-assets-fine-uploader (= 5.13.0)!
|
||||
rails-assets-highlightjs (= 9.9.0)!
|
||||
rails-assets-jasmine-ajax (= 3.3.1)!
|
||||
rails-assets-jquery (= 2.2.4)!
|
||||
rails-assets-jquery (= 3.1.1)!
|
||||
rails-assets-jquery-placeholder (= 2.3.1)!
|
||||
rails-assets-jquery-textchange (= 0.2.3)!
|
||||
rails-assets-markdown-it (= 8.3.0)!
|
||||
|
|
@ -928,4 +928,4 @@ DEPENDENCIES
|
|||
will_paginate (= 3.1.5)
|
||||
|
||||
BUNDLED WITH
|
||||
1.14.5
|
||||
1.14.6
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//= require jquery2
|
||||
//= require jquery3
|
||||
//= require handlebars.runtime
|
||||
//= require templates
|
||||
//= require main
|
||||
|
|
|
|||
|
|
@ -52,11 +52,13 @@ module ApplicationHelper
|
|||
def jquery_include_tag
|
||||
buf = []
|
||||
if AppConfig.privacy.jquery_cdn?
|
||||
version = Jquery::Rails::JQUERY_2_VERSION
|
||||
version = Jquery::Rails::JQUERY_3_VERSION
|
||||
buf << [javascript_include_tag("//code.jquery.com/jquery-#{version}.min.js")]
|
||||
buf << [nonced_javascript_tag("!window.jQuery && document.write(unescape('#{j javascript_include_tag('jquery2')}'));")]
|
||||
buf << [
|
||||
nonced_javascript_tag("!window.jQuery && document.write(unescape('#{j javascript_include_tag('jquery3')}'));")
|
||||
]
|
||||
else
|
||||
buf << [javascript_include_tag("jquery2")]
|
||||
buf << [javascript_include_tag("jquery3")]
|
||||
end
|
||||
buf << [javascript_include_tag("jquery_ujs")]
|
||||
buf << [nonced_javascript_tag("jQuery.ajaxSetup({'cache': false});")]
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ module Diaspora
|
|||
config.assets.precompile += %w(
|
||||
contact-list.js
|
||||
ie.js
|
||||
jquery2.js
|
||||
jquery3.js
|
||||
jquery_ujs.js
|
||||
main.js
|
||||
jsxc.js
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ describe ApplicationHelper, :type => :helper do
|
|||
end
|
||||
|
||||
it 'includes jquery.js from asset pipeline' do
|
||||
expect(helper.jquery_include_tag).to match(/jquery2\.js/)
|
||||
expect(helper.jquery_include_tag).to match(/jquery3\.js/)
|
||||
expect(helper.jquery_include_tag).not_to match(/jquery\.com/)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue