FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit b2de9133 authored by Robin Goodall's avatar Robin Goodall :speech_balloon:
Browse files

Merge branch 'issue-15-cannot-select-item-twice' into 'master'

Missing feature: a user/group cannot be selected twice.

Closes #15

See merge request !14
parents 63d9322c e2aa54b0
No related branches found
No related tags found
1 merge request!14Missing feature: a user/group cannot be selected twice.
Pipeline #2249 passed
django-ucamlookup changelog
=============================
3.0.2 - 30/04/2019
------------------
- Replaced a feature that was removed in 3.0.0: namely that if a user or group is currently
selected in the control, it's filtered out of the dropdown results and thus can't be selected
twice.
3.0.1 - 30/04/2019
------------------
......
......@@ -34,8 +34,13 @@
processResults: function (data) {
if (data.searchId_g != searchId_g)
return;
// create the set of current selections
var groupids = new Set($select.select2('data').map(function(item) {return item.id}));
// filter out any results that are currently selected
return {
results: $.map(data.groups, function(group) {
results: data.groups.filter(function(group) {
return ! groupids.has(group.groupid)
}).map(function(group) {
return create_data(group.groupid, group.title)
})
};
......
......@@ -34,8 +34,13 @@
processResults: function (data) {
if (data.searchId_u != searchId_u)
return;
// create the set of current selections
var crsids = new Set($select.select2('data').map(function(item) {return item.id}));
// filter out any results that are currently selected
return {
results: $.map(data.persons, function(person) {
results: data.persons.filter(function(person) {
return ! crsids.has(person.crsid)
}).map(function(person) {
return create_data(person.crsid, person.visibleName)
})
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment