From 43f5d7c62163fea618bb9a81aa42b65406e04720 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Fri, 8 Oct 2021 01:39:42 +0530 Subject: [PATCH] Refined offers list screen refs https://github.com/TryGhost/Team/issues/1084 - updates offer list to show fixed amount discounts - cleans up offer list usage --- ghost/admin/app/controllers/offers.js | 12 ------------ ghost/admin/app/templates/offers.hbs | 17 +++++++++-------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/ghost/admin/app/controllers/offers.js b/ghost/admin/app/controllers/offers.js index 140f3d4ef1..80e36e73db 100644 --- a/ghost/admin/app/controllers/offers.js +++ b/ghost/admin/app/controllers/offers.js @@ -13,18 +13,6 @@ export default class MembersController extends Controller { return this.offers.length > 0; } - get offersList() { - const offersList = this.offers.map((offer) => { - return { - offerModel: offer, - ...offer.toJSON(), - duration: offer.duration || 'Once', - cadenceInterval: offer.cadence === 'year' ? 'Yearly' : 'Monthly' - }; - }); - return offersList; - } - @task({restartable: true}) *fetchOffersTask() { this.offers = yield this.store.query('offer', {limit: 'all'}); diff --git a/ghost/admin/app/templates/offers.hbs b/ghost/admin/app/templates/offers.hbs index c145c9eb17..c99bd22121 100644 --- a/ghost/admin/app/templates/offers.hbs +++ b/ghost/admin/app/templates/offers.hbs @@ -17,30 +17,31 @@ Redemptions - {{#each this.offersList as |offer|}} + {{#each this.offers as |offer|}} - +

{{offer.name}}

- - {{offer.tier.name}} - {{offer.cadenceInterval}} + + {{offer.tier.name}} + - {{if (eq offer.cadence 'month') 'Monthly' 'Yearly'}} - + {{svg-jar "offer"}} {{#if (eq offer.type 'percent')}} {{offer.amount}}% OFF {{/if}} {{#if (eq offer.type 'fixed')}} - 20% OFF + {{offer.currency}}{{offer.amount}} OFF {{/if}} – {{offer.duration}} - + - - +
{{svg-jar "link"}}