tap/app/assets/javascripts/quickpay.js

41 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-10-28 16:57:11 +01:00
ready = function() {
2016-03-03 00:10:34 +01:00
$('[data-quickpay]').on("ajax:success", function(e, data, status, xhr) {
if (this.id !== "dagschotel_quickpay") {
2016-03-03 00:10:34 +01:00
// Last Image
var img = $("<img>", {
src: $(this).closest(".overviewthumbnail").find(".avatar").attr("src").replace("large", "small"),
class: ["img-responsive img-circle img-thumbnail"]
})
$(img).hide().prependTo($("#last")).fadeIn();
if ($("#last").find("img").size() > 10) {
$("#last").find("img").last().remove();
}
$(".alert").fadeOut();
2015-10-28 20:48:49 +01:00
2016-03-03 00:10:34 +01:00
// Flash Message
var div = $("<div>", {
class: ["alert alert-success alert-dismissable"]
});
$(div).append($("<button>", {
text: 'x',
class: "close",
data: {
dismiss: "alert"
}
}));
$(div).append($("<strong>", {
text: "Success! "
}));
$(div).append(data.message);
2015-10-28 20:48:49 +01:00
2016-03-03 00:10:34 +01:00
$("#flash").append(div);
}
2015-10-28 20:48:49 +01:00
2016-03-03 00:10:34 +01:00
}).on("ajax:error", function(e, xhr, status, error) {
alert("Error while using quickpay ... sorry.");
});
2015-10-28 16:57:11 +01:00
}
$(document).ready(ready);
$(document).on('page:load', ready);