Skip to content

Commit

Permalink
Disable input when updating subscriptions
Browse files Browse the repository at this point in the history
Add semicolon
  • Loading branch information
pratishta authored and dhochbaum-dcp committed Dec 19, 2024
1 parent c140154 commit 1ad5a26
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client/app/components/subscription-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class SubscriptionFormComponent extends Component {
async subscribe() {
if (!this.canBeSubmitted) { return; }

this.args.setIsSubmitting(true)
this.args.setIsSubmitting(true);

const requestBody = { email: this.args.email, subscriptions: {} };
if (this.isCommunityDistrict) {
Expand Down Expand Up @@ -141,7 +141,7 @@ export default class SubscriptionFormComponent extends Component {

if (!this.args.isUpdate) window.location.pathname = '/subscribed';

this.args.setIsSubmitting(false)
this.args.setIsSubmitting(false);

if (this.args.isUpdate) {
set(this, 'showSubscriptionUpdateConfirmationModal', true);
Expand Down
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);
}
}
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 1ad5a26

Please sign in to comment.