From 2e175c4be5cf91b12b454c66530d2860dbe1a9d2 Mon Sep 17 00:00:00 2001 From: Augier Date: Sun, 7 Aug 2016 11:30:29 +0200 Subject: [PATCH] Bump to jQuery 2 --- Gemfile | 2 +- Gemfile.lock | 4 ++-- .../javascripts/app/views/publisher_view.js | 8 ++++---- app/assets/javascripts/jasmine-load-all.js | 2 +- app/helpers/application_helper.rb | 6 +++--- config/application.rb | 2 +- .../jasmine_fixtures/comments_spec.rb | 20 ------------------- spec/helpers/application_helper_spec.rb | 2 +- .../mobile/mobile_comments_spec.js | 6 ------ 9 files changed, 13 insertions(+), 39 deletions(-) delete mode 100644 spec/controllers/jasmine_fixtures/comments_spec.rb diff --git a/Gemfile b/Gemfile index 0f294990b..eab0ade00 100644 --- a/Gemfile +++ b/Gemfile @@ -96,7 +96,7 @@ gem "js_image_paths", "0.1.0" gem "js-routes", "1.2.6" source "https://rails-assets.org" do - gem "rails-assets-jquery", "1.12.0" # Should be kept in sync with jquery-rails + gem "rails-assets-jquery", "2.2.1" # Should be kept in sync with jquery-rails gem "rails-assets-markdown-it", "6.0.5" gem "rails-assets-markdown-it-hashtag", "0.4.0" diff --git a/Gemfile.lock b/Gemfile.lock index 825f5c6b9..a7f533d7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -658,7 +658,7 @@ GEM rails-assets-jasmine (2.4.1) rails-assets-jasmine-ajax (3.2.0) rails-assets-jasmine (~> 2) - rails-assets-jquery (1.12.0) + rails-assets-jquery (2.2.1) rails-assets-jquery-colorbox (1.6.4) rails-assets-jquery (>= 1.3.2) rails-assets-jquery-fullscreen-plugin (0.5.0) @@ -999,7 +999,7 @@ DEPENDENCIES rails-assets-diaspora_jsxc (= 0.1.5.develop.1)! rails-assets-highlightjs (= 9.4.0)! rails-assets-jasmine-ajax (= 3.2.0)! - rails-assets-jquery (= 1.12.0)! + rails-assets-jquery (= 2.2.1)! rails-assets-jquery-placeholder (= 2.3.1)! rails-assets-jquery-textchange (= 0.2.3)! rails-assets-markdown-it (= 6.0.5)! diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index f357cb2a6..af85764d3 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -476,8 +476,8 @@ app.views.Publisher = Backbone.View.extend({ setButtonsEnabled: function(bool) { if (bool) { - this.submitEl.removeProp("disabled"); - this.previewEl.removeProp("disabled"); + this.submitEl.removeAttr("disabled"); + this.previewEl.removeAttr("disabled"); } else { this.submitEl.prop("disabled", true); this.previewEl.prop("disabled", true); @@ -486,8 +486,8 @@ app.views.Publisher = Backbone.View.extend({ setInputEnabled: function(bool) { if (bool) { - this.inputEl.removeProp("disabled"); - this.hiddenInputEl.removeProp("disabled"); + this.inputEl.removeAttr("disabled"); + this.hiddenInputEl.removeAttr("disabled"); } else { this.inputEl.prop("disabled", true); this.hiddenInputEl.prop("disabled", true); diff --git a/app/assets/javascripts/jasmine-load-all.js b/app/assets/javascripts/jasmine-load-all.js index 793b86e0e..37920dc40 100644 --- a/app/assets/javascripts/jasmine-load-all.js +++ b/app/assets/javascripts/jasmine-load-all.js @@ -1,4 +1,4 @@ -//= require jquery +//= require jquery2 //= require handlebars.runtime //= require templates //= require main diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2e55122e4..b488aa4c6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -52,11 +52,11 @@ module ApplicationHelper def jquery_include_tag buf = [] if AppConfig.privacy.jquery_cdn? - version = Jquery::Rails::JQUERY_VERSION + version = Jquery::Rails::JQUERY_2_VERSION buf << [ javascript_include_tag("//code.jquery.com/jquery-#{version}.min.js") ] - buf << [ javascript_tag("!window.jQuery && document.write(unescape('#{j javascript_include_tag("jquery")}'));") ] + buf << [javascript_tag("!window.jQuery && document.write(unescape('#{j javascript_include_tag('jquery2')}'));")] else - buf << [ javascript_include_tag('jquery') ] + buf << [javascript_include_tag("jquery2")] end buf << [ javascript_include_tag('jquery_ujs') ] buf << [ javascript_tag("jQuery.ajaxSetup({'cache': false});") ] diff --git a/config/application.rb b/config/application.rb index 3df893bbe..6ef69fdb5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -70,7 +70,7 @@ module Diaspora contact-list.js ie.js inbox.js - jquery.js + jquery2.js jquery_ujs.js jquery-textchange.js main.js diff --git a/spec/controllers/jasmine_fixtures/comments_spec.rb b/spec/controllers/jasmine_fixtures/comments_spec.rb deleted file mode 100644 index f753e13f8..000000000 --- a/spec/controllers/jasmine_fixtures/comments_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -require "spec_helper" - -describe CommentsController, type: :controller do - describe "#comments" do - before do - sign_in :user, alice - end - - context "jasmine fixtures" do - it "generates a jasmine fixture with the mobile comment box", fixture: true do - get :new, format: :mobile, post_id: 1 - save_fixture(html_for("div"), "comments_mobile_commentbox") - end - end - end -end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index dae93ace1..092b8f6a1 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -74,7 +74,7 @@ describe ApplicationHelper, :type => :helper do end it 'includes jquery.js from asset pipeline' do - expect(jquery_include_tag).to match(/jquery\.js/) + expect(jquery_include_tag).to match(/jquery2\.js/) expect(jquery_include_tag).not_to match(/jquery\.com/) end end diff --git a/spec/javascripts/mobile/mobile_comments_spec.js b/spec/javascripts/mobile/mobile_comments_spec.js index 1721d8090..e8fd7551a 100644 --- a/spec/javascripts/mobile/mobile_comments_spec.js +++ b/spec/javascripts/mobile/mobile_comments_spec.js @@ -82,14 +82,8 @@ describe("Diaspora.Mobile.Comments", function(){ describe("createComment", function () { beforeEach(function() { spec.loadFixture("aspects_index_mobile_post_with_comments"); - var commentBoxHtml = spec.fixtureHtml("comments_mobile_commentbox"); var link = $(".stream .comment-action").first(); Diaspora.Mobile.Comments.showCommentBox(link); - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: "text/html", - responseText: commentBoxHtml - }); $(".stream .new_comment").submit(Diaspora.Mobile.Comments.submitComment); });