1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #26612 -- Fixed SelectFilter2 buttons changing URL.

This commit is contained in:
David Sanders
2016-05-13 11:36:41 +00:00
committed by Tim Graham
parent 996cadfa5f
commit 14c952d581
2 changed files with 11 additions and 5 deletions

View File

@@ -111,16 +111,17 @@ Requires jQuery, core.js, and SelectBox.js.
from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
// Set up the JavaScript event handlers for the select box filter interface
var move_selection = function(elem, move_func, from, to) {
var move_selection = function(e, elem, move_func, from, to) {
if (elem.className.indexOf('active') !== -1) {
move_func(from, to);
SelectFilter.refresh_icons(field_id);
}
e.preventDefault();
};
addEvent(choose_all, 'click', function(e) { move_selection(this, SelectBox.move_all, field_id + '_from', field_id + '_to'); });
addEvent(add_link, 'click', function(e) { move_selection(this, SelectBox.move, field_id + '_from', field_id + '_to'); });
addEvent(remove_link, 'click', function(e) { move_selection(this, SelectBox.move, field_id + '_to', field_id + '_from'); });
addEvent(clear_all, 'click', function(e) { move_selection(this, SelectBox.move_all, field_id + '_to', field_id + '_from'); });
addEvent(choose_all, 'click', function(e) { move_selection(e, this, SelectBox.move_all, field_id + '_from', field_id + '_to'); });
addEvent(add_link, 'click', function(e) { move_selection(e, this, SelectBox.move, field_id + '_from', field_id + '_to'); });
addEvent(remove_link, 'click', function(e) { move_selection(e, this, SelectBox.move, field_id + '_to', field_id + '_from'); });
addEvent(clear_all, 'click', function(e) { move_selection(e, this, SelectBox.move_all, field_id + '_to', field_id + '_from'); });
addEvent(filter_input, 'keypress', function(e) { SelectFilter.filter_key_press(e, field_id); });
addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });