fixes issue with smart annotations in repositories [fixes SCI-1452]

This commit is contained in:
zmagod 2017-07-10 16:22:32 +02:00
parent 53a1dd14b7
commit baaec67399
2 changed files with 10 additions and 2 deletions

View file

@ -573,7 +573,6 @@ function onClickEdit() {
}); });
// initialize smart annotation // initialize smart annotation
SmartAnnotation.init($('[data-object="repository_cell"]'));
_.each($('[data-object="repository_cell"]'), function(el) { _.each($('[data-object="repository_cell"]'), function(el) {
if (_.isUndefined($(el).data('atwho'))) { if (_.isUndefined($(el).data('atwho'))) {
SmartAnnotation.init(el); SmartAnnotation.init(el);
@ -642,9 +641,11 @@ function onClickSave() {
data: data, data: data,
success: function(data) { success: function(data) {
HelperModule.flashAlertMsg(data.flash, 'success'); HelperModule.flashAlertMsg(data.flash, 'success');
SmartAnnotation.closePopup();
onClickCancel(); onClickCancel();
}, },
error: function(e) { error: function(e) {
SmartAnnotation.closePopup();
var data = e.responseJSON; var data = e.responseJSON;
clearAllErrors(); clearAllErrors();
@ -794,6 +795,7 @@ function onClickCancel() {
}, false); }, false);
changeToViewMode(); changeToViewMode();
updateButtons(); updateButtons();
SmartAnnotation.closePopup();
animateSpinner(null, false); animateSpinner(null, false);
} }

View file

@ -424,6 +424,11 @@ var SmartAnnotation = (function() {
init: init init: init
}; };
} }
// Closes the atwho popup * needed in repositories to close the popup
// if nothing is selected and the user leaves the form *
function closePopup() {
$('.atwho-header-res').find('.glyphicon-remove').click();
}
function initialize(field) { function initialize(field) {
var atWho = new setAtWho(field); var atWho = new setAtWho(field);
@ -432,7 +437,8 @@ var SmartAnnotation = (function() {
var publicApi = Object.freeze({ var publicApi = Object.freeze({
init: initialize, init: initialize,
preventPropagation: atwhoStopPropagation preventPropagation: atwhoStopPropagation,
closePopup: closePopup
}); });
return publicApi; return publicApi;