From 7130fc28338352f3a1273bbe006141d8f4a1dd3e Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 10 Aug 2022 16:02:34 +0530 Subject: [PATCH] Wired free trial offer UI in offers list refs https://github.com/TryGhost/Team/issues/1726 - refines UI for a trial offer in offer list --- ghost/admin/app/controllers/offers.js | 6 +++++- ghost/admin/app/templates/offers.hbs | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ghost/admin/app/controllers/offers.js b/ghost/admin/app/controllers/offers.js index 634ebc0a0c..f9c7f17d08 100644 --- a/ghost/admin/app/controllers/offers.js +++ b/ghost/admin/app/controllers/offers.js @@ -44,7 +44,11 @@ export default class MembersController extends Controller { const price = offer.cadence === 'month' ? tier.monthlyPrice : tier.yearlyPrice; offer.finalCurrency = offer.currency || tier.currency; offer.originalPrice = price; - offer.updatedPrice = offer.type === 'fixed' ? (price - offer.amount) : (price - ((price * offer.amount) / 100)); + if (offer.type !== 'trial') { + offer.updatedPrice = offer.type === 'fixed' ? (price - offer.amount) : (price - ((price * offer.amount) / 100)); + } else { + offer.updatedPrice = offer.originalPrice; + } return offer; }); } diff --git a/ghost/admin/app/templates/offers.hbs b/ghost/admin/app/templates/offers.hbs index 158b16213b..a9d52a53b3 100644 --- a/ghost/admin/app/templates/offers.hbs +++ b/ghost/admin/app/templates/offers.hbs @@ -64,17 +64,23 @@ {{#if (feature 'freeTrial')}} {{#if (eq offer.type 'trial')}} {{svg-jar "offer"}} - 21 DAYS FREE + {{offer.amount}} DAYS FREE {{/if}} {{/if}} - –  - {{if (eq offer.duration 'once') "First-payment" "Repeating"}} - + {{#if (not (eq offer.type 'trial'))}} + –  + {{if (eq offer.duration 'once') "First-payment" "Repeating"}} + + {{/if}} - {{currency-symbol offer.finalCurrency}}{{gh-price-amount offer.updatedPrice}} - {{currency-symbol offer.finalCurrency}}{{gh-price-amount offer.originalPrice}} + {{#if (eq offer.type 'trial')}} + {{currency-symbol offer.finalCurrency}}{{gh-price-amount offer.originalPrice}} + {{else}} + {{currency-symbol offer.finalCurrency}}{{gh-price-amount offer.updatedPrice}} + {{currency-symbol offer.finalCurrency}}{{gh-price-amount offer.originalPrice}} + {{/if}} {{offer.redemptionCount}}