Commit 8803376d authored by jonas.goetze's avatar jonas.goetze

[BUGFIX] evaluate response from action and provide feedback if something went wrong

parent dfc64af9
Pipeline #9766 passed with stages
in 5 minutes and 38 seconds
......@@ -103,12 +103,63 @@ jQuery(document).ready(function ($) {
},
dataType: "json",
success: function (returnData) {
$(item).removeClass(removeClass).addClass(addClass);
$(item).data('rating-type', newRatingType);
if (subRemoveClass && subAddClass) {
$(item).find('i').removeClass(subRemoveClass).addClass(subAddClass);
if(returnData === true) {
$(item).removeClass(removeClass).addClass(addClass);
$(item).data('rating-type', newRatingType);
if (subRemoveClass && subAddClass) {
$(item).find('i').removeClass(subRemoveClass).addClass(subAddClass);
} else {
item.lastChild.nodeValue = " " + likes.toLocaleString('en');
}
} else {
item.lastChild.nodeValue = " " + likes.toLocaleString('en');
$.notify({
// options
icon: "danger",
title: "No rating possible",
message: "Something went wrong while voting. Please try to reload the page."
}, {
// settings
element: "body",
position: "fixed",
type: "danger",
allow_dismiss: true,
newest_on_top: false,
showProgressbar: false,
placement: {
from: "top",
align: "center"
},
offset: 20,
spacing: 10,
z_index: 9000,
delay: 3000,
timer: 1000,
width: '50%',
url_target: "_blank",
mouse_over: null,
animate: {
enter: "animated fadeInDown",
exit: "animated fadeOutUp"
},
onShow: null,
onShown: null,
onClose: null,
onClosed: null,
icon_type: "class",
template: [
'<div class="col-sm-9" data-notify="container">',
'<div class="alert alert-{0}" role="alert">',
'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">&times;</button>',
'<strong class="alert-heading" data-notify="title"><i class="fa fa-info-circle"></i> {1}</strong> ',
'<span class="mb-0" data-notify="message">{2}</span>',
'<div class="progress" data-notify="progressbar">',
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>',
'</div>',
'<a href="{3}" target="{4}" data-notify="url"></a>',
'</div>',
'</div>'
].join('')
});
}
}
});
......
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