Skip to content
Snippets Groups Projects
Select Git revision
  • 2b79c1a3222a1fe9b524a7781365766bdefd9a08
  • master default protected
2 results

Migration.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    selection.js 984 B
    function findList(selector, context) {
        var list = $(context)
            .closest('.studip-selection')
            .find(selector);
        if (list.is('ul')) {
            return list;
        }
        return list.find('ul:first');
    }
    
    $(document).on('click', '.studip-selection:not(.disabled) li:not(.empty-placeholder)', function() {
        var remove = $(this).is('.studip-selection-selected li'),
            item_id = $(this).data().selectionId,
            attr_name =
                $(this)
                    .closest('.studip-selection')
                    .data().attributeName || 'selected',
            list;
        if (remove) {
            list = findList('.studip-selection-selectable', this);
            $('input[type=hidden]', this).remove();
        } else {
            list = findList('.studip-selection-selected', this);
            $('<input type="hidden" name="' + attr_name + '[]">')
                .val(item_id)
                .prependTo(this);
        }
    
        $(this)
            .remove()
            .appendTo(list);
    
        return false;
    });