Commit fd14a13e authored by Tim Rogers's avatar Tim Rogers

MGU-746 fix/workaround for limiting tags field

parent 8cf25ad1
......@@ -43,12 +43,23 @@ module.exports={
}
});
$el.find('.chips').material_chip({
let chips = $el.find('.chips');
chips.material_chip({
data: initialValue,
autocompleteData: availableTags.autocomplete,
onlyAutocomplete: true,
limit: $.widget.limit
});
});
const $input = $el.find('input');
const toggleInput = function() {
if($.widget.limit && $el.find('.chip').length >= parseInt($.widget.limit)) {
$input.attr('disabled', true);
} else {
$input.attr('disabled', false);
}
}
toggleInput();
chips.on('chip.add', toggleInput)
chips.on('chip.delete', toggleInput)
});
......
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