Skip to content

Commit

Permalink
Disable input when updating subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
pratishta committed Dec 18, 2024
1 parent 5677d10 commit 8ca70bf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions client/app/controllers/subscription-update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Controller from '@ember/controller';
import { action } from '@ember/object';

export default class SubscriptionUpdateController extends Controller {
isSubmitting = false;

@action
setIsSubmitting(isSubmittingValue) {
this.set('isSubmitting', isSubmittingValue);
}
}

Check failure on line 11 in client/app/controllers/subscription-update.js

View workflow job for this annotation

GitHub Actions / Tests

Newline required at end of file but not found
2 changes: 1 addition & 1 deletion client/app/templates/components/subscription-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</div>

<div class="subscribe-section">
{{#if isSubmitting}}
{{#if this.args.isSubmitting}}
{{fa-icon icon='spinner' spin="true" size="5x" class="map-loading-spinner"}}
{{/if}}
<a class="button primary no-margin {{if this.canBeSubmitted "" "disabled"}}" type="submit" {{action "subscribe"}}>{{if this.args.isUpdate "Update" "Subscribe"}}</a>
Expand Down
2 changes: 1 addition & 1 deletion client/app/templates/subscribe.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="subscribe-section">
<div class="subscribe-input-group">
<label class="email-label">Email Address</label>
<Input class="input-group-field" type="text" @value={{this.model.email}} onkeyup={{action 'continuouslyCheckEmail'}} onchange={{action 'checkExistingEmail'}} @disabled={{ this.isSubmitting }}/>
<Input class="input-group-field" type="text" @value={{this.model.email}} onkeyup={{action 'continuouslyCheckEmail'}} onchange={{action 'checkExistingEmail'}} @disabled={{this.isSubmitting}}/>
</div>
{{#if this.emailAlreadyExists}}
<p class="email-exists">This email already is subscribed to ZAP Updates. <a onclick={{action 'sendEmail'}}>Click here to receive an email to modify subscriptions.</a></p>
Expand Down
2 changes: 1 addition & 1 deletion client/app/templates/subscription-update.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<p></p>
<div class="update-type-question">To unsubscribe from a Community District or Citywide, uncheck the selected options below.</div>
</div>
<SubscriptionForm @subscriptions={{this.model.subscriptions}} @email={{this.model.email}} @isUpdate={{true}} @id={{this.model.id}}>
<SubscriptionForm @subscriptions={{this.model.subscriptions}} @email={{this.model.email}} @isUpdate={{true}} @id={{this.model.id}} @isSubmitting={{this.isSubmitting}} @setIsSubmitting={{this.setIsSubmitting}}>
<div class="subscribe-section">
<div class="subscribe-input-group">
<label class="email-label">Email Address</label>
Expand Down

0 comments on commit 8ca70bf

Please sign in to comment.