Make quick pay reload, the bad way
This commit is contained in:
parent
8265004df5
commit
0ecde8201e
2 changed files with 36 additions and 30 deletions
|
@ -1,36 +1,41 @@
|
|||
ready = function() {
|
||||
$('[data-quickpay]').on("ajax:success", function (e, data, status, xhr) {
|
||||
$('[data-quickpay]').on("ajax:success", function(e, data, status, xhr) {
|
||||
if (this.id === "dagschotel_quickpay") {
|
||||
location.reload(false);
|
||||
} else {
|
||||
// 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();
|
||||
|
||||
// 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();
|
||||
// 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);
|
||||
|
||||
// Flash Message
|
||||
var div = $("<div>", {
|
||||
class: [ "alert alert-success alert-dismissable" ]
|
||||
$("#flash").append(div);
|
||||
}
|
||||
|
||||
}).on("ajax:error", function(e, xhr, status, error) {
|
||||
alert("Error while using quickpay ... sorry.");
|
||||
});
|
||||
$(div).append($("<button>", {
|
||||
text: 'x',
|
||||
class: "close",
|
||||
data: { dismiss: "alert" }
|
||||
}));
|
||||
$(div).append($("<strong>", {
|
||||
text: "Success! "
|
||||
}));
|
||||
$(div).append(data.message);
|
||||
|
||||
$("#flash").append(div);
|
||||
|
||||
}) .on("ajax:error", function (e, xhr, status, error) {
|
||||
alert("Error while using quickpay ... sorry.");
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(ready);
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
- if @user.dagschotel
|
||||
%p.center
|
||||
%b or
|
||||
= link_to quickpay_user_path(@user), remote: true, data: { quickpay: true, type: "json" }, class: "btn btn-default btn-block" do
|
||||
-#%button.btn.btn-default.product{ data: { product: @user.dagschotel} }
|
||||
= link_to quickpay_user_path(@user), remote: true, data: { quickpay: true, type: "json" }, id: "dagschotel_quickpay", class: "btn btn-default btn-block" do
|
||||
%p.center Order dagschotel
|
||||
= image_tag @user.dagschotel.avatar, title: "Huidige dagschotel"
|
||||
= render 'errors', object: @user
|
||||
|
|
Loading…
Reference in a new issue