Skip to content

Commit

Permalink
Change "Delete" to "Archive" in PDP (#1513)
Browse files Browse the repository at this point in the history
* Change dropdown value

* Change labels and value

* Add archive translations

* Use archive translations

* Use archive action

* Change badge title

* Change confirmation dialog

* Add archived messages

* Remove deleteThisProduct key

* Change to Archive for variants as well
  • Loading branch information
brent-hoover authored and Aaron Judd committed Oct 24, 2016
1 parent f9f5222 commit 585f1a3
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ class PublishControls extends Component {
if (this.props.revisions[0].documentData.isDeleted) {
return (
<Button
label="Deleted"
label="Archived"
onClick={this.handleRestore}
status="danger"
i18nKeyLabel="app.deleted"
i18nKeyLabel="app.archived"
/>
);
}
Expand Down Expand Up @@ -194,10 +194,10 @@ class PublishControls extends Component {
/>
<Divider />
<MenuItem
i18nKeyLabel="app.delete"
i18nKeyLabel="app.archive"
icon="fa fa-trash-o"
label="Delete"
value="delete"
label="Archive"
value="archive"
/>
</Menu>
</Popover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PublishContainer extends Component {

handlePublishActions = (event, action, documentIds) => {
switch (action) {
case "delete":
case "archive":
if (this.props.onAction) {
this.props.onAction(event, action, this.props.documentIds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChildVariant extends Component {
if (this.props.variant.isDeleted) {
return (
<span className="badge badge-danger">
<Translation defaultValue="Deleted" i18nKey="app.deleted" />
<Translation defaultValue="Archived" i18nKey="app.archived" />
</span>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ProductDetail extends Component {
}

handlePublishActions = (event, action) => {
if (action === "delete" && this.props.onDeleteProduct) {
if (action === "archive" && this.props.onDeleteProduct) {
this.props.onDeleteProduct(this.product._id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Variant extends Component {
if (this.props.variant.isDeleted) {
return (
<span className="badge badge-danger">
<Translation defaultValue="Deleted" i18nKey="app.deleted" />
<Translation defaultValue="Archived" i18nKey="app.archived" />
</span>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
{{optionTitle}} - {{formatPrice price}}
{{#if isDeleted}}
<div class="panel-subheading">
<span class="badge badge-danger" data-i18n="app.deleted">
<span>Deleted</span>
<span class="badge badge-danger" data-i18n="app.archived">
<span>Archived</span>
</span>
</div>
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ Template.childVariantForm.events({
const title = instance.data.optionTitle || i18next.t("productDetailEdit.thisOption");

Alerts.alert({
title: i18next.t("productDetailEdit.removeVariantConfirm", { title }),
title: i18next.t("productDetailEdit.archiveVariantConfirm", { title }),
showCancelButton: true,
confirmButtonText: "Remove"
confirmButtonText: "Archive"
}, (isConfirm) => {
if (isConfirm) {
const id = instance.data._id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<span data-i18n="productDetailEdit.variantDetails">Variant Details</span>
{{#if isDeleted}}
<div class="panel-subheading">
<span class="badge badge-danger" data-i18n="app.deleted">
<span>Deleted</span>
<span class="badge badge-danger" data-i18n="app.archived">
<span>Archived</span>
</span>
</div>
{{/if}}
Expand All @@ -43,7 +43,7 @@
{{> button
icon="trash-o"
className="btn btn-default btn-remove-variant"
tooltip="Remove"
tooltip="Archive"
i18nTooltip="productDetailEdit.removeVariant"
onClick=(removeVariant this)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ Template.variantForm.helpers({
const title = variant.title || i18next.t("productDetailEdit.thisVariant");

Alerts.alert({
title: i18next.t("productDetailEdit.removeVariantConfirm", { title }),
title: i18next.t("productDetailEdit.archiveVariantConfirm", { title }),
showCancelButton: true,
confirmButtonText: "Remove"
confirmButtonText: "Archive"
}, (isConfirm) => {
if (isConfirm) {
const id = variant._id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

{{#if product.isDeleted}}
<div>
<span class="badge badge-danger" data-i18n="app.deleted">
<span>Deleted</span>
<span class="badge badge-danger" data-i18n="app.archived">
<span>Archived</span>
</span>
</div>
{{/if}}
Expand Down
12 changes: 6 additions & 6 deletions lib/api/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ ReactionProduct.publishProduct = function (productOrArray) {
*/
ReactionProduct.toggleVisibility = function (productOrArray) {
const products = !_.isArray(productOrArray) ? [productOrArray] : productOrArray;
for (let product of products) {
for (const product of products) {
Meteor.call("products/toggleVisibility", product._id, (error, result) => {
if (error) {
Alerts.add(error, "danger", {
Expand Down Expand Up @@ -404,16 +404,16 @@ ReactionProduct.maybeDeleteProduct = function (productOrArray) {
// we are using i18next `plural` functionality here.
// @see: http://i18next.com/translate/pluralSimple
if (products.length === 1) {
confirmTitle = i18next.t("productDetailEdit.deleteThisProduct");
confirmTitle = i18next.t("productDetailEdit.archiveThisProduct");
} else {
confirmTitle = i18next.t("productDetailEdit.deleteSelectedProducts");
confirmTitle = i18next.t("productDetailEdit.archiveSelectedProducts");
}

Alerts.alert({
title: confirmTitle,
type: "warning",
showCancelButton: true,
confirmButtonText: "Remove"
confirmButtonText: "Archive"
}, (isConfirm) => {
if (isConfirm) {
Meteor.call("products/deleteProduct", productIds, function (error, result) {
Expand All @@ -429,10 +429,10 @@ ReactionProduct.maybeDeleteProduct = function (productOrArray) {
FlowRouter.go("/");
if (products.length === 1) {
title = products[0].title || "productDetail.";
Alerts.toast(i18next.t("productDetail.deletedAlert", { product: title }), "info");
Alerts.toast(i18next.t("productDetail.archivedAlert", { product: title }), "info");
} else {
title = i18next.t("productDetail.theSelectedProducts");
Alerts.toast(i18next.t("productDetail.deletedAlert_plural", { product: title, count: 0 }), "info");
Alerts.toast(i18next.t("productDetail.archivedAlert_plural", { product: title, count: 0 }), "info");
}
}
});
Expand Down
1 change: 0 additions & 1 deletion private/data/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@
"toggleSize": "تبديل الحجم",
"deleteProduct": "إلغاء منتج",
"restoreProduct": "إستعادة المنتج من سلة المهملات",
"deleteThisProduct": "حذف هذا المنتج؟",
"deleteSelectedProducts": "هل تريد حذف المنتجات المختارة؟",
"publish": "نشر",
"moreOptions": "خيارات إضافية",
Expand Down
3 changes: 1 addition & 2 deletions private/data/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
"toggleSize": "Größe anpassen",
"deleteProduct": "Produkt löschen",
"restoreProduct": "Produkt aus dem Papierkorb wiederherstellen",
"deleteThisProduct": "Dieses Produkt löschen?",
"deleteSelectedProducts": "Gewählte Produkte löschen?",
"publish": "Veröffentlichen",
"moreOptions": "Weitere Optionen",
Expand Down Expand Up @@ -830,4 +829,4 @@
}
}
}
}]
}]
8 changes: 7 additions & 1 deletion private/data/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
"submit": "Submit",
"delete": "Delete",
"deleted": "Deleted",
"archive": "Archive",
"archived": "Archived",
"create": "Create",
"close": "Close",
"settings": "Settings",
Expand Down Expand Up @@ -305,6 +307,8 @@
"clonedAlert_plural": "Cloned {{product}}",
"deletedAlert": "Deleted {{product}}",
"deletedAlert_plural": "Deleted {{product}}",
"archivedAlert": "Archived {{product}}",
"archivedAlert_plural": "Archived {{product}}",
"theProduct": "the product",
"theSelectedProducts": "the selected products",
"startTracking": "Start Tracking",
Expand Down Expand Up @@ -346,15 +350,17 @@
"removeVariant": "Remove",
"removeVariantConfirm": "Are you sure you want to delete {{title}}",
"restoreVariantConfirm": "Are you sure you want to restore {{title}} from the trash?",
"archiveVariantConfirm": "Are you sure you want to archive {{title}}",
"thisVariant": "this variant",
"thisOption": "this option",
"duplicateProduct": "Duplicate Product",
"pinProduct": "Pin Product",
"toggleSize": "Toggle Size",
"deleteProduct": "Delete Product",
"restoreProduct": "Restore Product from Trash",
"deleteThisProduct": "Delete this product?",
"deleteSelectedProducts": "Delete selected products?",
"archiveThisProduct": "Archive this product?",
"archiveSelectedProducts": "Archive selected products?",
"publish": "Publish",
"moreOptions": "More Options",
"details": "Details",
Expand Down
3 changes: 1 addition & 2 deletions private/data/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
"toggleSize": "Tamaño de la palanca",
"deleteProduct": "Eliminar producto",
"restoreProduct": "Recuperar el producto desde la papelera",
"deleteThisProduct": "¿Eliminar este producto?",
"deleteSelectedProducts": "¿Eliminar productos seleccionados?",
"publish": "Publicar",
"moreOptions": "Más opciones",
Expand Down Expand Up @@ -830,4 +829,4 @@
}
}
}
}]
}]
3 changes: 1 addition & 2 deletions private/data/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
"toggleSize": "Modification de la taille",
"deleteProduct": "Supprimer le produit",
"restoreProduct": "Restaurer les produits de la corbeille",
"deleteThisProduct": "Supprimer ce produit ?",
"deleteSelectedProducts": "Supprimer les produits sélectionnés ?",
"publish": "Publier",
"moreOptions": "Options supplémentaires",
Expand Down Expand Up @@ -830,4 +829,4 @@
}
}
}
}]
}]
1 change: 0 additions & 1 deletion private/data/i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@
"toggleSize": "החלף מידה/גודל",
"deleteProduct": "מחק מוצר",
"restoreProduct": "שחזר מוצר מפח האשפה",
"deleteThisProduct": "למחוק מוצר זה?",
"deleteSelectedProducts": "למחוק מוצרים שנבחרו?",
"publish": "פרסום",
"moreOptions": "עוד אפשרויות",
Expand Down
3 changes: 1 addition & 2 deletions private/data/i18n/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
"toggleSize": "Dimensiune comutare",
"deleteProduct": "Șterge produs",
"restoreProduct": "Recuperare produs din coșul de gunoi",
"deleteThisProduct": "Ștergeți acest produs?",
"deleteSelectedProducts": "Ștergeți produsele selectate?",
"publish": "Publică",
"moreOptions": "Mai multe opțiuni",
Expand Down Expand Up @@ -830,4 +829,4 @@
}
}
}
}]
}]
3 changes: 1 addition & 2 deletions private/data/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
"toggleSize": "Поменять размер",
"deleteProduct": "Удалить товар",
"restoreProduct": "Восстановить товар из корзины",
"deleteThisProduct": "Удалить этот товар?",
"deleteSelectedProducts": "Удалить выбранные товары?",
"publish": "Опубликовать",
"moreOptions": "Больше опций",
Expand Down Expand Up @@ -830,4 +829,4 @@
}
}
}
}]
}]
3 changes: 1 addition & 2 deletions private/data/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
"toggleSize": "切换大小",
"deleteProduct": "删除产品",
"restoreProduct": "从垃圾箱恢复产品",
"deleteThisProduct": "删除此产品?",
"deleteSelectedProducts": "删除选择的产品?",
"publish": "发布",
"moreOptions": "更多选项",
Expand Down Expand Up @@ -830,4 +829,4 @@
}
}
}
}]
}]

0 comments on commit 585f1a3

Please sign in to comment.