X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/362ea2e7f8ac4254398791139cc060090199f400..938fc832934e508085dad3645c01060a4dc9f0c9:/wolnelektury/static/js/ordered_select_multiple.js?ds=sidebyside diff --git a/wolnelektury/static/js/ordered_select_multiple.js b/wolnelektury/static/js/ordered_select_multiple.js index e4fd74daa..06ad40cb3 100644 --- a/wolnelektury/static/js/ordered_select_multiple.js +++ b/wolnelektury/static/js/ordered_select_multiple.js @@ -4,10 +4,10 @@ choices: [] }; $.extend(settings, options); - + var input = $(this).hide(); var values = input.val().split(','); - + var container = $('
').insertAfter($(this)); var choicesList = $('
    ').appendTo(container).css({ width: 200, float: 'left', minHeight: 200, backgroundColor: '#eee', margin: 0, padding: 0 @@ -19,7 +19,7 @@ $.each(settings.choices, function() { choiceIds.push('' + this.id); }); - + function createItem(hash) { return $('
  1. ' + hash.name + '
  2. ').css({ backgroundColor: '#cff', @@ -29,24 +29,24 @@ margin: 0 }).data('obj-id', hash.id); } - + $.each(settings.choices, function() { if ($.inArray('' + this.id, values) == -1) { choicesList.append(createItem(this)); } }); - + $.each(values, function() { var index = $.inArray('' + this, choiceIds); // Why this[0]? if (index != -1) { valuesList.append(createItem(settings.choices[index])); } }); - + choicesList.sortable({ connectWith: '.connectedSortable' }).disableSelection(); - + valuesList.sortable({ connectWith: '.connectedSortable', update: function() {