From 22de604ede4bc84ffd6f94fe71561ac76788e151 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 4 May 2021 21:20:05 +0530 Subject: [PATCH] Added free membership settings modal refs https://github.com/TryGhost/Team/issues/648 All sites will include a default Free "Product" which is used for free memberships. This change adds UI for handling free membership settings. Also - - Updates product icons in list and responsive sizes - Copy updates --- .../components/gh-member-settings-form-cp.hbs | 139 +++++++++--------- .../modal-free-membership-settings.hbs | 61 ++++++++ .../modal-free-membership-settings.js | 24 +++ .../app/components/modal-product-price.hbs | 12 -- .../app/controllers/settings/products.js | 28 ++++ ghost/admin/app/styles/layouts/members.css | 21 ++- ghost/admin/app/styles/layouts/products.css | 67 +++++++-- .../admin/app/templates/settings/products.hbs | 63 ++++---- 8 files changed, 291 insertions(+), 124 deletions(-) create mode 100644 ghost/admin/app/components/modal-free-membership-settings.hbs create mode 100644 ghost/admin/app/components/modal-free-membership-settings.js diff --git a/ghost/admin/app/components/gh-member-settings-form-cp.hbs b/ghost/admin/app/components/gh-member-settings-form-cp.hbs index 58ba76c13e..50db81002e 100644 --- a/ghost/admin/app/components/gh-member-settings-form-cp.hbs +++ b/ghost/admin/app/components/gh-member-settings-form-cp.hbs @@ -150,81 +150,74 @@ {{/if}}

Products

-
-
    -
  1. -
    -
  2. - {{#unless this.products}} -
  3. -
    -
    This member doesn't have any products.
    - {{#unless this.member.isNew}} - - {{/unless}} -
    -
  4. - {{/unless}} - {{#each this.products as |product|}} -
  5. -
    -

    - {{product.name}} -

    - {{#each product.subscriptions as |sub|}} -
    - - -
    - Created on {{sub.startDate}} -
    - - View on Stripe - - - {{#if sub.cancel_at_period_end}} - - {{else}} - - {{/if}} -
    -
    -
    - {{/each}} -
    -
  6. - {{/each}} - {{#if this.products}} - - - - - - {{/if}} -
+ {{#unless this.products}} +
+
+
This member doesn't have any products.
+ {{#unless this.member.isNew}} + + {{/unless}} +
+ {{/unless}} + + {{#each this.products as |product|}} +
+
+

+ {{product.name}} +

+ {{#each product.subscriptions as |sub|}} +
+
+ {{sub.price.nickname}} + – + {{sub.price.currencySymbol}}{{sub.price.nonDecimalAmount}}/{{sub.price.interval}} + – + {{#if sub.cancel_at_period_end}} + Cancels {{sub.validUntil}} + Cancelled + {{else}} + Renews {{sub.validUntil}} + Active + {{/if}} +
+
Created on {{sub.startDate}}
+ + + + + {{svg-jar "dotdotdot"}} + + + + +
  • + + View on Stripe + +
  • +
  • + {{#if sub.cancel_at_period_end}} + + {{else}} + + {{/if}} +
  • +
    +
    +
    + {{/each}} +
    +
    + {{/each}}
    diff --git a/ghost/admin/app/components/modal-free-membership-settings.hbs b/ghost/admin/app/components/modal-free-membership-settings.hbs new file mode 100644 index 0000000000..abed56159e --- /dev/null +++ b/ghost/admin/app/components/modal-free-membership-settings.hbs @@ -0,0 +1,61 @@ + + + +
    + +
    + + \ No newline at end of file diff --git a/ghost/admin/app/components/modal-free-membership-settings.js b/ghost/admin/app/components/modal-free-membership-settings.js new file mode 100644 index 0000000000..3836215b32 --- /dev/null +++ b/ghost/admin/app/components/modal-free-membership-settings.js @@ -0,0 +1,24 @@ +import ModalBase from 'ghost-admin/components/modal-base'; +import classic from 'ember-classic-decorator'; +import {action} from '@ember/object'; + +// TODO: update modals to work fully with Glimmer components +@classic +export default class ModalFreeMembershipSettings extends ModalBase { + init() { + super.init(...arguments); + } + + @action + close(event) { + event?.preventDefault?.(); + this.closeModal(); + } + + actions = { + // needed because ModalBase uses .send() for keyboard events + closeModal() { + this.close(); + } + } +} diff --git a/ghost/admin/app/components/modal-product-price.hbs b/ghost/admin/app/components/modal-product-price.hbs index 2bc67bdef2..d83d875875 100644 --- a/ghost/admin/app/components/modal-product-price.hbs +++ b/ghost/admin/app/components/modal-product-price.hbs @@ -71,18 +71,6 @@

    Advanced

    - {{!-- - -
    - - days -
    - -
    --}}
    -
    -
      -
    1. -
      -
      -
    2. - {{#each this.products as |product|}} -
    3. - -

      - {{product.name}} -

      -

      - Product description -

      -
      +
      +
      + {{svg-jar "members"}} +

      + Free membership +

      +

      + Product description +

      + + Customize + +
      - -
      - {{!-- 330 members --}} - {{svg-jar "arrow-right" class="w6 h6 fill-midgrey pa1"}} -
      -
      -
    4. - {{/each}} -
    -
    + {{#each this.products as |product|}} +
    +
    +

    + {{product.name}} +

    +

    + Product description +

    + + Customize + +
    + {{/each}} +
    - \ No newline at end of file + + +{{#if this.showFreeMembershipModal}} + +{{/if}}