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

View file

@ -424,6 +424,11 @@ var SmartAnnotation = (function() {
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) {
var atWho = new setAtWho(field);
@ -432,7 +437,8 @@ var SmartAnnotation = (function() {
var publicApi = Object.freeze({
init: initialize,
preventPropagation: atwhoStopPropagation
preventPropagation: atwhoStopPropagation,
closePopup: closePopup
});
return publicApi;