1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Fixed #29536 -- Fixed SelectFilter2.js resizing to make boxes have equal height.

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz 2018-06-29 16:23:28 +02:00
parent 4fba321a45
commit a5f139236f
2 changed files with 6 additions and 2 deletions

View File

@ -164,8 +164,8 @@ Requires jQuery, core.js, and SelectBox.js.
if (!is_stacked) { if (!is_stacked) {
// In horizontal mode, give the same height to the two boxes. // In horizontal mode, give the same height to the two boxes.
var j_from_box = $(from_box); var j_from_box = $('#' + field_id + '_from');
var j_to_box = $(to_box); var j_to_box = $('#' + field_id + '_to');
var resize_filters = function() { j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight()); }; var resize_filters = function() { j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight()); };
if (j_from_box.outerHeight() > 0) { if (j_from_box.outerHeight() > 0) {
resize_filters(); // This fieldset is already open. Resize now. resize_filters(); // This fieldset is already open. Resize now.

View File

@ -11,6 +11,10 @@ QUnit.test('init', function(assert) {
SelectFilter.init('id', 'things', 0); SelectFilter.init('id', 'things', 0);
assert.equal($('.selector-available h2').text().trim(), "Available things"); assert.equal($('.selector-available h2').text().trim(), "Available things");
assert.equal($('.selector-chosen h2').text().trim(), "Chosen things"); assert.equal($('.selector-chosen h2').text().trim(), "Chosen things");
assert.equal(
$('.selector-available select').outerHeight() + $('.selector-filter').outerHeight(),
$('.selector-chosen select').height()
);
assert.equal($('.selector-chooseall').text(), "Choose all"); assert.equal($('.selector-chooseall').text(), "Choose all");
assert.equal($('.selector-add').text(), "Choose"); assert.equal($('.selector-add').text(), "Choose");
assert.equal($('.selector-remove').text(), "Remove"); assert.equal($('.selector-remove').text(), "Remove");