Ticket #24406: selectfilter.diff

File selectfilter.diff, 4.0 KB (added by Rolf Jagerman, 10 years ago)

SelectFilter2.js git diff

  • django/contrib/admin/static/admin/js/SelectFilter2.js

    diff --git a/django/contrib/admin/static/admin/js/SelectFilter2.js b/django/contrib/admin/static/admin/js/SelectFilter2.js
    index 6c8a4b4..5313c3c 100644
    a b window.SelectFilter = {  
    5858        filter_input.id = field_id + '_input';
    5959
    6060        selector_available.appendChild(from_box);
    61         var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'title', interpolate(gettext('Click to choose all %s at once.'), [field_name]), 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_all_link');
     61        var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'title', interpolate(gettext('Click to choose all %s at once.'), [field_name]), 'href', 'javascript:void(0);', 'id', field_id + '_add_all_link');
     62        choose_all.addEventListener("click", function() {
     63            SelectBox.move_all(field_id + "_from", field_id + "_to");
     64            SelectFilter.refresh_icons(field_id);
     65        });
    6266        choose_all.className = 'selector-chooseall';
    6367
    6468        // <ul class="selector-chooser">
    6569        var selector_chooser = quickElement('ul', selector_div);
    6670        selector_chooser.className = 'selector-chooser';
    67         var add_link = quickElement('a', quickElement('li', selector_chooser), gettext('Choose'), 'title', gettext('Choose'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_link');
     71        var add_link = quickElement('a', quickElement('li', selector_chooser), gettext('Choose'), 'title', gettext('Choose'), 'href', 'javascript:void(0);', 'id', field_id + '_add_link');
     72        add_link.addEventListener("click", function() {
     73            SelectBox.move(field_id + "_from", field_id + "_to");
     74            SelectFilter.refresh_icons(field_id);
     75        });
    6876        add_link.className = 'selector-add';
    69         var remove_link = quickElement('a', quickElement('li', selector_chooser), gettext('Remove'), 'title', gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_link');
     77        var remove_link = quickElement('a', quickElement('li', selector_chooser), gettext('Remove'), 'title', gettext('Remove'), 'href', 'javascript:void(0);', 'id', field_id + '_remove_link');
     78        remove_link.addEventListener("click", function() {
     79            SelectBox.move(field_id + "_to", field_id + "_from");
     80            SelectFilter.refresh_icons(field_id);
     81        });
    7082        remove_link.className = 'selector-remove';
    7183
    7284        // <div class="selector-chosen">
    window.SelectFilter = {  
    7789
    7890        var to_box = quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name'));
    7991        to_box.className = 'filtered';
    80         var clear_all = quickElement('a', selector_chosen, gettext('Remove all'), 'title', interpolate(gettext('Click to remove all chosen %s at once.'), [field_name]), 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_all_link');
     92        var clear_all = quickElement('a', selector_chosen, gettext('Remove all'), 'title', interpolate(gettext('Click to remove all chosen %s at once.'), [field_name]), 'href', 'javascript:void(0);', 'id', field_id + '_remove_all_link');
     93        clear_all.addEventListener("click", function() {
     94            SelectBox.move_all(field_id + "_to", field_id + "_from");
     95            SelectFilter.refresh_icons(field_id);
     96        });
    8197        clear_all.className = 'selector-clearall';
    8298
    8399        from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
Back to Top