PHRAS-863 - fix push modal events, fix jquery.selection to allow child events

This commit is contained in:
Florian BLOUET
2015-12-17 12:22:58 +01:00
parent 4f15f1e640
commit 3e02804c51
2 changed files with 15 additions and 22 deletions

View File

@@ -15,18 +15,17 @@
var $this = this; var $this = this;
$('.content .options .select-all', this.container).bind('click', function () { this.container.on('click', '.content .options .select-all', function (event) {
$this.selection.selectAll(); $this.selection.selectAll();
}); });
$('.content .options .unselect-all', this.container).bind('click', function () { this.container.on('click', '.content .options .unselect-all', function (event) {
$this.selection.empty(); $this.selection.empty();
}); });
$('.UserTips', this.container).tooltip(); $('.UserTips', this.container).tooltip();
$('a.user_adder', this.container).bind('click', function () { this.container.on('click', 'a.user_adder', function (event) {
var $this = $(this); var $this = $(this);
$.ajax({ $.ajax({
@@ -57,8 +56,7 @@
return false; return false;
}); });
$('.recommended_users', this.container).bind('click', function () { this.container.on('click', '.recommended_users', function (event) {
var usr_id = $('input[name="usr_id"]', $(this)).val(); var usr_id = $('input[name="usr_id"]', $(this)).val();
$this.loadUser(usr_id, $this.selectUser); $this.loadUser(usr_id, $this.selectUser);
@@ -66,7 +64,7 @@
return false; return false;
}); });
$('.recommended_users_list', this.container).bind('click', function () { this.container.on('click', '.recommended_users_list', function (event) {
var content = $('#push_user_recommendations').html(); var content = $('#push_user_recommendations').html();
@@ -103,6 +101,7 @@
return false; return false;
}); });
//this.container.on('submit', '#PushBox form[name="FeedBackForm"]', function (event) {
$('#PushBox form[name="FeedBackForm"]').bind('submit', function () { $('#PushBox form[name="FeedBackForm"]').bind('submit', function () {
var $this = $(this); var $this = $(this);
@@ -199,8 +198,9 @@
$('.user_content .badges', this.container).disableSelection(); $('.user_content .badges', this.container).disableSelection();
$('.user_content .badges .badge .toggle', this.container).off('click').on('click', function (event) {
// toggle download feature for users
this.container.on('click', '.user_content .badges .badge .toggle', function (event) {
var $this = $(this); var $this = $(this);
$this.toggleClass('status_off status_on'); $this.toggleClass('status_off status_on');
@@ -210,7 +210,8 @@
return false; return false;
}); });
$('.general_togglers .general_toggler', this.container).bind('click', function () { // toggle feature state of selected users
this.container.on('click', '.general_togglers .general_toggler', function (event) {
var feature = $(this).attr('feature'); var feature = $(this).attr('feature');
var $badges = $('.user_content .badge.selected', this.container); var $badges = $('.user_content .badge.selected', this.container);
@@ -228,21 +229,21 @@
return false; return false;
}); });
$('.user_content .badges .badge .deleter', this.container).on('click', function (event) { this.container.on('click', '.user_content .badges .badge .deleter', function (event) {
var $elem = $(this).closest('.badge'); var $elem = $(this).closest('.badge');
$elem.fadeOut(function () { $elem.fadeOut(function () {
$elem.remove(); $elem.remove();
}); });
return; return false;
}); });
$('.list_manager', this.container).bind('click', function () { this.container.on('click', '.list_manager', function (event) {
$('#PushBox').hide(); $('#PushBox').hide();
$('#ListManager').show(); $('#ListManager').show();
return false; return false;
}); });
$('a.list_loader', this.container).bind('click', function () { this.container.on('click', 'a.list_loader', function (event) {
var url = $(this).attr('href'); var url = $(this).attr('href');
var callbackList = function (list) { var callbackList = function (list) {
@@ -256,8 +257,6 @@
return false; return false;
}); });
$('.options button', this.container);
$('form.list_saver', this.container).bind('submit', function () { $('form.list_saver', this.container).bind('submit', function () {
var $form = $(this); var $form = $(this);
var $input = $('input[name="name"]', $form); var $input = $('input[name="name"]', $form);
@@ -337,10 +336,6 @@
return; return;
} }
if (window.console) {
console.log('Selecting', user);
}
var html = _.template($("#" + this.Context.toLowerCase() + "_badge_tpl").html(), { var html = _.template($("#" + this.Context.toLowerCase() + "_badge_tpl").html(), {
user: user user: user
}); });
@@ -663,7 +658,6 @@
initLeft(); initLeft();
$('.badges a.deleter', this.container).on('click', function () { $('.badges a.deleter', this.container).on('click', function () {
var badge = $(this).closest('.badge'); var badge = $(this).closest('.badge');
var usr_id = badge.find('input[name="id"]').val(); var usr_id = badge.find('input[name="id"]').val();

View File

@@ -37,6 +37,7 @@
this.$container.addClass('selectionnable'); this.$container.addClass('selectionnable');
this.$container this.$container
.on('click', this.options.selector, function(event) { .on('click', this.options.selector, function(event) {
event.preventDefault();
if (typeof $this.options.selectStart === 'function') { if (typeof $this.options.selectStart === 'function') {
$this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this); $this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this);
} }
@@ -118,8 +119,6 @@
$this.options.selectStop(jQuery.extend(jQuery.Event('selectStop'), event), $this); $this.options.selectStop(jQuery.extend(jQuery.Event('selectStop'), event), $this);
} }
return false;
}); });
return; return;