fix: [js] Various fixes with adding/removing tags

pull/3989/head
iglocska 2018-12-25 14:04:01 +01:00
parent 6f8e03c657
commit 856a76951f
1 changed files with 17 additions and 2 deletions

View File

@ -619,6 +619,7 @@ function quickSubmitTagCollectionTagForm(tag_collection_id, tag_id) {
}, },
success:function (data, textStatus) { success:function (data, textStatus) {
handleGenericAjaxResponse(data); handleGenericAjaxResponse(data);
refreshTagCollectionRow(tag_collection_id);
}, },
error:function() { error:function() {
showMessage('fail', 'Could not add tag.'); showMessage('fail', 'Could not add tag.');
@ -635,6 +636,20 @@ function quickSubmitTagCollectionTagForm(tag_collection_id, tag_id) {
return false; return false;
} }
function refreshTagCollectionRow(tag_collection_id) {
$.ajax({
type:"get",
url:"/tag_collections/getRow/" + tag_collection_id,
error:function() {
showMessage('fail', 'Could not fetch updates to the modified row.');
},
success: function (data, textStatus) {
$('[data-row-id="' + tag_collection_id + '"]').replaceWith(data);
}
});
}
function handleAjaxEditResponse(data, name, type, id, field, event) { function handleAjaxEditResponse(data, name, type, id, field, event) {
responseArray = data; responseArray = data;
if (type == 'Attribute') { if (type == 'Attribute') {
@ -934,8 +949,8 @@ function removeObjectTag(context, object, tag) {
$("#gray_out").fadeOut(); $("#gray_out").fadeOut();
if (context == 'Attribute') { if (context == 'Attribute') {
loadAttributeTags(object); loadAttributeTags(object);
} else if (context == 'TagCollection') { } else if (context == 'tag_collection') {
refreshTagCollectionRow(object);
} else { } else {
loadEventTags(object); loadEventTags(object);
} }