Merge pull request #738 from ZmagoD/zd_SCI_1452

fixes issue with smart annotations in repositories [fixes SCI-1452]
This commit is contained in:
Zmago Devetak 2017-07-12 14:50:29 +02:00 committed by GitHub
commit 69919359f1
2 changed files with 10 additions and 2 deletions

View file

@ -572,7 +572,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);
@ -641,9 +640,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();
@ -793,6 +794,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;