0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Added loading for assigning comped subscription to member

no refs

Adds loading indicator when member is being saved with new complimentary price
This commit is contained in:
Rishabh 2021-05-19 23:17:59 +05:30
parent f9f925d923
commit d3023e8b52
3 changed files with 22 additions and 7 deletions

View file

@ -110,10 +110,14 @@
<div class="mb2">This member doesn't have subscriptions.</div>
{{#unless this.member.isNew}}
{{#if this.isAddComplimentaryAllowed}}
{{#if this.isCreatingComplimentary}}
Loading...
{{else}}
<button type="button" class="gh-btn gh-btn-text green gh-btn-icon gh-btn-addproduct" {{action "addCompedSubscription"}}>
<span>{{svg-jar "add"}} Add complimentary subscription</span>
</button>
{{/if}}
{{/if}}
{{/unless}}
</div>
</div>
@ -181,9 +185,13 @@
{{/each}}
{{#if this.isAddComplimentaryAllowed}}
<div class="gh-memberproduct-list-footer">
{{#if this.isCreatingComplimentary}}
Loading...
{{else}}
<button type="button" class="gh-btn gh-btn-text green gh-btn-icon gh-btn-addproduct" {{action "addCompedSubscription"}}>
<span>{{svg-jar "add"}} Add complimentary subscription</span>
</button>
{{/if}}
</div>
{{/if}}
</div>

View file

@ -79,6 +79,11 @@ export default class extends Component {
return null;
}
get isCreatingComplimentary() {
const {comped} = this.member.changedAttributes() || {};
return comped && comped[0] === false && comped[1] === true && this.args.isSaveRunning;
}
@action
setProperty(property, value) {
this.args.setProperty(property, value);
@ -103,6 +108,7 @@ export default class extends Component {
continueSubscription(subscriptionId) {
this.continueSubscriptionTask.perform(subscriptionId);
}
@action
addCompedSubscription() {
this.args.setProperty('comped', true);

View file

@ -32,6 +32,7 @@
@scratchMember={{this.scratchMember}}
@setProperty={{this.setProperty}}
@saveMember={{this.save}}
@isSaveRunning={{this.saveTask.isRunning}}
@isLoading={{this.isLoading}} />
</form>