Commit 9a23da2d authored by Alfredo Sumaran's avatar Alfredo Sumaran

Set default label when unselecting all options

[ci skip]
parent 02da2b40
......@@ -9,6 +9,7 @@
this.$dropdown = $dropdown;
this.usersPath = '/autocomplete/users.json';
this.inputCount = 0;
this.defaultLabel = this.$dropdown.data('defaultLabel');
$dropdown.glDropdown({
selectable: true,
......@@ -28,7 +29,6 @@
e.preventDefault();
self.inputCount++;
onSelect();
return;
}
});
}
......@@ -46,9 +46,13 @@
let types = _.groupBy(currentItems, (item) => { return item.dataset.type; });
let label = [];
if (_.isEmpty(types)) {
label.push(this.defaultLabel);
} else {
_.allKeys(types).map((type) => {
label.push(`${types[type].length} ${type}`);
});
}
return label.join(' and ');
}
......
......@@ -24,14 +24,14 @@
.col-md-10
= dropdown_tag('Select',
options: { toggle_class: 'js-allowed-to-merge wide js-multiselect', dropdown_class: 'dropdown-menu-user dropdown-menu-selectable', filter: true,
data: { input_id: 'merge_access_levels_attributes' }})
data: { input_id: 'merge_access_levels_attributes', default_label: 'Select' }})
.form-group
%label.col-md-2.text-right{ for: 'push_access_levels_attributes' }
Allowed to push:
.col-md-10
= dropdown_tag('Select',
options: { toggle_class: 'js-allowed-to-push wide js-multiselect', dropdown_class: 'dropdown-menu-user dropdown-menu-selectable', filter: true,
data: { input_id: 'push_access_levels_attributes' }})
data: { input_id: 'push_access_levels_attributes', default_label: 'Select' }})
.panel-footer
= f.submit 'Protect', class: 'btn-create btn', disabled: true
Markdown is supported
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