Usage: {{cancel_link}}
Description
The {{cancel_link}} helper is designed to output links to cancel or continue a subscription, so that your members can manage their own subscriptions.
This helper wraps all of the internals needed to cancel an active subscription or to continue the subscription if it was previously canceled.
The helper must be used in the @member.subscriptions context, for example:
The HTML markup generated by this code looks like this:
<a class="gh-subscription-cancel" data-members-cancel-subscription="sub_*****" href="javascript:">
Cancel subscription
</a>
<span class="gh-error gh-error-subscription-cancel" data-members-error><!-- error message will appear here --></span>Attributes
The {{cancel_link}} helper accepts a number of optional attributes:
class- defaults togh-subscription-cancelerrorClass- defaults togh-error gh-error-subscription-cancelcancelLabel- defaults toCancel subscriptioncontinueLabel- defaults toContinue subscription
Here's an example of how you can use the helper with all of the attributes:
This would produce the following HTML for previously canceled subscription:
<a class="cancel-link" data-members-continue-subscription="sub_*****" href="javascript:">
Continue!
</a>
<span class="cancel-error" data-members-error><!-- error message will appear here --></span>Here's an example of the {{cancel_link}} helper in use in the members-enabled theme Lyra within the account.hbs file.
It's used inside a {{#foreach @member.subscriptions}} loop which provides the helper the context needed to generate an appropriate link, and is surrounded by other useful information displayed to the member.
<div class="subscription">
<p>
<strong class="subscription-expiration-warning">Your subscription will expire on .</strong> If you change your mind in the mean time you can turn auto-renew back on to continue your subscription.
</p>
<p>
Hey! You have an active account with access to all areas. Get in touch if have any problems or need some help getting things updated, and thanks for subscribing.
</p>
<div class="subscriber-details">
<div class="subscriber-detail">
<label class="subscriber-detail-label">Email address</label>
<span class="subscriber-detail-content"></span>
</div>
<div class="subscriber-detail">
<label class="subscriber-detail-label">Your plan</label>
<span class="subscriber-detail-content">$<span class="plan-price">0</span>/</span>
</div>
<div class="subscriber-detail">
<label class="subscriber-detail-label">Card</label>
<span class="subscriber-detail-content">**** **** **** </span>
</div>
<div class="subscriber-detail">
<label class="subscriber-detail-label">
Expires
Next bill date
</label>
<span class="subscriber-detail-content"></span>
</div>
<script>
$(document).ready(function () {
var planAmount = / 100;
$(".plan-price").html(planAmount);
});
</script>
</div>
</div>