Merge branch 'main' into admin-billing

This commit is contained in:
Faizaan Gagan 2022-06-14 12:12:47 +05:30
commit c9cb338f9b
No known key found for this signature in database
GPG Key ID: 38AF5B87CC79B1BE
22 changed files with 807 additions and 407 deletions

View File

@ -50,7 +50,7 @@ jobs:
- name: Ember template lint - name: Ember template lint
if: ${{ always() }} if: ${{ always() }}
run: yarn ember-template-lint assets/javascripts run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts
- name: Rubocop - name: Rubocop
if: ${{ always() }} if: ${{ always() }}

View File

@ -8,31 +8,30 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
ast (2.4.2) ast (2.4.2)
parallel (1.20.1) parallel (1.22.1)
parser (3.0.1.1) parser (3.1.2.0)
ast (~> 2.4.1) ast (~> 2.4.1)
rainbow (3.0.0) rainbow (3.1.1)
regexp_parser (2.1.1) regexp_parser (2.5.0)
rexml (3.2.5) rexml (3.2.5)
rubocop (1.18.2) rubocop (1.30.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.0.0.0) parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.7.0, < 2.0) rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.7.0) rubocop-ast (1.18.0)
parser (>= 3.0.1.1) parser (>= 3.1.1.0)
rubocop-discourse (2.4.2) rubocop-discourse (2.5.0)
rubocop (>= 1.1.0) rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0) rubocop-rspec (>= 2.0.0)
rubocop-rspec (2.4.0) rubocop-rspec (2.11.1)
rubocop (~> 1.0) rubocop (~> 1.19)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)
unicode-display_width (2.0.0) unicode-display_width (2.1.0)
PLATFORMS PLATFORMS
ruby ruby

View File

@ -1,6 +1,12 @@
{{#if model.unconfigured}} {{#if model.unconfigured}}
<p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p> <p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p>
<p><a href="https://meta.discourse.org/t/discourse-subscriptions/140818/">{{i18n "discourse_subscriptions.admin.on_meta"}}</a></p> <p>
<a
href="https://meta.discourse.org/t/discourse-subscriptions/140818/"
>
{{i18n "discourse_subscriptions.admin.on_meta"}}
</a>
</p>
{{else}} {{else}}
{{#if model}} {{#if model}}
<table class="table discourse-patrons-table"> <table class="table discourse-patrons-table">
@ -17,7 +23,13 @@
<td>{{coupon.code}}</td> <td>{{coupon.code}}</td>
<td>{{coupon.discount}}</td> <td>{{coupon.discount}}</td>
<td>{{coupon.times_redeemed}}</td> <td>{{coupon.times_redeemed}}</td>
<td>{{input type="checkbox" checked=coupon.active click=(action "toggleActive" coupon)}}</td> <td>
{{input
type="checkbox"
checked=coupon.active
click=(action "toggleActive" coupon)
}}
</td>
<td> <td>
{{d-button {{d-button
action=(action "deleteCoupon") action=(action "deleteCoupon")
@ -43,6 +55,9 @@
{{/unless}} {{/unless}}
{{#if creating}} {{#if creating}}
{{create-coupon-form cancel=(action "closeCreateForm") create=(action "createNewCoupon")}} {{create-coupon-form
cancel=(action "closeCreateForm")
create=(action "createNewCoupon")
}}
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -5,11 +5,33 @@
<table class="table discourse-patrons-table"> <table class="table discourse-patrons-table">
<thead> <thead>
<tr> <tr>
<th>{{i18n "discourse_subscriptions.admin.dashboard.table.head.user"}}</th> <th>
<th>{{i18n "discourse_subscriptions.admin.dashboard.table.head.payment_intent"}}</th> {{i18n "discourse_subscriptions.admin.dashboard.table.head.user"}}
<th>{{i18n "discourse_subscriptions.admin.dashboard.table.head.receipt_email"}}</th> </th>
<th role="button" onclick={{action "orderPayments" "created_at"}} class="sortable">{{i18n "created"}}</th> <th>
<th role="button" onclick={{action "orderPayments" "amount"}} class="sortable amount">{{i18n "discourse_subscriptions.admin.dashboard.table.head.amount"}}</th> {{i18n
"discourse_subscriptions.admin.dashboard.table.head.payment_intent"
}}
</th>
<th>
{{i18n
"discourse_subscriptions.admin.dashboard.table.head.receipt_email"
}}
</th>
<th
role="button"
onclick={{action "orderPayments" "created_at"}}
class="sortable"
>
{{i18n "created"}}
</th>
<th
role="button"
onclick={{action "orderPayments" "amount"}}
class="sortable amount"
>
{{i18n "discourse_subscriptions.admin.dashboard.table.head.amount"}}
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -1,23 +1,42 @@
{{#if model.unconfigured }} {{#if model.unconfigured}}
<p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p> <p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p>
<p><a href="https://meta.discourse.org/t/discourse-subscriptions/140818/">{{i18n "discourse_subscriptions.admin.on_meta"}}</a></p> <p>
<a href="https://meta.discourse.org/t/discourse-subscriptions/140818/">
{{i18n "discourse_subscriptions.admin.on_meta"}}
</a>
</p>
{{else}} {{else}}
<p class="btn-right"> <p class="btn-right">
{{#link-to "adminPlugins.discourse-subscriptions.products.show" "new" class="btn btn-primary"}} {{#link-to
"adminPlugins.discourse-subscriptions.products.show"
"new"
class="btn btn-primary"
}}
{{d-icon "plus"}} {{d-icon "plus"}}
<span>{{i18n "discourse_subscriptions.admin.products.operations.new"}}</span> <span>
{{i18n "discourse_subscriptions.admin.products.operations.new"}}
</span>
{{/link-to}} {{/link-to}}
</p> </p>
{{#if model}} {{#if model}}
<table class="table discourse-patrons-table"> <table class="table discourse-patrons-table">
<thead> <thead>
<th>{{i18n "discourse_subscriptions.admin.products.product.name"}}</th> <th>
<th>{{i18n "discourse_subscriptions.admin.products.product.created_at"}}</th> {{i18n "discourse_subscriptions.admin.products.product.name"}}
<th>{{i18n "discourse_subscriptions.admin.products.product.updated_at"}}</th> </th>
<th class="td-right">{{i18n "discourse_subscriptions.admin.products.product.active"}}</th> <th>
{{i18n "discourse_subscriptions.admin.products.product.created_at"}}
</th>
<th>
{{i18n "discourse_subscriptions.admin.products.product.updated_at"}}
</th>
<th class="td-right">
{{i18n "discourse_subscriptions.admin.products.product.active"}}
</th>
<th></th> <th></th>
</thead> </thead>
<tbody> <tbody>
{{#each model as |product|}} {{#each model as |product|}}
<tr> <tr>
@ -27,9 +46,14 @@
<td class="td-right">{{product.active}}</td> <td class="td-right">{{product.active}}</td>
<td class="td-right"> <td class="td-right">
<div class="align-buttons"> <div class="align-buttons">
{{#link-to "adminPlugins.discourse-subscriptions.products.show" product.id class="btn no-text btn-icon"}} {{#link-to
"adminPlugins.discourse-subscriptions.products.show"
product.id
class="btn no-text btn-icon"
}}
{{d-icon "far-edit"}} {{d-icon "far-edit"}}
{{/link-to}} {{/link-to}}
{{d-button {{d-button
action=(route-action "destroyProduct") action=(route-action "destroyProduct")
actionParam=product actionParam=product

View File

@ -2,32 +2,58 @@
<form class="form-horizontal"> <form class="form-horizontal">
<p> <p>
<label for="product">{{i18n "discourse_subscriptions.admin.products.product.name"}}</label> <label for="product">
{{input type="text" name="product_name" value=model.product.name disabled=true}} {{i18n "discourse_subscriptions.admin.products.product.name"}}
</label>
{{input
type="text"
name="product_name"
value=model.product.name
disabled=true
}}
</p> </p>
<p> <p>
<label for="name">{{i18n "discourse_subscriptions.admin.plans.plan.nickname"}}</label> <label for="name">
{{i18n "discourse_subscriptions.admin.plans.plan.nickname"}}
</label>
{{input type="text" name="name" value=model.plan.nickname}} {{input type="text" name="name" value=model.plan.nickname}}
<div class="control-instructions"> <div class="control-instructions">
{{i18n "discourse_subscriptions.admin.plans.plan.nickname_help"}} {{i18n "discourse_subscriptions.admin.plans.plan.nickname_help"}}
</div> </div>
</p> </p>
<p> <p>
<label for="interval">{{i18n "discourse_subscriptions.admin.plans.plan.group"}}</label> <label for="interval">
{{i18n "discourse_subscriptions.admin.plans.plan.group"}}
</label>
{{combo-box {{combo-box
valueProperty="name" valueProperty="name"
content=availableGroups content=availableGroups
value=selectedGroup value=selectedGroup
onChange=(action (mut model.plan.metadata.group_name)) onChange=(action (mut model.plan.metadata.group_name))
}} }}
<div class="control-instructions"> <div class="control-instructions">
{{i18n "discourse_subscriptions.admin.plans.plan.group_help"}} {{i18n "discourse_subscriptions.admin.plans.plan.group_help"}}
</div> </div>
</p> </p>
<p> <p>
<label for="amount">{{i18n "discourse_subscriptions.admin.plans.plan.amount"}}</label> <label for="amount">
{{i18n "discourse_subscriptions.admin.plans.plan.amount"}}
</label>
{{#if planFieldDisabled}} {{#if planFieldDisabled}}
{{input class="plan-amount plan-currency" disabled=true value=model.plan.currency}} {{input
class="plan-amount plan-currency"
disabled=true
value=model.plan.currency
}}
{{else}} {{else}}
{{combo-box {{combo-box
disabled=planFieldDisabled disabled=planFieldDisabled
@ -36,12 +62,21 @@
onChange=(action (mut model.plan.currency)) onChange=(action (mut model.plan.currency))
}} }}
{{/if}} {{/if}}
{{input class="plan-amount" type="text" name="name" value=model.plan.amountDollars disabled=planFieldDisabled}}
{{input
class="plan-amount"
type="text"
name="name"
value=model.plan.amountDollars
disabled=planFieldDisabled
}}
</p> </p>
<p> <p>
<label for="recurring"> <label for="recurring">
{{i18n "discourse_subscriptions.admin.plans.plan.recurring"}} {{i18n "discourse_subscriptions.admin.plans.plan.recurring"}}
</label> </label>
{{#if planFieldDisabled}} {{#if planFieldDisabled}}
{{input {{input
type="checkbox" type="checkbox"
@ -58,11 +93,13 @@
}} }}
{{/if}} {{/if}}
</p> </p>
{{#if model.plan.isRecurring}} {{#if model.plan.isRecurring}}
<p> <p>
<label for="interval"> <label for="interval">
{{i18n "discourse_subscriptions.admin.plans.plan.interval"}} {{i18n "discourse_subscriptions.admin.plans.plan.interval"}}
</label> </label>
{{#if planFieldDisabled}} {{#if planFieldDisabled}}
{{input disabled=true value=selectedInterval}} {{input disabled=true value=selectedInterval}}
{{else}} {{else}}
@ -74,17 +111,21 @@
}} }}
{{/if}} {{/if}}
</p> </p>
<p> <p>
<label for="trial"> <label for="trial">
{{i18n "discourse_subscriptions.admin.plans.plan.trial"}} {{i18n "discourse_subscriptions.admin.plans.plan.trial"}}
({{i18n "discourse_subscriptions.optional"}}) ({{i18n "discourse_subscriptions.optional"}})
</label> </label>
{{input type="text" name="trial" value=model.plan.trial_period_days}} {{input type="text" name="trial" value=model.plan.trial_period_days}}
<div class="control-instructions"> <div class="control-instructions">
{{i18n "discourse_subscriptions.admin.plans.plan.trial_help"}} {{i18n "discourse_subscriptions.admin.plans.plan.trial_help"}}
</div> </div>
</p> </p>
{{/if}} {{/if}}
<p> <p>
<label for="active"> <label for="active">
{{i18n "discourse_subscriptions.admin.plans.plan.active"}} {{i18n "discourse_subscriptions.admin.plans.plan.active"}}

View File

@ -2,37 +2,71 @@
<form class="form-horizontal"> <form class="form-horizontal">
<p> <p>
<label for="name">{{i18n "discourse_subscriptions.admin.products.product.name"}}</label> <label for="name">
{{i18n "discourse_subscriptions.admin.products.product.name"}}
</label>
{{input type="text" name="name" value=model.product.name}} {{input type="text" name="name" value=model.product.name}}
</p> </p>
<p> <p>
<label for="description"> <label for="description">
{{i18n "discourse_subscriptions.admin.products.product.description"}} {{i18n "discourse_subscriptions.admin.products.product.description"}}
</label> </label>
{{textarea name="description" value=model.product.metadata.description class="discourse-subscriptions-admin-textarea"}}
{{textarea
name="description"
value=model.product.metadata.description
class="discourse-subscriptions-admin-textarea"
}}
<div class="control-instructions"> <div class="control-instructions">
{{i18n "discourse_subscriptions.admin.products.product.description_help"}} {{i18n "discourse_subscriptions.admin.products.product.description_help"}}
</div> </div>
</p> </p>
<p> <p>
<label for="statement_descriptor"> <label for="statement_descriptor">
{{i18n "discourse_subscriptions.admin.products.product.statement_descriptor"}} {{i18n
"discourse_subscriptions.admin.products.product.statement_descriptor"
}}
</label> </label>
{{input type="text" name="statement_descriptor" value=model.product.statement_descriptor}}
{{input
type="text"
name="statement_descriptor"
value=model.product.statement_descriptor
}}
<div class="control-instructions"> <div class="control-instructions">
{{i18n "discourse_subscriptions.admin.products.product.statement_descriptor_help"}} {{i18n
"discourse_subscriptions.admin.products.product.statement_descriptor_help"
}}
</div> </div>
</p> </p>
<p> <p>
<label for="repurchaseable">{{i18n "discourse_subscriptions.admin.products.product.repurchaseable"}}</label> <label for="repurchaseable">
{{input type="checkbox" name="repurchaseable" checked=model.product.metadata.repurchaseable}} {{i18n "discourse_subscriptions.admin.products.product.repurchaseable"}}
</label>
{{input
type="checkbox"
name="repurchaseable"
checked=model.product.metadata.repurchaseable
}}
<div class="control-instructions"> <div class="control-instructions">
{{i18n "discourse_subscriptions.admin.products.product.repurchase_help"}} {{i18n "discourse_subscriptions.admin.products.product.repurchase_help"}}
</div> </div>
</p> </p>
<p> <p>
<label for="active">{{i18n "discourse_subscriptions.admin.products.product.active"}}</label> <label for="active">
{{i18n "discourse_subscriptions.admin.products.product.active"}}
</label>
{{input type="checkbox" name="active" checked=model.product.active}} {{input type="checkbox" name="active" checked=model.product.active}}
<div class="control-instructions"> <div class="control-instructions">
{{i18n "discourse_subscriptions.admin.products.product.active_help"}} {{i18n "discourse_subscriptions.admin.products.product.active_help"}}
</div> </div>
@ -50,13 +84,21 @@
<th>{{i18n "discourse_subscriptions.admin.plans.plan.created_at"}}</th> <th>{{i18n "discourse_subscriptions.admin.plans.plan.created_at"}}</th>
<th>{{i18n "discourse_subscriptions.admin.plans.plan.group"}}</th> <th>{{i18n "discourse_subscriptions.admin.plans.plan.group"}}</th>
<th>{{i18n "discourse_subscriptions.admin.plans.plan.active"}}</th> <th>{{i18n "discourse_subscriptions.admin.plans.plan.active"}}</th>
<th class="td-right">{{i18n "discourse_subscriptions.admin.plans.plan.amount"}}</th>
<th class="td-right"> <th class="td-right">
{{#link-to "adminPlugins.discourse-subscriptions.products.show.plans.show" model.product.id "new" class="btn"}} {{i18n "discourse_subscriptions.admin.plans.plan.amount"}}
</th>
<th class="td-right">
{{#link-to
"adminPlugins.discourse-subscriptions.products.show.plans.show"
model.product.id
"new"
class="btn"
}}
{{i18n "discourse_subscriptions.admin.plans.operations.add"}} {{i18n "discourse_subscriptions.admin.plans.operations.add"}}
{{/link-to}} {{/link-to}}
</th> </th>
</thead> </thead>
<tbody> <tbody>
{{#each model.plans as |plan|}} {{#each model.plans as |plan|}}
<tr> <tr>
@ -65,9 +107,16 @@
<td>{{format-unix-date plan.created}}</td> <td>{{format-unix-date plan.created}}</td>
<td>{{plan.metadata.group_name}}</td> <td>{{plan.metadata.group_name}}</td>
<td>{{plan.active}}</td> <td>{{plan.active}}</td>
<td class="td-right">{{format-currency plan.currency plan.amountDollars}}</td>
<td class="td-right"> <td class="td-right">
{{#link-to "adminPlugins.discourse-subscriptions.products.show.plans.show" model.product.id plan.id class="btn no-text btn-icon"}} {{format-currency plan.currency plan.amountDollars}}
</td>
<td class="td-right">
{{#link-to
"adminPlugins.discourse-subscriptions.products.show.plans.show"
model.product.id
plan.id
class="btn no-text btn-icon"
}}
{{d-icon "far-edit"}} {{d-icon "far-edit"}}
{{/link-to}} {{/link-to}}
</td> </td>
@ -76,7 +125,9 @@
<tr> <tr>
<td colspan="8"> <td colspan="8">
<hr> <hr>
{{i18n "discourse_subscriptions.admin.products.product.plan_help"}} {{i18n
"discourse_subscriptions.admin.products.product.plan_help"
}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}

View File

@ -1,21 +1,57 @@
{{#if model.unconfigured}} {{#if model.unconfigured}}
<p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p> <p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p>
<p><a href="https://meta.discourse.org/t/discourse-subscriptions/140818/">{{i18n "discourse_subscriptions.admin.on_meta"}}</a></p> <p>
<a href="https://meta.discourse.org/t/discourse-subscriptions/140818/">
{{i18n "discourse_subscriptions.admin.on_meta"}}
</a>
</p>
{{else}} {{else}}
{{#load-more selector=".discourse-patrons-table tr" action=(action "loadMore")}} {{#load-more
selector=".discourse-patrons-table tr"
action=(action "loadMore")
}}
<table class="table discourse-patrons-table"> <table class="table discourse-patrons-table">
<thead> <thead>
<tr> <tr>
<th>{{i18n "discourse_subscriptions.admin.subscriptions.subscription.user"}}</th> <th>
<th>{{i18n "discourse_subscriptions.admin.subscriptions.subscription.subscription_id"}}</th> {{i18n
<th>{{i18n "discourse_subscriptions.admin.subscriptions.subscription.customer"}}</th> "discourse_subscriptions.admin.subscriptions.subscription.user"
<th>{{i18n "discourse_subscriptions.admin.subscriptions.subscription.product"}}</th> }}
<th>{{i18n "discourse_subscriptions.admin.subscriptions.subscription.plan"}}</th> </th>
<th>{{i18n "discourse_subscriptions.admin.subscriptions.subscription.status"}}</th> <th>
<th class="td-right">{{i18n "discourse_subscriptions.admin.subscriptions.subscription.created_at"}}</th> {{i18n
"discourse_subscriptions.admin.subscriptions.subscription.subscription_id"
}}
</th>
<th>
{{i18n
"discourse_subscriptions.admin.subscriptions.subscription.customer"
}}
</th>
<th>
{{i18n
"discourse_subscriptions.admin.subscriptions.subscription.product"
}}
</th>
<th>
{{i18n
"discourse_subscriptions.admin.subscriptions.subscription.plan"
}}
</th>
<th>
{{i18n
"discourse_subscriptions.admin.subscriptions.subscription.status"
}}
</th>
<th class="td-right">
{{i18n
"discourse_subscriptions.admin.subscriptions.subscription.created_at"
}}
</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each model.data as |subscription|}} {{#each model.data as |subscription|}}
<tr> <tr>

View File

@ -21,9 +21,18 @@
</div> </div>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
{{nav-item route="adminPlugins.discourse-subscriptions.products" label="discourse_subscriptions.admin.products.title"}} {{nav-item
{{nav-item route="adminPlugins.discourse-subscriptions.coupons" label="discourse_subscriptions.admin.coupons.title"}} route="adminPlugins.discourse-subscriptions.products"
{{nav-item route="adminPlugins.discourse-subscriptions.subscriptions" label="discourse_subscriptions.admin.subscriptions.title"}} label="discourse_subscriptions.admin.products.title"
}}
{{nav-item
route="adminPlugins.discourse-subscriptions.coupons"
label="discourse_subscriptions.admin.coupons.title"
}}
{{nav-item
route="adminPlugins.discourse-subscriptions.subscriptions"
label="discourse_subscriptions.admin.subscriptions.title"
}}
</ul> </ul>
<hr> <hr>
@ -33,5 +42,9 @@
</div> </div>
{{else}} {{else}}
<p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p> <p>{{i18n "discourse_subscriptions.admin.unconfigured"}}</p>
<p><a href="https://meta.discourse.org/t/discourse-subscriptions/140818/">{{i18n "discourse_subscriptions.admin.on_meta"}}</a></p> <p>
<a href="https://meta.discourse.org/t/discourse-subscriptions/140818/">
{{i18n "discourse_subscriptions.admin.on_meta"}}
</a>
</p>
{{/if}} {{/if}}

View File

@ -1,25 +1,47 @@
{{#if shouldShow}} {{#if shouldShow}}
<div class="campaign-banner" style={{html-safe (concat "box-shadow: 5px 5px #" dropShadowColor)}}> <div
{{d-button class="campaign-banner"
icon="times" style={{html-safe (concat "box-shadow: 5px 5px #" dropShadowColor)}}
action="dismissBanner" >
class="close" {{d-button icon="times" action="dismissBanner" class="close"}}
}}
<div class="campaign-banner-info" style={{html-safe this.bannerInfoStyle}}> <div class="campaign-banner-info" style={{html-safe this.bannerInfoStyle}}>
{{#if isGoalMet}} {{#if isGoalMet}}
<h2 class="campaign-banner-info-header">{{i18n "discourse_subscriptions.campaign.success_title"}}</h2> <h2 class="campaign-banner-info-header">
<p class="campaign-banner-info-description">{{i18n "discourse_subscriptions.campaign.success_body"}}</p> {{i18n "discourse_subscriptions.campaign.success_title"}}
</h2>
<p class="campaign-banner-info-description">
{{i18n "discourse_subscriptions.campaign.success_body"}}
</p>
{{else}} {{else}}
<h2 class="campaign-banner-info-header">{{i18n "discourse_subscriptions.campaign.title"}}</h2> <h2 class="campaign-banner-info-header">
<p class="campaign-banner-info-description">{{i18n "discourse_subscriptions.campaign.body"}}</p> {{i18n "discourse_subscriptions.campaign.title"}}
</h2>
<p class="campaign-banner-info-description">
{{i18n "discourse_subscriptions.campaign.body"}}
</p>
{{#if product}} {{#if product}}
{{#link-to "subscribe.show" product disabled=product.subscribed class="btn btn-primary campaign-banner-info-button"}} {{#link-to
{{d-icon "far-heart"}} {{d-icon "heart" class="hover-heart"}} {{i18n "discourse_subscriptions.campaign.button"}} "subscribe.show"
product
disabled=product.subscribed
class="btn btn-primary campaign-banner-info-button"
}}
{{d-icon "far-heart"}}
{{d-icon "heart" class="hover-heart"}}
{{i18n "discourse_subscriptions.campaign.button"}}
{{/link-to}} {{/link-to}}
{{else}} {{else}}
{{#link-to "subscribe" class="btn btn-primary campaign-banner-info-button"}} {{#link-to
{{d-icon "far-heart"}} {{d-icon "heart" class="hover-heart"}} {{i18n "discourse_subscriptions.campaign.button"}} "subscribe"
class="btn btn-primary campaign-banner-info-button"
}}
{{d-icon "far-heart"}}
{{d-icon "heart" class="hover-heart"}}
{{i18n "discourse_subscriptions.campaign.button"}}
{{/link-to}} {{/link-to}}
{{/if}} {{/if}}
{{/if}} {{/if}}
@ -36,24 +58,47 @@
{{#if subscriberGoal}} {{#if subscriberGoal}}
<p class="campaign-banner-progress-description"> <p class="campaign-banner-progress-description">
{{html-safe (i18n "discourse_subscriptions.campaign.goal_comparison" current=subscribers goal=goalTarget)}} {{html-safe
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=subscribers
goal=goalTarget
)
}}
{{i18n "discourse_subscriptions.campaign.subscribers"}} {{i18n "discourse_subscriptions.campaign.subscribers"}}
</p> </p>
{{else}} {{else}}
<p class="campaign-banner-progress-description"> <p class="campaign-banner-progress-description">
{{html-safe (i18n "discourse_subscriptions.campaign.goal_comparison" current=(format-currency currency amountRaised) goal=(format-currency currency goalTarget))}} {{html-safe
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=(format-currency currency amountRaised)
goal=(format-currency currency goalTarget)
)
}}
{{i18n "discourse_subscriptions.campaign.raised"}} {{i18n "discourse_subscriptions.campaign.raised"}}
</p> </p>
{{#if showContributors}} {{#if showContributors}}
{{#conditional-loading-spinner condition=loading size="small"}} {{#conditional-loading-spinner condition=loading size="small"}}
<div class="campaign-banner-progress-users"> <div class="campaign-banner-progress-users">
<p class="campaign-banner-progress-users-title"> <p class="campaign-banner-progress-users-title">
<strong>{{i18n "discourse_subscriptions.campaign.recent_contributors"}}</strong> <strong>
{{i18n
"discourse_subscriptions.campaign.recent_contributors"
}}
</strong>
</p> </p>
<div class="campaign-banner-progress-users-avatars"> <div class="campaign-banner-progress-users-avatars">
{{#each contributors as |contributor|}} {{#each contributors as |contributor|}}
{{avatar contributor avatarTemplatePath="avatar_template" usernamePath="username" namePath="name" imageSize="small"}} {{avatar
contributor
avatarTemplatePath="avatar_template"
usernamePath="username"
namePath="name"
imageSize="small"
}}
{{/each}} {{/each}}
</div> </div>
</div> </div>
@ -62,15 +107,37 @@
{{/if}} {{/if}}
{{else}} {{else}}
{{#if subscriberGoal}} {{#if subscriberGoal}}
<progress class="campaign-banner-progress-bar" value={{subscribers}} max={{siteSettings.discourse_subscriptions_campaign_goal}}/> <progress
class="campaign-banner-progress-bar"
value={{subscribers}}
max={{siteSettings.discourse_subscriptions_campaign_goal}}
></progress>
<p class="campaign-banner-progress-description"> <p class="campaign-banner-progress-description">
{{html-safe (i18n "discourse_subscriptions.campaign.goal_comparison" current=subscribers goal=goalTarget)}} {{html-safe
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=subscribers
goal=goalTarget
)
}}
{{i18n "discourse_subscriptions.campaign.subscribers"}} {{i18n "discourse_subscriptions.campaign.subscribers"}}
</p> </p>
{{else}} {{else}}
<progress class="campaign-banner-progress-bar" value={{amountRaised}} max={{siteSettings.discourse_subscriptions_campaign_goal}}/> <progress
class="campaign-banner-progress-bar"
value={{amountRaised}}
max={{siteSettings.discourse_subscriptions_campaign_goal}}
></progress>
<p class="campaign-banner-progress-description"> <p class="campaign-banner-progress-description">
{{html-safe (i18n "discourse_subscriptions.campaign.goal_comparison" current=(format-currency currency amountRaised) goal=(format-currency currency goalTarget))}} {{html-safe
(i18n
"discourse_subscriptions.campaign.goal_comparison"
current=(format-currency currency amountRaised)
goal=(format-currency currency goalTarget)
)
}}
{{i18n "discourse_subscriptions.campaign.raised"}} {{i18n "discourse_subscriptions.campaign.raised"}}
</p> </p>
{{/if}} {{/if}}
@ -79,11 +146,22 @@
{{#conditional-loading-spinner condition=loading size="small"}} {{#conditional-loading-spinner condition=loading size="small"}}
<div class="campaign-banner-progress-users"> <div class="campaign-banner-progress-users">
<p class="campaign-banner-progress-users-title"> <p class="campaign-banner-progress-users-title">
<strong>{{i18n "discourse_subscriptions.campaign.recent_contributors"}}</strong> <strong>
{{i18n
"discourse_subscriptions.campaign.recent_contributors"
}}
</strong>
</p> </p>
<div class="campaign-banner-progress-users-avatars"> <div class="campaign-banner-progress-users-avatars">
{{#each contributors as |contributor|}} {{#each contributors as |contributor|}}
{{avatar contributor avatarTemplatePath="avatar_template" usernamePath="username" namePath="name" imageSize="small"}} {{avatar
contributor
avatarTemplatePath="avatar_template"
usernamePath="username"
namePath="name"
imageSize="small"
}}
{{/each}} {{/each}}
</div> </div>
</div> </div>

View File

@ -1,11 +1,16 @@
<div class="create-coupon-form"> <div class="create-coupon-form">
<form class="form-horizontal"> <form class="form-horizontal">
<p> <p>
<label for="promo_code">{{i18n "discourse_subscriptions.admin.coupons.promo_code"}}</label> <label for="promo_code">
{{i18n "discourse_subscriptions.admin.coupons.promo_code"}}
</label>
{{input type="text" name="promo_code" value=promoCode}} {{input type="text" name="promo_code" value=promoCode}}
</p> </p>
<p> <p>
<label for="amount">{{i18n "discourse_subscriptions.admin.coupons.discount"}}</label> <label for="amount">
{{i18n "discourse_subscriptions.admin.coupons.discount"}}
</label>
{{combo-box {{combo-box
content=discountTypes content=discountTypes
value=discountType value=discountType
@ -13,6 +18,7 @@
}} }}
{{input class="discount-amount" type="text" name="amount" value=discount}} {{input class="discount-amount" type="text" name="amount" value=discount}}
</p> </p>
<p> <p>
<label for="active"> <label for="active">
{{i18n "discourse_subscriptions.admin.coupons.active"}} {{i18n "discourse_subscriptions.admin.coupons.active"}}
@ -26,11 +32,14 @@
label="discourse_subscriptions.admin.coupons.create" label="discourse_subscriptions.admin.coupons.create"
title="discourse_subscriptions.admin.coupons.create" title="discourse_subscriptions.admin.coupons.create"
icon="plus" icon="plus"
class="btn-primary btn btn-icon"}} class="btn-primary btn btn-icon"
}}
{{d-button {{d-button
action=(action "cancelCreate") action=(action "cancelCreate")
label="cancel" label="cancel"
title="cancel" title="cancel"
icon="times" icon="times"
class="btn btn-icon"}} class="btn btn-icon"
}}
</div> </div>

View File

@ -1,2 +1,8 @@
<h3>{{i18n "discourse_subscriptions.subscribe.unauthenticated"}}</h3> <h3>{{i18n "discourse_subscriptions.subscribe.unauthenticated"}}</h3>
{{d-button label="log_in" action="createAccount" icon="user" class="btn btn-primary"}}
{{d-button
label="log_in"
action="createAccount"
icon="user"
class="btn btn-primary"
}}

View File

@ -4,6 +4,10 @@
<div class="subscribe-buttons"> <div class="subscribe-buttons">
{{#each orderedPlans as |plan|}} {{#each orderedPlans as |plan|}}
{{payment-plan plan=plan selectedPlan=selectedPlan clickPlan=(action "clickPlan")}} {{payment-plan
plan=plan
selectedPlan=selectedPlan
clickPlan=(action "clickPlan")
}}
{{/each}} {{/each}}
</div> </div>

View File

@ -5,11 +5,17 @@
}} }}
<div class="interval"> <div class="interval">
{{#if recurringPlan}} {{#if recurringPlan}}
{{i18n (concat "discourse_subscriptions.plans.interval.adverb." plan.recurring.interval)}} {{i18n
(concat
"discourse_subscriptions.plans.interval.adverb."
plan.recurring.interval
)
}}
{{else}} {{else}}
{{i18n "discourse_subscriptions.one_time_payment"}} {{i18n "discourse_subscriptions.one_time_payment"}}
{{/if}} {{/if}}
</div> </div>
<span class="amount"> <span class="amount">
{{format-currency plan.currency plan.amountDollars}} {{format-currency plan.currency plan.amountDollars}}
</span> </span>

View File

@ -10,19 +10,37 @@
{{#link-to "subscribe.show" product.id class="btn btn-primary"}} {{#link-to "subscribe.show" product.id class="btn btn-primary"}}
{{i18n "discourse_subscriptions.subscribe.title"}} {{i18n "discourse_subscriptions.subscribe.title"}}
{{/link-to}} {{/link-to}}
{{#if product.subscribed}} {{#if product.subscribed}}
{{#link-to "user.billing.subscriptions" currentUser.username class="billing-link"}} {{#link-to
"user.billing.subscriptions"
currentUser.username
class="billing-link"
}}
{{i18n "discourse_subscriptions.subscribe.view_past"}} {{i18n "discourse_subscriptions.subscribe.view_past"}}
{{/link-to}} {{/link-to}}
{{/if}} {{/if}}
{{else}} {{else}}
{{#if product.subscribed}} {{#if product.subscribed}}
<span class="purchased">&#x2713; {{i18n "discourse_subscriptions.subscribe.purchased"}}</span> <span class="purchased">
{{#link-to "user.billing.subscriptions" currentUser.username class="billing-link"}} &#x2713;
{{i18n "discourse_subscriptions.subscribe.purchased"}}
</span>
{{#link-to
"user.billing.subscriptions"
currentUser.username
class="billing-link"
}}
{{i18n "discourse_subscriptions.subscribe.go_to_billing"}} {{i18n "discourse_subscriptions.subscribe.go_to_billing"}}
{{/link-to}} {{/link-to}}
{{else}} {{else}}
{{#link-to "subscribe.show" product.id disabled=product.subscribed class="btn btn-primary"}} {{#link-to
"subscribe.show"
product.id
disabled=product.subscribed
class="btn btn-primary"
}}
{{i18n "discourse_subscriptions.subscribe.title"}} {{i18n "discourse_subscriptions.subscribe.title"}}
{{/link-to}} {{/link-to}}
{{/if}} {{/if}}

View File

@ -1,3 +1,6 @@
{{#if (user-viewing-self model)}} {{#if (user-viewing-self model)}}
{{#link-to "user.billing"}}{{d-icon "far-credit-card"}}{{I18n "discourse_subscriptions.navigation.billing"}}{{/link-to}} {{#link-to "user.billing"}}
{{d-icon "far-credit-card"}}
{{i18n "discourse_subscriptions.navigation.billing"}}
{{/link-to}}
{{/if}} {{/if}}

View File

@ -1,5 +1,9 @@
<div> <div>
{{#d-modal-body rawTitle=(i18n "discourse_subscriptions.user.subscriptions.operations.destroy.confirm")}} {{#d-modal-body
rawTitle=(i18n
"discourse_subscriptions.user.subscriptions.operations.destroy.confirm"
)
}}
{{input type="checkbox" checked=refund}} {{input type="checkbox" checked=refund}}
{{i18n "discourse_subscriptions.admin.ask_refund"}} {{i18n "discourse_subscriptions.admin.ask_refund"}}
{{/d-modal-body}} {{/d-modal-body}}
@ -10,7 +14,9 @@
{{else}} {{else}}
{{d-button {{d-button
label="yes_value" label="yes_value"
action=(route-action "cancelSubscription" (hash subscription=model refund=refund)) action=(route-action
"cancelSubscription" (hash subscription=model refund=refund)
)
icon="times" icon="times"
class="btn-danger" class="btn-danger"
}} }}

View File

@ -10,6 +10,7 @@
{{html-safe model.product.description}} {{html-safe model.product.description}}
</p> </p>
</div> </div>
<div class="section-column"> <div class="section-column">
{{#if canPurchase}} {{#if canPurchase}}
<h2> <h2>
@ -18,10 +19,7 @@
<hr> <hr>
{{payment-options {{payment-options plans=model.plans selectedPlan=selectedPlan}}
plans=model.plans
selectedPlan=selectedPlan
}}
<hr> <hr>
@ -33,7 +31,12 @@
{{login-required}} {{login-required}}
{{else}} {{else}}
<div class="promo-code"> <div class="promo-code">
{{input type="text" name="promo_code" placeholderKey="discourse_subscriptions.subscribe.promo_code" value=promoCode}} {{input
type="text"
name="promo_code"
placeholderKey="discourse_subscriptions.subscribe.promo_code"
value=promoCode
}}
</div> </div>
{{d-button {{d-button
@ -46,7 +49,11 @@
{{else}} {{else}}
<h2>{{i18n "discourse_subscriptions.subscribe.already_purchased"}}</h2> <h2>{{i18n "discourse_subscriptions.subscribe.already_purchased"}}</h2>
{{#link-to "user.billing.subscriptions" currentUser.username class="btn btn-primary"}} {{#link-to
"user.billing.subscriptions"
currentUser.username
class="btn btn-primary"
}}
{{i18n "discourse_subscriptions.subscribe.go_to_billing"}} {{i18n "discourse_subscriptions.subscribe.go_to_billing"}}
{{/link-to}} {{/link-to}}
{{/if}} {{/if}}

View File

@ -1,4 +1,8 @@
{{#d-section pageClass="user-billing" class="user-secondary-navigation" scrollTop="false"}} {{#d-section
pageClass="user-billing"
class="user-secondary-navigation"
scrollTop="false"
}}
{{#mobile-nav {{#mobile-nav
class="activity-nav" class="activity-nav"
desktopClass="action-list nav-stacked" desktopClass="action-list nav-stacked"

View File

@ -25,9 +25,17 @@
{{loading-spinner size="small"}} {{loading-spinner size="small"}}
{{else}} {{else}}
{{#if subscription.canceled_at}} {{#if subscription.canceled_at}}
{{d-button disabled=subscription.canceled_at label="discourse_subscriptions.user.subscriptions.cancelled"}} {{d-button
disabled=subscription.canceled_at
label="discourse_subscriptions.user.subscriptions.cancelled"
}}
{{else}} {{else}}
{{d-button disabled=subscription.canceled_at label="discourse_subscriptions.user.subscriptions.cancel" action=(route-action "cancelSubscription" subscription) icon="times"}} {{d-button
disabled=subscription.canceled_at
label="discourse_subscriptions.user.subscriptions.cancel"
action=(route-action "cancelSubscription" subscription)
icon="times"
}}
{{/if}} {{/if}}
{{/if}} {{/if}}
</td> </td>

View File

@ -1,10 +1,10 @@
{ {
"name": "discourse-subscriptions", "name": "discourse-subscriptions",
"version": "1.0.0", "version": "1.0.0",
"repository": "git@github.com:discourse/discourse-subscriptions.git", "repository": "https://github.com/discourse/discourse-subscriptions",
"author": "Discourse", "author": "Discourse",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"eslint-config-discourse": "^3.0.0" "eslint-config-discourse": "^3.1.0"
} }
} }

634
yarn.lock

File diff suppressed because it is too large Load Diff