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
if: ${{ always() }}
run: yarn ember-template-lint assets/javascripts
run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts
- name: Rubocop
if: ${{ always() }}

View File

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

View File

@ -1,6 +1,12 @@
{{#if model.unconfigured}}
<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}}
{{#if model}}
<table class="table discourse-patrons-table">
@ -17,7 +23,13 @@
<td>{{coupon.code}}</td>
<td>{{coupon.discount}}</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>
{{d-button
action=(action "deleteCoupon")
@ -43,6 +55,9 @@
{{/unless}}
{{#if creating}}
{{create-coupon-form cancel=(action "closeCreateForm") create=(action "createNewCoupon")}}
{{create-coupon-form
cancel=(action "closeCreateForm")
create=(action "createNewCoupon")
}}
{{/if}}
{{/if}}

View File

@ -5,11 +5,33 @@
<table class="table discourse-patrons-table">
<thead>
<tr>
<th>{{i18n "discourse_subscriptions.admin.dashboard.table.head.user"}}</th>
<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>
<th>
{{i18n "discourse_subscriptions.admin.dashboard.table.head.user"}}
</th>
<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>
</thead>
<tbody>

View File

@ -1,23 +1,42 @@
{{#if model.unconfigured }}
{{#if model.unconfigured}}
<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}}
<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"}}
<span>{{i18n "discourse_subscriptions.admin.products.operations.new"}}</span>
<span>
{{i18n "discourse_subscriptions.admin.products.operations.new"}}
</span>
{{/link-to}}
</p>
{{#if model}}
<table class="table discourse-patrons-table">
<thead>
<th>{{i18n "discourse_subscriptions.admin.products.product.name"}}</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>
{{i18n "discourse_subscriptions.admin.products.product.name"}}
</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>
</thead>
<tbody>
{{#each model as |product|}}
<tr>
@ -27,9 +46,14 @@
<td class="td-right">{{product.active}}</td>
<td class="td-right">
<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"}}
{{/link-to}}
{{d-button
action=(route-action "destroyProduct")
actionParam=product

View File

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

View File

@ -2,37 +2,71 @@
<form class="form-horizontal">
<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}}
</p>
<p>
<label for="description">
{{i18n "discourse_subscriptions.admin.products.product.description"}}
</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">
{{i18n "discourse_subscriptions.admin.products.product.description_help"}}
</div>
</p>
<p>
<label for="statement_descriptor">
{{i18n "discourse_subscriptions.admin.products.product.statement_descriptor"}}
{{i18n
"discourse_subscriptions.admin.products.product.statement_descriptor"
}}
</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">
{{i18n "discourse_subscriptions.admin.products.product.statement_descriptor_help"}}
{{i18n
"discourse_subscriptions.admin.products.product.statement_descriptor_help"
}}
</div>
</p>
<p>
<label for="repurchaseable">{{i18n "discourse_subscriptions.admin.products.product.repurchaseable"}}</label>
{{input type="checkbox" name="repurchaseable" checked=model.product.metadata.repurchaseable}}
<label for="repurchaseable">
{{i18n "discourse_subscriptions.admin.products.product.repurchaseable"}}
</label>
{{input
type="checkbox"
name="repurchaseable"
checked=model.product.metadata.repurchaseable
}}
<div class="control-instructions">
{{i18n "discourse_subscriptions.admin.products.product.repurchase_help"}}
</div>
</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}}
<div class="control-instructions">
{{i18n "discourse_subscriptions.admin.products.product.active_help"}}
</div>
@ -50,13 +84,21 @@
<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.active"}}</th>
<th class="td-right">{{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.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"}}
{{/link-to}}
</th>
</thead>
<tbody>
{{#each model.plans as |plan|}}
<tr>
@ -65,9 +107,16 @@
<td>{{format-unix-date plan.created}}</td>
<td>{{plan.metadata.group_name}}</td>
<td>{{plan.active}}</td>
<td class="td-right">{{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"}}
{{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"}}
{{/link-to}}
</td>
@ -76,7 +125,9 @@
<tr>
<td colspan="8">
<hr>
{{i18n "discourse_subscriptions.admin.products.product.plan_help"}}
{{i18n
"discourse_subscriptions.admin.products.product.plan_help"
}}
</td>
</tr>
{{/each}}

View File

@ -1,21 +1,57 @@
{{#if model.unconfigured}}
<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}}
{{#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">
<thead>
<tr>
<th>{{i18n "discourse_subscriptions.admin.subscriptions.subscription.user"}}</th>
<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>
{{i18n
"discourse_subscriptions.admin.subscriptions.subscription.user"
}}
</th>
<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>
</tr>
</thead>
<tbody>
{{#each model.data as |subscription|}}
<tr>

View File

@ -21,9 +21,18 @@
</div>
<ul class="nav nav-pills">
{{nav-item route="adminPlugins.discourse-subscriptions.products" 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"}}
{{nav-item
route="adminPlugins.discourse-subscriptions.products"
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>
<hr>
@ -33,5 +42,9 @@
</div>
{{else}}
<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}}

View File

@ -1,25 +1,47 @@
{{#if shouldShow}}
<div class="campaign-banner" style={{html-safe (concat "box-shadow: 5px 5px #" dropShadowColor)}}>
{{d-button
icon="times"
action="dismissBanner"
class="close"
}}
<div
class="campaign-banner"
style={{html-safe (concat "box-shadow: 5px 5px #" dropShadowColor)}}
>
{{d-button icon="times" action="dismissBanner" class="close"}}
<div class="campaign-banner-info" style={{html-safe this.bannerInfoStyle}}>
{{#if isGoalMet}}
<h2 class="campaign-banner-info-header">{{i18n "discourse_subscriptions.campaign.success_title"}}</h2>
<p class="campaign-banner-info-description">{{i18n "discourse_subscriptions.campaign.success_body"}}</p>
<h2 class="campaign-banner-info-header">
{{i18n "discourse_subscriptions.campaign.success_title"}}
</h2>
<p class="campaign-banner-info-description">
{{i18n "discourse_subscriptions.campaign.success_body"}}
</p>
{{else}}
<h2 class="campaign-banner-info-header">{{i18n "discourse_subscriptions.campaign.title"}}</h2>
<p class="campaign-banner-info-description">{{i18n "discourse_subscriptions.campaign.body"}}</p>
<h2 class="campaign-banner-info-header">
{{i18n "discourse_subscriptions.campaign.title"}}
</h2>
<p class="campaign-banner-info-description">
{{i18n "discourse_subscriptions.campaign.body"}}
</p>
{{#if product}}
{{#link-to "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
"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}}
{{else}}
{{#link-to "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
"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}}
{{/if}}
{{/if}}
@ -36,24 +58,47 @@
{{#if subscriberGoal}}
<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"}}
</p>
{{else}}
<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"}}
</p>
{{#if showContributors}}
{{#conditional-loading-spinner condition=loading size="small"}}
<div class="campaign-banner-progress-users">
<p class="campaign-banner-progress-users-title">
<strong>{{i18n "discourse_subscriptions.campaign.recent_contributors"}}</strong>
<strong>
{{i18n
"discourse_subscriptions.campaign.recent_contributors"
}}
</strong>
</p>
<div class="campaign-banner-progress-users-avatars">
{{#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}}
</div>
</div>
@ -62,15 +107,37 @@
{{/if}}
{{else}}
{{#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">
{{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"}}
</p>
{{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">
{{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"}}
</p>
{{/if}}
@ -79,11 +146,22 @@
{{#conditional-loading-spinner condition=loading size="small"}}
<div class="campaign-banner-progress-users">
<p class="campaign-banner-progress-users-title">
<strong>{{i18n "discourse_subscriptions.campaign.recent_contributors"}}</strong>
<strong>
{{i18n
"discourse_subscriptions.campaign.recent_contributors"
}}
</strong>
</p>
<div class="campaign-banner-progress-users-avatars">
{{#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}}
</div>
</div>

View File

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

View File

@ -1,2 +1,8 @@
<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">
{{#each orderedPlans as |plan|}}
{{payment-plan plan=plan selectedPlan=selectedPlan clickPlan=(action "clickPlan")}}
{{payment-plan
plan=plan
selectedPlan=selectedPlan
clickPlan=(action "clickPlan")
}}
{{/each}}
</div>

View File

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

View File

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

View File

@ -1,3 +1,6 @@
{{#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}}

View File

@ -1,5 +1,9 @@
<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}}
{{i18n "discourse_subscriptions.admin.ask_refund"}}
{{/d-modal-body}}
@ -10,7 +14,9 @@
{{else}}
{{d-button
label="yes_value"
action=(route-action "cancelSubscription" (hash subscription=model refund=refund))
action=(route-action
"cancelSubscription" (hash subscription=model refund=refund)
)
icon="times"
class="btn-danger"
}}

View File

@ -10,6 +10,7 @@
{{html-safe model.product.description}}
</p>
</div>
<div class="section-column">
{{#if canPurchase}}
<h2>
@ -18,10 +19,7 @@
<hr>
{{payment-options
plans=model.plans
selectedPlan=selectedPlan
}}
{{payment-options plans=model.plans selectedPlan=selectedPlan}}
<hr>
@ -33,7 +31,12 @@
{{login-required}}
{{else}}
<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>
{{d-button
@ -46,7 +49,11 @@
{{else}}
<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"}}
{{/link-to}}
{{/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
class="activity-nav"
desktopClass="action-list nav-stacked"

View File

@ -25,9 +25,17 @@
{{loading-spinner size="small"}}
{{else}}
{{#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}}
{{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}}
</td>

View File

@ -1,10 +1,10 @@
{
"name": "discourse-subscriptions",
"version": "1.0.0",
"repository": "git@github.com:discourse/discourse-subscriptions.git",
"repository": "https://github.com/discourse/discourse-subscriptions",
"author": "Discourse",
"license": "MIT",
"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