Commit 8768bd80 authored by Fabian Galinski's avatar Fabian Galinski 😾
Browse files

Merge branch 'feature_1683_fix_newsletter_groups_selection' into 'master'

[BUGFIX] 1683 Fix Newsletter groups selection for clone groups

See merge request !25
parents 4fd60570 86c57ecb
## select2-to-tree
### JavaScript
I changed the buildSelect() function so that
it correctly reads the labelFld, valFld, selFld option
I changed the buildSelect() function so that it correctly reads
the labelFld, valFld, selFld option
### CSS
.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before -
removed the top: directive
## select2.full.js
- I changed MultipleSelection.prototype.update() so that if we have
clone groups (groups with more than one parent), it only adds one token
with that value
- I changed SelectAdapter.prototype.unselect() so that if you unselect one
of the clone groups (groups with more than one parent), it unselects all
......@@ -1756,24 +1756,28 @@ S2.define('select2/selection/multiple',[
}
var $selections = [];
var alreadySelected = {};
for (var d = 0; d < data.length; d++) {
var selection = data[d];
if (!alreadySelected[data[d].id]) {
var selection = data[d];
var $selection = this.selectionContainer();
var formatted = this.display(selection, $selection);
var $selection = this.selectionContainer();
var formatted = this.display(selection, $selection);
$selection.append(formatted);
$selection.append(formatted);
alreadySelected[data[d].id] = true;
var title = selection.title || selection.text;
var title = selection.title || selection.text;
if (title) {
$selection.attr('title', title);
}
if (title) {
$selection.attr('title', title);
}
Utils.StoreData($selection[0], 'data', selection);
Utils.StoreData($selection[0], 'data', selection);
$selections.push($selection);
$selections.push($selection);
}
}
var $rendered = this.$selection.find('.select2-selection__rendered');
......@@ -1933,7 +1937,7 @@ S2.define('select2/selection/allowClear',[
return;
}
var removeAll = this.options.get('translations').get('removeAllItems');
var removeAll = this.options.get('translations').get('removeAllItems');
var $remove = $(
'<span class="select2-selection__clear" title="' + removeAll() +'">' +
......@@ -3243,6 +3247,11 @@ S2.define('select2/data/select',[
if ($(data.element).is('option')) {
data.element.selected = false;
var clones = this.$element.find('[value=' + data.id + ']');
// must be a for loop to be synchronous
for (var i = 0; i < clones.length; i++) {
clones[i].selected = false;
}
this.$element.trigger('change');
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment