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

Commit

Permalink
chore(cart): Update message to handle no files
Browse files Browse the repository at this point in the history
- Updates message so it properly notifies zero files
  can be added to cart.

Closes #968"
  • Loading branch information
mjschranz committed Jul 8, 2015
1 parent 85b102c commit 1c291fd
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions app/scripts/cart/cart.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,24 @@ module ngApp.cart.services {
}

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

if (this.getFiles().length !== 0) {
template.unshift("Only");
template.push("more");
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");
}

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

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

Expand Down

0 comments on commit 1c291fd

Please sign in to comment.