DEV: Use angle bracket syntax (#158)

This commit is contained in:
Isaac Janzen 2023-05-02 09:24:28 -05:00 committed by GitHub
parent 45b7eb6e6c
commit c06ae37048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 315 additions and 297 deletions

View File

@ -22,19 +22,19 @@
<td>{{coupon.discount}}</td> <td>{{coupon.discount}}</td>
<td>{{coupon.times_redeemed}}</td> <td>{{coupon.times_redeemed}}</td>
<td> <td>
{{input <Input
type="checkbox" @type="checkbox"
checked=coupon.active @checked={{coupon.active}}
click=(action "toggleActive" coupon) {{on "click" (action "toggleActive" coupon)}}
}} />
</td> </td>
<td> <td>
{{d-button <DButton
action=(action "deleteCoupon") @action={{this.deleteCoupon}}
actionParam=coupon @actionParam={{coupon}}
icon="trash-alt" @icon="trash-alt"
class="btn-danger btn btn-icon btn-no-text" class="btn-danger btn btn-icon btn-no-text"
}} />
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
@ -43,13 +43,13 @@
{{/if}} {{/if}}
{{#unless creating}} {{#unless creating}}
{{d-button <DButton
action=(action "openCreateForm") @action={{this.openCreateForm}}
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 btn-icon btn-primary create-coupon" class="btn btn-icon btn-primary create-coupon"
}} />
{{/unless}} {{/unless}}
{{#if creating}} {{#if creating}}

View File

@ -1,6 +1,6 @@
<h3>{{i18n "discourse_subscriptions.admin.dashboard.title"}}</h3> <h3>{{i18n "discourse_subscriptions.admin.dashboard.title"}}</h3>
{{#load-more selector=".discourse-patrons-table tr" action=(action "loadMore")}} <LoadMore @selector=".discourse-patrons-table tr" @action={{action "loadMore"}}>
{{#if model}} {{#if model}}
<table class="table discourse-patrons-table"> <table class="table discourse-patrons-table">
<thead> <thead>
@ -38,14 +38,20 @@
{{#each model as |payment|}} {{#each model as |payment|}}
<tr> <tr>
<td> <td>
{{#link-to "adminUser.index" payment.user_id payment.username}} <LinkTo
@route="adminUser.index"
@models={{array payment.user_id payment.username}}
>
{{payment.username}} {{payment.username}}
{{/link-to}} </LinkTo>
</td> </td>
<td> <td>
{{#link-to "patrons.show" payment.payment_intent_id}} <LinkTo
@route="patrons.show"
@model={{payment.payment_intent_id}}
>
{{html-safe payment.payment_intent_id}} {{html-safe payment.payment_intent_id}}
{{/link-to}} </LinkTo>
</td> </td>
<td>{{payment.receipt_email}}</td> <td>{{payment.receipt_email}}</td>
<td>{{html-safe (format-duration payment.created_at_age)}}</td> <td>{{html-safe (format-duration payment.created_at_age)}}</td>
@ -55,4 +61,4 @@
</tbody> </tbody>
</table> </table>
{{/if}} {{/if}}
{{/load-more}} </LoadMore>

View File

@ -14,17 +14,17 @@
<td>{{plan.interval}}</td> <td>{{plan.interval}}</td>
<td>{{plan.unit_amount}}</td> <td>{{plan.unit_amount}}</td>
<td class="td-right"> <td class="td-right">
{{d-button <DButton
action=(action "editPlan" plan.id) @action={{action "editPlan" plan.id}}
icon="far-edit" @icon="far-edit"
class="btn no-text btn-icon" class="btn no-text btn-icon"
}} />
{{d-button <DButton
action=(route-action "destroyPlan") @action={{route-action "destroyPlan"}}
actionParam=plan @actionParam={{plan}}
icon="trash-alt" @icon="trash-alt"
class="btn-danger btn no-text btn-icon" class="btn-danger btn no-text btn-icon"
}} />
</td> </td>
</tr> </tr>
{{/each}} {{/each}}

View File

@ -7,16 +7,16 @@
</p> </p>
{{else}} {{else}}
<p class="btn-right"> <p class="btn-right">
{{#link-to <LinkTo
"adminPlugins.discourse-subscriptions.products.show" @route="adminPlugins.discourse-subscriptions.products.show"
"new" @model="new"
class="btn btn-primary" class="btn btn-primary"
}} >
{{d-icon "plus"}} {{d-icon "plus"}}
<span> <span>
{{i18n "discourse_subscriptions.admin.products.operations.new"}} {{i18n "discourse_subscriptions.admin.products.operations.new"}}
</span> </span>
{{/link-to}} </LinkTo>
</p> </p>
{{#if model}} {{#if model}}
@ -46,20 +46,20 @@
<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 <LinkTo
"adminPlugins.discourse-subscriptions.products.show" @route="adminPlugins.discourse-subscriptions.products.show"
product.id @model={{product.id}}
class="btn no-text btn-icon" class="btn no-text btn-icon"
}} >
{{d-icon "far-edit"}} {{d-icon "far-edit"}}
{{/link-to}} </LinkTo>
{{d-button <DButton
action=(route-action "destroyProduct") @action={{route-action "destroyProduct"}}
actionParam=product @actionParam="product"
icon="trash-alt" @icon="trash-alt"
class="btn-danger btn no-text btn-icon" class="btn-danger btn no-text btn-icon"
}} />
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -6,12 +6,12 @@
{{i18n "discourse_subscriptions.admin.products.product.name"}} {{i18n "discourse_subscriptions.admin.products.product.name"}}
</label> </label>
{{input <Input
type="text" @type="text"
name="product_name" name="product_name"
value=model.product.name @value={{model.product.name}}
disabled=true disabled={{true}}
}} />
</p> </p>
<p> <p>
@ -19,7 +19,7 @@
{{i18n "discourse_subscriptions.admin.plans.plan.nickname"}} {{i18n "discourse_subscriptions.admin.plans.plan.nickname"}}
</label> </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"}}
@ -31,12 +31,12 @@
{{i18n "discourse_subscriptions.admin.plans.plan.group"}} {{i18n "discourse_subscriptions.admin.plans.plan.group"}}
</label> </label>
{{combo-box <ComboBox
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"}}
@ -49,27 +49,27 @@
</label> </label>
{{#if planFieldDisabled}} {{#if planFieldDisabled}}
{{input <Input
class="plan-amount plan-currency" class="plan-amount plan-currency"
disabled=true disabled={{true}}
value=model.plan.currency @value={{model.plan.currency}}
}} />
{{else}} {{else}}
{{combo-box <ComboBox
disabled=planFieldDisabled @disabled={{planFieldDisabled}}
content=currencies @content={{currencies}}
value=model.plan.currency @value={{model.plan.currency}}
onChange=(action (mut model.plan.currency)) @onChange={{action (mut model.plan.currency)}}
}} />
{{/if}} {{/if}}
{{input <Input
class="plan-amount" class="plan-amount"
type="text" @type="text"
name="name" name="name"
value=model.plan.amountDollars @value={{model.plan.amountDollars}}
disabled=planFieldDisabled disabled={{planFieldDisabled}}
}} />
</p> </p>
<p> <p>
@ -78,19 +78,19 @@
</label> </label>
{{#if planFieldDisabled}} {{#if planFieldDisabled}}
{{input <Input
type="checkbox" @type="checkbox"
name="recurring" name="recurring"
checked=model.plan.isRecurring @checked={{model.plan.isRecurring}}
disabled=true disabled={{true}}
}} />
{{else}} {{else}}
{{input <Input
type="checkbox" @type="checkbox"
name="recurring" name="recurring"
checked=model.plan.isRecurring @checked={{model.plan.isRecurring}}
change=(action "changeRecurring") {{on "change" this.changeRecurring}}
}} />
{{/if}} {{/if}}
</p> </p>
@ -101,14 +101,14 @@
</label> </label>
{{#if planFieldDisabled}} {{#if planFieldDisabled}}
{{input disabled=true value=selectedInterval}} <Input disabled={{true}} @value={{selectedInterval}} />
{{else}} {{else}}
{{combo-box <ComboBox
valueProperty="name" @valueProperty="name"
content=availableIntervals @content={{availableIntervals}}
value=selectedInterval @value={{selectedInterval}}
onChange=(action (mut selectedInterval)) @onChange={{action (mut selectedInterval)}}
}} />
{{/if}} {{/if}}
</p> </p>
@ -118,7 +118,11 @@
({{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"}}
@ -130,7 +134,7 @@
<label for="active"> <label for="active">
{{i18n "discourse_subscriptions.admin.plans.plan.active"}} {{i18n "discourse_subscriptions.admin.plans.plan.active"}}
</label> </label>
{{input type="checkbox" name="active" checked=model.plan.active}} <Input @type="checkbox" name="active" @checked={{model.plan.active}} />
</p> </p>
</form> </form>
@ -143,19 +147,19 @@
<div class="pull-right"> <div class="pull-right">
{{#if model.plan.isNew}} {{#if model.plan.isNew}}
{{d-button <DButton
label="discourse_subscriptions.admin.plans.operations.create" @label="discourse_subscriptions.admin.plans.operations.create"
action=(action "createPlan") @action={{action "createPlan"}}
icon="plus" @icon="plus"
class="btn btn-primary" class="btn btn-primary"
}} />
{{else}} {{else}}
{{d-button <DButton
label="discourse_subscriptions.admin.plans.operations.update" @label="discourse_subscriptions.admin.plans.operations.update"
action=(action "updatePlan") @action={{action "updatePlan"}}
icon="check" @icon="check"
class="btn btn-primary" class="btn btn-primary"
}} />
{{/if}} {{/if}}
</div> </div>
</section> </section>

View File

@ -5,7 +5,7 @@
<label for="name"> <label for="name">
{{i18n "discourse_subscriptions.admin.products.product.name"}} {{i18n "discourse_subscriptions.admin.products.product.name"}}
</label> </label>
{{input type="text" name="name" value=model.product.name}} <Input @type="text" name="name" @value={{model.product.name}} />
</p> </p>
<p> <p>
@ -13,11 +13,11 @@
{{i18n "discourse_subscriptions.admin.products.product.description"}} {{i18n "discourse_subscriptions.admin.products.product.description"}}
</label> </label>
{{textarea <Textarea
name="description" name="description"
value=model.product.metadata.description @value={{model.product.metadata.description}}
class="discourse-subscriptions-admin-textarea" 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"}}
@ -31,11 +31,11 @@
}} }}
</label> </label>
{{input <Input
type="text" @type="text"
name="statement_descriptor" name="statement_descriptor"
value=model.product.statement_descriptor @value={{model.product.statement_descriptor}}
}} />
<div class="control-instructions"> <div class="control-instructions">
{{i18n {{i18n
@ -49,11 +49,11 @@
{{i18n "discourse_subscriptions.admin.products.product.repurchaseable"}} {{i18n "discourse_subscriptions.admin.products.product.repurchaseable"}}
</label> </label>
{{input <Input
type="checkbox" @type="checkbox"
name="repurchaseable" name="repurchaseable"
checked=model.product.metadata.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"}}
@ -65,7 +65,7 @@
{{i18n "discourse_subscriptions.admin.products.product.active"}} {{i18n "discourse_subscriptions.admin.products.product.active"}}
</label> </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"}}
@ -88,14 +88,13 @@
{{i18n "discourse_subscriptions.admin.plans.plan.amount"}} {{i18n "discourse_subscriptions.admin.plans.plan.amount"}}
</th> </th>
<th class="td-right"> <th class="td-right">
{{#link-to <LinkTo
"adminPlugins.discourse-subscriptions.products.show.plans.show" @route="adminPlugins.discourse-subscriptions.products.show.plans.show"
model.product.id @models={{array model.product.id "new"}}
"new"
class="btn" class="btn"
}} >
{{i18n "discourse_subscriptions.admin.plans.operations.add"}} {{i18n "discourse_subscriptions.admin.plans.operations.add"}}
{{/link-to}} </LinkTo>
</th> </th>
</thead> </thead>
@ -111,14 +110,13 @@
{{format-currency plan.currency plan.amountDollars}} {{format-currency plan.currency plan.amountDollars}}
</td> </td>
<td class="td-right"> <td class="td-right">
{{#link-to <LinkTo
"adminPlugins.discourse-subscriptions.products.show.plans.show" @route="adminPlugins.discourse-subscriptions.products.show.plans.show"
model.product.id @models={{array model.product.id plan.id}}
plan.id
class="btn no-text btn-icon" class="btn no-text btn-icon"
}} >
{{d-icon "far-edit"}} {{d-icon "far-edit"}}
{{/link-to}} </LinkTo>
</td> </td>
</tr> </tr>
{{else}} {{else}}
@ -137,22 +135,22 @@
{{/unless}} {{/unless}}
<div class="pull-right"> <div class="pull-right">
{{d-button label="cancel" action=(action "cancelProduct") icon="times"}} <DButton @label="cancel" @action={{this.cancelProduct}} @icon="times" />
{{#if model.product.isNew}} {{#if model.product.isNew}}
{{d-button <DButton
label="discourse_subscriptions.admin.products.operations.create" @label="discourse_subscriptions.admin.products.operations.create"
action=(action "createProduct") @action={{action "createProduct"}}
icon="plus" @icon="plus"
class="btn btn-primary" class="btn btn-primary"
}} />
{{else}} {{else}}
{{d-button <DButton
label="discourse_subscriptions.admin.products.operations.update" @label="discourse_subscriptions.admin.products.operations.update"
action=(action "updateProduct") @action={{action "updateProduct"}}
icon="check" @icon="check"
class="btn btn-primary" class="btn btn-primary"
}} />
{{/if}} {{/if}}
</div> </div>

View File

@ -6,10 +6,10 @@
</a> </a>
</p> </p>
{{else}} {{else}}
{{#load-more <LoadMore
selector=".discourse-patrons-table tr" @selector=".discourse-patrons-table tr"
action=(action "loadMore") @action={{action "loadMore"}}
}} >
<table class="table discourse-patrons-table"> <table class="table discourse-patrons-table">
<thead> <thead>
<tr> <tr>
@ -72,19 +72,19 @@
{{#if subscription.loading}} {{#if subscription.loading}}
{{loading-spinner size="small"}} {{loading-spinner size="small"}}
{{else}} {{else}}
{{d-button <DButton
disabled=subscription.canceled @disabled={{subscription.canceled}}
label="cancel" @label="cancel"
action=(action "showCancelModal" subscription) @action={{action "showCancelModal" subscription}}
icon="times" @icon="times"
}} />
{{/if}} {{/if}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
{{/load-more}} </LoadMore>
{{conditional-loading-spinner condition=loading}} <ConditionalLoadingSpinner @condition={{loading}} />
{{/if}} {{/if}}

View File

@ -3,36 +3,36 @@
{{#if stripeConfigured}} {{#if stripeConfigured}}
<div class="discourse-subscriptions-buttons"> <div class="discourse-subscriptions-buttons">
{{#if campaignEnabled}} {{#if campaignEnabled}}
{{d-button <DButton
label="discourse_subscriptions.campaign.refresh_campaign" @label="discourse_subscriptions.campaign.refresh_campaign"
icon="sync-alt" @icon="sync-alt"
action=(action "triggerManualRefresh") @action={{action "triggerManualRefresh"}}
}} />
{{else}} {{else}}
{{#unless campaignProductSet}} {{#unless campaignProductSet}}
{{d-button <DButton
label="discourse_subscriptions.campaign.one_click_campaign" @label="discourse_subscriptions.campaign.one_click_campaign"
icon="plus-square" @icon="plus-square"
action=(action "createOneClickCampaign") @action={{action "createOneClickCampaign"}}
isLoading=loading @isLoading="loading"
}} />
{{/unless}} {{/unless}}
{{/if}} {{/if}}
</div> </div>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
{{nav-item <NavItem
route="adminPlugins.discourse-subscriptions.products" @route="adminPlugins.discourse-subscriptions.products"
label="discourse_subscriptions.admin.products.title" @label="discourse_subscriptions.admin.products.title"
}} />
{{nav-item <NavItem
route="adminPlugins.discourse-subscriptions.coupons" @route="adminPlugins.discourse-subscriptions.coupons"
label="discourse_subscriptions.admin.coupons.title" @label="discourse_subscriptions.admin.coupons.title"
}} />
{{nav-item <NavItem
route="adminPlugins.discourse-subscriptions.subscriptions" @route="adminPlugins.discourse-subscriptions.subscriptions"
label="discourse_subscriptions.admin.subscriptions.title" @label="discourse_subscriptions.admin.subscriptions.title"
}} />
</ul> </ul>
<hr /> <hr />

View File

@ -3,7 +3,7 @@
class="campaign-banner" class="campaign-banner"
style={{html-safe (concat "box-shadow: 5px 5px #" dropShadowColor)}} style={{html-safe (concat "box-shadow: 5px 5px #" dropShadowColor)}}
> >
{{d-button icon="times" action=(action "dismissBanner") class="close"}} <DButton @icon="times" @action={{this.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}}
@ -24,25 +24,25 @@
</p> </p>
{{#if product}} {{#if product}}
{{#link-to <LinkTo
"subscribe.show" @route="subscribe.show"
product @model={{product}}
disabled=product.subscribed @disabled={{product.subscribed}}
class="btn btn-primary campaign-banner-info-button" class="btn btn-primary campaign-banner-info-button"
}} >
{{d-icon "far-heart"}} {{d-icon "far-heart"}}
{{d-icon "heart" class="hover-heart"}} {{d-icon "heart" class="hover-heart"}}
{{i18n "discourse_subscriptions.campaign.button"}} {{i18n "discourse_subscriptions.campaign.button"}}
{{/link-to}} </LinkTo>
{{else}} {{else}}
{{#link-to <LinkTo
"subscribe" @route="subscribe"
class="btn btn-primary campaign-banner-info-button" class="btn btn-primary campaign-banner-info-button"
}} >
{{d-icon "far-heart"}} {{d-icon "far-heart"}}
{{d-icon "heart" class="hover-heart"}} {{d-icon "heart" class="hover-heart"}}
{{i18n "discourse_subscriptions.campaign.button"}} {{i18n "discourse_subscriptions.campaign.button"}}
{{/link-to}} </LinkTo>
{{/if}} {{/if}}
{{/if}} {{/if}}
</div> </div>
@ -80,7 +80,7 @@
</p> </p>
{{#if showContributors}} {{#if showContributors}}
{{#conditional-loading-spinner condition=loading size="small"}} <ConditionalLoadingSpinner @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> <strong>
@ -102,7 +102,7 @@
{{/each}} {{/each}}
</div> </div>
</div> </div>
{{/conditional-loading-spinner}} </ConditionalLoadingSpinner>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{else}} {{else}}
@ -143,7 +143,7 @@
{{/if}} {{/if}}
{{#if showContributors}} {{#if showContributors}}
{{#conditional-loading-spinner condition=loading size="small"}} <ConditionalLoadingSpinner @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> <strong>
@ -165,7 +165,7 @@
{{/each}} {{/each}}
</div> </div>
</div> </div>
{{/conditional-loading-spinner}} </ConditionalLoadingSpinner>
{{/if}} {{/if}}
{{/if}} {{/if}}
</div> </div>

View File

@ -4,42 +4,47 @@
<label for="promo_code"> <label for="promo_code">
{{i18n "discourse_subscriptions.admin.coupons.promo_code"}} {{i18n "discourse_subscriptions.admin.coupons.promo_code"}}
</label> </label>
{{input type="text" name="promo_code" value=promoCode}} <Input @type="text" name="promo_code" @value={{promoCode}} />
</p> </p>
<p> <p>
<label for="amount"> <label for="amount">
{{i18n "discourse_subscriptions.admin.coupons.discount"}} {{i18n "discourse_subscriptions.admin.coupons.discount"}}
</label> </label>
{{combo-box <ComboBox
content=discountTypes @content={{discountTypes}}
value=discountType @value={{discountType}}
onChange=(action (mut discountType)) @onChange={{action (mut discountType)}}
}} />
{{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"}}
</label> </label>
{{input type="checkbox" name="active" checked=active}} <Input @type="checkbox" name="active" @checked={{active}} />
</p> </p>
</form> </form>
{{d-button <DButton
action=(action "createNewCoupon") @action={{action "createNewCoupon"}}
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 <DButton
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,8 +1,8 @@
<h3>{{i18n "discourse_subscriptions.subscribe.unauthenticated"}}</h3> <h3>{{i18n "discourse_subscriptions.subscribe.unauthenticated"}}</h3>
{{d-button <DButton
label="log_in" @label="log_in"
action=(action "createAccount") @action={{this.createAccount}}
icon="user" @icon="user"
class="btn btn-primary" class="btn btn-primary"
}} />

View File

@ -1,6 +1,6 @@
<DButton <DButton
@action={{action "planClick"}} @action={{action "planClick"}}
@class={{concat-class "btn-discourse-subscriptions-subscribe" selectedClass}} class={{concat-class "btn-discourse-subscriptions-subscribe" selectedClass}}
> >
<span class="interval"> <span class="interval">
{{#if this.recurringPlan}} {{#if this.recurringPlan}}

View File

@ -7,18 +7,22 @@
{{#if isLoggedIn}} {{#if isLoggedIn}}
<div class="product-purchase"> <div class="product-purchase">
{{#if product.repurchaseable}} {{#if product.repurchaseable}}
{{#link-to "subscribe.show" product.id class="btn btn-primary"}} <LinkTo
@route="subscribe.show"
@model={{product.id}}
class="btn btn-primary"
>
{{i18n "discourse_subscriptions.subscribe.title"}} {{i18n "discourse_subscriptions.subscribe.title"}}
{{/link-to}} </LinkTo>
{{#if product.subscribed}} {{#if product.subscribed}}
{{#link-to <LinkTo
"user.billing.subscriptions" @route="user.billing.subscriptions"
currentUser.username @model={{currentUser.username}}
class="billing-link" class="billing-link"
}} >
{{i18n "discourse_subscriptions.subscribe.view_past"}} {{i18n "discourse_subscriptions.subscribe.view_past"}}
{{/link-to}} </LinkTo>
{{/if}} {{/if}}
{{else}} {{else}}
{{#if product.subscribed}} {{#if product.subscribed}}
@ -27,22 +31,22 @@
{{i18n "discourse_subscriptions.subscribe.purchased"}} {{i18n "discourse_subscriptions.subscribe.purchased"}}
</span> </span>
{{#link-to <LinkTo
"user.billing.subscriptions" @route="user.billing.subscriptions"
currentUser.username @model={{currentUser.username}}
class="billing-link" class="billing-link"
}} >
{{i18n "discourse_subscriptions.subscribe.go_to_billing"}} {{i18n "discourse_subscriptions.subscribe.go_to_billing"}}
{{/link-to}} </LinkTo>
{{else}} {{else}}
{{#link-to <LinkTo
"subscribe.show" @route="subscribe.show"
product.id @model={{product.id}}
disabled=product.subscribed @disabled={{product.subscribed}}
class="btn btn-primary" class="btn btn-primary"
}} >
{{i18n "discourse_subscriptions.subscribe.title"}} {{i18n "discourse_subscriptions.subscribe.title"}}
{{/link-to}} </LinkTo>
{{/if}} {{/if}}
{{/if}} {{/if}}
</div> </div>

View File

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

View File

@ -1,26 +1,27 @@
<div> <div>
{{#d-modal-body <DModalBody
rawTitle=(i18n @rawTitle={{i18n
"discourse_subscriptions.user.subscriptions.operations.destroy.confirm" "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}} </DModalBody>
<div class="modal-footer"> <div class="modal-footer">
{{#if model.loading}} {{#if model.loading}}
{{loading-spinner}} {{loading-spinner}}
{{else}} {{else}}
{{d-button <DButton
label="yes_value" @label="yes_value"
action=(route-action @action={{route-action
"cancelSubscription" (hash subscription=model refund=refund) "cancelSubscription"
) (hash subscription=model refund=refund)
icon="times" }}
@icon="times"
class="btn-danger" class="btn-danger"
}} />
{{d-button label="no_value" action=(route-action "closeModal")}} <DButton @label="no_value" @action={{route-action "closeModal"}} />
{{/if}} {{/if}}
</div> </div>
</div> </div>

View File

@ -30,31 +30,31 @@
{{else if isAnonymous}} {{else if isAnonymous}}
{{login-required}} {{login-required}}
{{else}} {{else}}
{{input <Input
type="text" @type="text"
name="promo_code" name="promo_code"
placeholder=(i18n "discourse_subscriptions.subscribe.promo_code") placeholder={{i18n "discourse_subscriptions.subscribe.promo_code"}}
value=promoCode @value={{promoCode}}
class="subscribe-promo-code" class="subscribe-promo-code"
}} />
{{d-button <DButton
disabled=loading @disabled={{loading}}
action=(action "stripePaymentHandler") @action={{this.stripePaymentHandler}}
class="btn btn-primary btn-payment" class="btn btn-primary btn-payment"
label="discourse_subscriptions.plans.payment_button" @label="discourse_subscriptions.plans.payment_button"
}} />
{{/if}} {{/if}}
{{else}} {{else}}
<h2>{{i18n "discourse_subscriptions.subscribe.already_purchased"}}</h2> <h2>{{i18n "discourse_subscriptions.subscribe.already_purchased"}}</h2>
{{#link-to <LinkTo
"user.billing.subscriptions" @route="user.billing.subscriptions"
currentUser.username @model={{currentUser.username}}
class="btn btn-primary" class="btn btn-primary"
}} >
{{i18n "discourse_subscriptions.subscribe.go_to_billing"}} {{i18n "discourse_subscriptions.subscribe.go_to_billing"}}
{{/link-to}} </LinkTo>
{{/if}} {{/if}}
</div> </div>
</div> </div>

View File

@ -1,26 +1,26 @@
{{#d-section <DSection
pageClass="user-billing" @pageClass="user-billing"
class="user-secondary-navigation" @class="user-secondary-navigation"
scrollTop="false" @scrollTop="false"
}} >
{{#mobile-nav <MobileNav
class="activity-nav" @class="activity-nav"
desktopClass="action-list nav-stacked" @desktopClass="action-list nav-stacked"
currentPath=router._router.currentPath @currentPath={{router._router.currentPath}}
}} >
<li> <li>
{{#link-to "user.billing.subscriptions"}} <LinkTo @route="user.billing.subscriptions">
{{i18n "discourse_subscriptions.navigation.subscriptions"}} {{i18n "discourse_subscriptions.navigation.subscriptions"}}
{{/link-to}} </LinkTo>
</li> </li>
<li> <li>
{{#link-to "user.billing.payments"}} <LinkTo @route="user.billing.payments">
{{i18n "discourse_subscriptions.navigation.payments"}} {{i18n "discourse_subscriptions.navigation.payments"}}
{{/link-to}} </LinkTo>
</li> </li>
{{/mobile-nav}} </MobileNav>
{{/d-section}} </DSection>
<section class="user-content"> <section class="user-content">
{{outlet}} {{outlet}}

View File

@ -8,10 +8,10 @@
{{subscribe-card cardElement=cardElement class="input-xxlarge"}} {{subscribe-card cardElement=cardElement class="input-xxlarge"}}
</div> </div>
{{save-controls <SaveControls
action=(action "updatePaymentMethod") @action={{action "updatePaymentMethod"}}
saved=saved @saved={{saved}}
saveDisabled=loading @saveDisabled={{loading}}
savingText="discourse_subscriptions.user.subscriptions.update_card.single" @savingText="discourse_subscriptions.user.subscriptions.update_card.single"
}} />
</div> </div>

View File

@ -25,22 +25,22 @@
{{loading-spinner size="small"}} {{loading-spinner size="small"}}
{{else}} {{else}}
{{#if subscription.canceled_at}} {{#if subscription.canceled_at}}
{{d-button <DButton
disabled=subscription.canceled_at @disabled={{subscription.canceled_at}}
label="discourse_subscriptions.user.subscriptions.cancelled" @label="discourse_subscriptions.user.subscriptions.cancelled"
}} />
{{else}} {{else}}
{{d-button <DButton
action=(route-action "updateCard" subscription.id) @action={{route-action "updateCard" subscription.id}}
icon="far-edit" @icon="far-edit"
class="btn no-text btn-icon" class="btn no-text btn-icon"
}} />
{{d-button <DButton
class="btn-danger btn no-text btn-icon" class="btn-danger btn no-text btn-icon"
icon="trash-alt" @icon="trash-alt"
disabled=subscription.canceled_at @disabled={{subscription.canceled_at}}
action=(route-action "cancelSubscription" subscription) @action={{route-action "cancelSubscription" subscription}}
}} />
{{/if}} {{/if}}
{{/if}} {{/if}}
</td> </td>