Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(cart): 1952 update cart limit warning
Browse files Browse the repository at this point in the history
Closes #1952
  • Loading branch information
alex-wilmer committed Apr 20, 2016
1 parent ad2d4d2 commit ca3bb8a
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions app/scripts/cart/cart.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,32 +241,27 @@ module ngApp.cart.services {
}

sizeWarning() {
var cartAvailable = this.getCartVacancySize(),
template = ["Only", this.$filter("number")(cartAvailable)];

if (cartAvailable !== this.getMaxSize()) {
if (cartAvailable > 1) {
template.push("more");
template.push("files");
} else if (cartAvailable === 1) {
template.push("more");
template.push("file");
} else {
template = ["No more files"];
}
} else {
template.push("files");
var cartAvailable = this.getCartVacancySize()
var template = [
"The cart is limited to " + this.$filter("number")(this.getMaxSize()) + " files.",
!this.files.length
? "Please narrow down your search criteria to be able to add files to your cart."
: this.files.length < this.getMaxSize()
? this.$filter("number")(cartAvailable) + getRemaining() + "can be added to the cart."
: "You cannot add anymore files to the cart."
];

function getRemaining() {
return cartAvailable > 1 ? " more files " : " more file ";
}

template.push("can be added to the cart.");

template = "<span>" + this.gettextCatalog.getString(template.join(" ")) + "</span>";
var messageTemplate = "<span>" + this.gettextCatalog.getString(template.join(" ")) + "</span>";

this.notify.config({ duration: 5000 });
this.notify.closeAll();
this.notify({
message: "",
messageTemplate: template,
messageTemplate: messageTemplate,
container: "#notification",
classes: "alert-warning"
});
Expand Down

0 comments on commit ca3bb8a

Please sign in to comment.