diff --git a/Changelog.md b/Changelog.md
index 24c7fd75c..f4b751853 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -11,6 +11,7 @@
* Add participants to conversations menu [#4656](https://github.com/diaspora/diaspora/pull/4656)
* Update forgot_password and reset_password pages [#4707](https://github.com/diaspora/diaspora/pull/4707)
* Change jQuery CDN to jquery.com from googleapis.com [#4765](https://github.com/diaspora/diaspora/pull/4765)
+* Update to jQuery 10
## Bug fixes
* Improve time agos by updating the plugin [#4280](https://github.com/diaspora/diaspora/issues/4280)
diff --git a/Gemfile b/Gemfile
index 46d258f58..219dc2532 100644
--- a/Gemfile
+++ b/Gemfile
@@ -97,7 +97,6 @@ gem 'typhoeus', '0.6.7'
# Views
-gem 'client_side_validations', '3.2.6'
gem 'gon', '4.1.1'
gem 'haml', '4.0.5'
gem 'mobile-fu', '1.2.2'
@@ -129,7 +128,7 @@ group :assets do
gem 'backbone-on-rails', '1.1.0'
gem 'handlebars_assets', '0.12.0'
- gem 'jquery-rails', '2.1.4'
+ gem 'jquery-rails', '3.0.4'
# Windows and OSX have an execjs compatible runtime built-in, Linux users should
# install Node.js or use 'therubyracer'.
diff --git a/Gemfile.lock b/Gemfile.lock
index d41e85957..b6c729d42 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -66,7 +66,6 @@ GEM
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.2.9)
- client_side_validations (3.2.6)
coderay (1.1.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -206,7 +205,7 @@ GEM
selenium-webdriver (>= 0.1.3)
jasmine-core (1.3.1)
journey (1.0.4)
- jquery-rails (2.1.4)
+ jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (3.0.1)
@@ -461,7 +460,6 @@ DEPENDENCIES
bootstrap-sass (= 2.2.2.0)
capybara (= 2.2.1)
carrierwave (= 0.9.0)
- client_side_validations (= 3.2.6)
compass-rails (= 1.0.3)
configurate (= 0.0.8)
cucumber-rails (= 1.4.0)
@@ -487,7 +485,7 @@ DEPENDENCIES
http_accept_language (= 1.0.2)
i18n-inflector-rails (= 1.0.7)
jasmine (= 1.3.2)
- jquery-rails (= 2.1.4)
+ jquery-rails (= 3.0.4)
json (= 1.8.1)
markerb (= 1.0.1)
messagebus_ruby_api (= 1.0.3)
diff --git a/app/assets/javascripts/app/app.js b/app/assets/javascripts/app/app.js
index 04f93abb9..07ad66910 100644
--- a/app/assets/javascripts/app/app.js
+++ b/app/assets/javascripts/app/app.js
@@ -88,7 +88,7 @@ var app = {
Backbone.history.start({pushState: true});
// there's probably a better way to do this...
- $("a[rel=backbone]").live("click", function(evt){
+ $(document).on("click", "a[rel=backbone]", function(evt){
evt.preventDefault();
var link = $(this);
diff --git a/app/assets/javascripts/app/views/header_view.js b/app/assets/javascripts/app/views/header_view.js
index b1ed5151f..db55694cc 100644
--- a/app/assets/javascripts/app/views/header_view.js
+++ b/app/assets/javascripts/app/views/header_view.js
@@ -5,7 +5,9 @@ app.views.Header = app.views.Base.extend({
className : "dark-header",
events : {
- "click ul.dropdown li:first-child" : "toggleDropdown"
+ "click ul.dropdown li:first-child" : "toggleDropdown",
+ "focusin #q": "toggleSearchActive",
+ "focusout #q": "toggleSearchActive"
},
initialize : function(options) {
@@ -31,5 +33,13 @@ app.views.Header = app.views.Base.extend({
if(this.menuElement().hasClass("active") && !$(evt.target).parents("#user_menu").length) {
this.menuElement().removeClass("active");
}
+ },
+
+ toggleSearchActive: function(ev) {
+ // jQuery produces two events for focus/blur (for bubbling)
+ // don't rely on which event arrives first, by allowing for both variants
+ var is_active = (_.indexOf(['focus','focusin'], ev.type) != -1);
+ $(ev.target).toggleClass('active', is_active);
+ return false;
}
});
diff --git a/app/assets/javascripts/app/views/hovercard_view.js b/app/assets/javascripts/app/views/hovercard_view.js
index 89d76cd3f..c32014a71 100644
--- a/app/assets/javascripts/app/views/hovercard_view.js
+++ b/app/assets/javascripts/app/views/hovercard_view.js
@@ -3,9 +3,9 @@ app.views.Hovercard = Backbone.View.extend({
el: '#hovercard_container',
initialize: function() {
- $('.hovercardable')
- .live('mouseenter', _.bind(this._mouseenterHandler, this))
- .live('mouseleave', _.bind(this._mouseleaveHandler, this));
+ $(document)
+ .on('mouseenter', '.hovercardable', _.bind(this._mouseenterHandler, this))
+ .on('mouseleave', '.hovercardable', _.bind(this._mouseleaveHandler, this));
this.show_me = false;
diff --git a/app/assets/javascripts/app/views/likes_info_view.js b/app/assets/javascripts/app/views/likes_info_view.js
index bd8b45ac4..737b82792 100644
--- a/app/assets/javascripts/app/views/likes_info_view.js
+++ b/app/assets/javascripts/app/views/likes_info_view.js
@@ -9,7 +9,7 @@ app.views.LikesInfo = app.views.Base.extend({
tooltipSelector : ".avatar",
initialize : function() {
- this.model.interactions.bind('change', this.render, this)
+ this.model.interactions.bind('change', this.render, this);
},
presenter : function() {
diff --git a/app/assets/javascripts/aspect-edit-pane.js b/app/assets/javascripts/aspect-edit-pane.js
index 01b15896a..aeaa196e0 100644
--- a/app/assets/javascripts/aspect-edit-pane.js
+++ b/app/assets/javascripts/aspect-edit-pane.js
@@ -17,11 +17,11 @@ function updatePageAspectName( an_id, new_name) {
}
$(document).ready(function() {
- $('#rename_aspect_link').live('click', function(){
+ $('#aspect_name_title').on('click', '#rename_aspect_link', function(){
toggleAspectTitle();
});
- $('form.edit_aspect').live('ajax:success', function(evt, data, status, xhr) {
+ $(document).on('ajax:success', 'form.edit_aspect', function(evt, data, status, xhr) {
updateAspectName(data['name']);
updatePageAspectName( data['id'], data['name'] );
toggleAspectTitle();
diff --git a/app/assets/javascripts/aspect-sorting.js b/app/assets/javascripts/aspect-sorting.js
deleted file mode 100644
index 74d08e17a..000000000
--- a/app/assets/javascripts/aspect-sorting.js
+++ /dev/null
@@ -1,18 +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.
- */
-
-$(document).ready(function() {
- $('#aspect_nav.left_nav .all_aspects .sub_nav').sortable({
- items: "li[data-aspect_id]",
- update: function(event, ui) {
- var order = $(this).sortable("toArray", {attribute: "data-aspect_id"}),
- obj = { 'reorder_aspects': order, '_method': 'put' };
- $.ajax('/user', { type: 'post', dataType: 'script', data: obj });
- },
- revert: true,
- helper: 'clone'
- });
-});
-
diff --git a/app/assets/javascripts/browser_detection.js b/app/assets/javascripts/browser_detection.js
new file mode 100644
index 000000000..9387c379f
--- /dev/null
+++ b/app/assets/javascripts/browser_detection.js
@@ -0,0 +1,5 @@
+jQuery.browser = {};
+jQuery.browser.mozilla = /mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit/.test(navigator.userAgent.toLowerCase());
+jQuery.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
+jQuery.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());
+jQuery.browser.msie = /msie/.test(navigator.userAgent.toLowerCase());
diff --git a/app/assets/javascripts/contact-list.js b/app/assets/javascripts/contact-list.js
index 17700a851..5d8785a6e 100644
--- a/app/assets/javascripts/contact-list.js
+++ b/app/assets/javascripts/contact-list.js
@@ -5,7 +5,7 @@
var List = {
initialize: function() {
- $(".contact_list_search").live("keyup", function(e) {
+ $(document).on("keyup", ".contact_list_search", function(e) {
var search = $(this);
var list = $(".contacts", ".searchable");
var query = new RegExp(search.val(),'i');
diff --git a/app/assets/javascripts/helpers/i18n.js b/app/assets/javascripts/helpers/i18n.js
index f675e9624..0ece8f53b 100644
--- a/app/assets/javascripts/helpers/i18n.js
+++ b/app/assets/javascripts/helpers/i18n.js
@@ -2,20 +2,21 @@
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
- Diaspora.I18n = {
- language: "en",
- locale: {},
- loadLocale: function(locale, language) {
- this.locale = $.extend(this.locale, locale);
- this.language = language;
- rule = this.t('pluralization_rule');
- if (rule === "")
- rule = 'function (n) { return n == 1 ? "one" : "other" }';
- eval("this.pluralizationKey = "+rule);
- },
+Diaspora.I18n = {
+ language: "en",
+ locale: {},
- t: function(item, views) {
+ loadLocale: function(locale, language) {
+ this.locale = $.extend(this.locale, locale);
+ this.language = language;
+ rule = this.t('pluralization_rule');
+ if (rule === "")
+ rule = 'function (n) { return n == 1 ? "one" : "other" }';
+ eval("this.pluralizationKey = "+rule);
+ },
+
+ t: function(item, views) {
var items = item.split("."),
translatedMessage,
nextNamespace;
@@ -35,5 +36,12 @@
}
return _.template(translatedMessage, views || {});
- }
- };
+ },
+
+ reset: function() {
+ this.locale = {};
+
+ if( arguments.length > 0 && !(_.isEmpty(arguments[0])) )
+ this.locale = arguments[0];
+ }
+};
diff --git a/app/assets/javascripts/inbox.js b/app/assets/javascripts/inbox.js
index 905e033cc..3ab0c4cf5 100644
--- a/app/assets/javascripts/inbox.js
+++ b/app/assets/javascripts/inbox.js
@@ -28,13 +28,13 @@ $(document).ready(function(){
function(){
$(this).find('.participants').slideDown('300');
},
-
+
function(){
$(this).find('.participants').slideUp('300');
}
);
- $('.conversation-wrapper').live('click', function(){
+ $(document).on('click', '.conversation-wrapper', function(){
var conversation_path = $(this).data('conversation-path');
$.getScript(conversation_path, function() {
@@ -101,11 +101,4 @@ $(document).ready(function(){
$(document).ajaxError(function(e,xhr,opt){
if (xhr.status == 404) { $('a.next_page').remove(); }
});
-
- $('#reply_to_conversation').live('click', function(evt) {
- evt.preventDefault();
- $('html, body').animate({scrollTop:$(window).height()}, 'medium', function(){
- $('#message_text').focus();
- });
- });
});
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 02bad5148..a17df7c4a 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -4,15 +4,14 @@
*/
//= require underscore
//= require backbone
-//= require rails.validations
//= require jquery.hotkeys
//= require jquery.remotipart
//= require jquery.autoresize
-//= require jquery-ui-1.8.9.custom.min
//= require jquery.charcount
//= require jquery.placeholder
//= require rails-timeago
//= require facebox
+//= require browser_detection
//= require jquery.events.input
//= require jquery.elastic
//= require jquery.mentionsInput
@@ -36,7 +35,6 @@
//= require aspects-dropdown
//= require contact-edit
//= require contact-list
-//= require aspect-sorting
//= require mentions
//= require bootstrap-tooltip
//= require bootstrap-popover
diff --git a/app/assets/javascripts/mobile.js b/app/assets/javascripts/mobile.js
index 4e7d84450..0ba372480 100644
--- a/app/assets/javascripts/mobile.js
+++ b/app/assets/javascripts/mobile.js
@@ -217,7 +217,7 @@ $(document).ready(function(){
form.remove();
});
- $(".new_comment").live("submit", function(evt){
+ $(document).on("submit", ".new_comment", function(evt){
evt.preventDefault();
var form = $(this);
diff --git a/app/assets/javascripts/view.js b/app/assets/javascripts/view.js
index 2e9cdf3d2..6e7d7f9ec 100644
--- a/app/assets/javascripts/view.js
+++ b/app/assets/javascripts/view.js
@@ -20,8 +20,8 @@ var View = {
.keypress(this.search.keyPress);
/* Dropdowns */
- $(this.dropdowns.selector)
- .live('click', this.dropdowns.click);
+ $(document)
+ .on('click', this.dropdowns.selector, this.dropdowns.click);
/* Avatars */
$(this.avatars.selector).error(this.avatars.fallback);
@@ -45,7 +45,7 @@ var View = {
});
};
- $('form[data-remote]').live('ajax:success', function (e) {
+ $(document).on('ajax:success', 'form[data-remote]', function (e) {
$(this).clearForm();
$(this).focusout();
});
@@ -73,7 +73,7 @@ var View = {
});
/* facebox 'done' buttons */
- $("*[rel*=close]").live('click', function(){ $.facebox.close(); });
+ $(document).on('click', "*[rel*=close]", function(){ $.facebox.close(); });
/* notification routing */
$("#notification").delegate('.hard_object_link', 'click', function(evt){
diff --git a/app/assets/javascripts/widgets/notifications-badge.js b/app/assets/javascripts/widgets/notifications-badge.js
index 1f60bc794..b70868891 100644
--- a/app/assets/javascripts/widgets/notifications-badge.js
+++ b/app/assets/javascripts/widgets/notifications-badge.js
@@ -13,7 +13,15 @@
});
if( ! $.browser.msie ) {
- self.badgeLink.toggle(self.showDropdown, self.hideDropdown);
+ self.badge.on('click', self.badgeLink, function(evt){
+ evt.preventDefault();
+ evt.stopPropagation();
+ if (self.dropdownShowing()){
+ self.hideDropdown();
+ } else {
+ self.showDropdown();
+ }
+ });
}
self.dropdown.click(function(evt) {
@@ -32,9 +40,7 @@
return this.dropdown.css("display") === "block";
};
- this.showDropdown = function(evt) {
- evt.preventDefault();
-
+ this.showDropdown = function() {
self.ajaxLoader.show();
self.badge.addClass("active");
self.dropdown.css("display", "block");
@@ -42,9 +48,7 @@
self.getNotifications();
};
- this.hideDropdown = function(evt) {
- evt.preventDefault();
-
+ this.hideDropdown = function() {
self.badge.removeClass("active");
self.dropdown.css("display", "none");
};
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f7a2b3f94..97ed376eb 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -71,8 +71,6 @@ class UsersController < ApplicationController
flash[:error] = I18n.t 'users.update.follow_settings_not_changed'
end
end
- elsif aspect_order = params[:reorder_aspects]
- @user.reorder_aspects(aspect_order)
end
respond_to do |format|
diff --git a/app/models/user.rb b/app/models/user.rb
index 8105d0961..0261857f9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -245,8 +245,6 @@ class User < ActiveRecord::Base
end
def add_to_streams(post, aspects_to_insert)
- inserted_aspect_ids = aspects_to_insert.map{|x| x.id}
-
aspects_to_insert.each do |aspect|
aspect << post
end
@@ -422,14 +420,6 @@ class User < ActiveRecord::Base
end
end
- def reorder_aspects(aspect_order)
- i = 0
- aspect_order.each do |id|
- self.aspects.find(id).update_attributes({ :order_id => i })
- i += 1
- end
- end
-
# Generate public/private keys for User and associated Person
def generate_keys
key_size = (Rails.env == 'test' ? 512 : 4096)
diff --git a/app/views/contacts/index.html.haml b/app/views/contacts/index.html.haml
index 5ffdc67b4..383cfd187 100644
--- a/app/views/contacts/index.html.haml
+++ b/app/views/contacts/index.html.haml
@@ -18,7 +18,7 @@
#people_stream.stream.contacts
- if @aspect
#aspect_controls
- - if @contacts_size > 0 && @contacts_size < 20 #TODO Fla: why 20? Technical restriction? We already warn the user if > 16
+ - if @contacts_size > 0 && @contacts_size < 20
= start_a_conversation_link(@aspect, @contacts_size)
= link_to edit_aspect_path(@aspect), rel: "facebox", class: "button" do
= t('aspects.edit.manage')
diff --git a/app/views/registrations/new.html.erb b/app/views/registrations/new.html.erb
index 650864c5c..2adb3414b 100644
--- a/app/views/registrations/new.html.erb
+++ b/app/views/registrations/new.html.erb
@@ -19,7 +19,7 @@
<%= t('.sign_up') %>
- <%= form_for(resource, :validate => true, :url => registration_path(resource_name), :html => {:class => "form-horizontal block-form", :autocomplete => "off"}) do |f| %>
+ <%= form_for(resource, :url => registration_path(resource_name), :html => {:class => "form-horizontal block-form", :autocomplete => "off"}) do |f| %>