Skip to content

Commit

Permalink
Initial work for form response obj
Browse files Browse the repository at this point in the history
  • Loading branch information
pratishta committed Nov 1, 2024
1 parent 8a58cc9 commit 9c16ce6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
32 changes: 25 additions & 7 deletions client/app/components/subscription-form.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
import Component from '@ember/component';
import { action } from '@ember/object';
import { lookupCommunityDistrict } from '../helpers/lookup-community-district';

Check failure on line 3 in client/app/components/subscription-form.js

View workflow job for this annotation

GitHub Actions / Tests

'lookupCommunityDistrict' is defined but never used
import { inject as service } from '@ember/service';

Check failure on line 4 in client/app/components/subscription-form.js

View workflow job for this annotation

GitHub Actions / Tests

`@ember/service` import should occur before import of `../helpers/lookup-community-district`

Check failure on line 4 in client/app/components/subscription-form.js

View workflow job for this annotation

GitHub Actions / Tests

'service' is defined but never used

export default class SubscriptionFormComponent extends Component {
// constructor(...args) {

Check failure on line 7 in client/app/components/subscription-form.js

View workflow job for this annotation

GitHub Actions / Tests

Expected indentation of 2 spaces but found 4
// super(...args);
// // this.subscriptions = {
// // 'Brooklyn': {},
// // 'Bronx': {},
// // 'Manhattan': {},
// // 'Queens': {},
// // 'Staten Island': {}
// // }

// const lookupCommunityDistrictObj = lookupCommunityDistrict();
// // console.log(lookupCommunityDistrictObj);

// for (let i = 0; i < lookupCommunityDistrictObj.length; i +=1 ) {
// const district = lookupCommunityDistrictObj[i];
// console.log(district);
// }
// }

@action
checkWholeBorough(event) {
const checkboxId = event.target.id;
Expand All @@ -19,12 +40,9 @@ export default class SubscriptionFormComponent extends Component {
}

@action
toggleUpdateType(event) {
const checkboxId = event.target.id;
if (checkboxId === "city-wide-checkbox") {
this.set('isCommunityDistrict', false)
} else if (checkboxId === "community-district-checkbox") {
this.set('isCityWide', false)
}
hamdleSubmit(event) {
event.preventDefault();
console.log('submitting');

Check warning on line 45 in client/app/components/subscription-form.js

View workflow job for this annotation

GitHub Actions / Tests

Unexpected console statement
console.log(event);

Check warning on line 46 in client/app/components/subscription-form.js

View workflow job for this annotation

GitHub Actions / Tests

Unexpected console statement
}
}
4 changes: 4 additions & 0 deletions client/app/styles/modules/_m-subscription-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ div.disabled {
color: $dark-gray;
}

.accordion-title:hover, .accordion-title:focus {
background-color: transparent;
}

ul li.accordion-title:last-child {
border-bottom: 5px;
}
Expand Down
16 changes: 14 additions & 2 deletions client/app/templates/components/subscription-form.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<form>
<form {{on "submit" this.handleSubmit}}>
<div class="subscribe-section">
<div class="subscribe-input-group">
<label class="email-label">Email Address</label>
<Input class="input-group-field" type="text" />
</div>
</div>

{{this.subscriptions}}
<div class="subscribe-section">
<div class="update-type-section">
Which would you like to receive updates for?
Expand Down Expand Up @@ -51,8 +52,10 @@
for="all-brooklyn">Select all</label>
{{#each (lookup-community-district) as |cd|}}
{{#if (string-includes cd.boro 'Brooklyn')}}
<div class="hi">
<Input id={{cd.code}} type="checkbox" checked={{allBrooklyn}} /><label
for={{cd.code}}>{{cd.searchField}}</label>
</div>
{{/if}}
{{/each}}
</div>
Expand All @@ -64,8 +67,10 @@
for="all-bronx">Select all</label>
{{#each (lookup-community-district) as |cd|}}
{{#if (string-includes cd.boro 'Bronx')}}
<div class="hi">
<Input id={{cd.searchField}} type="checkbox" checked={{allBronx}} /><label
for={{cd.searchField}}>{{cd.searchField}}</label>
</div>
{{/if}}
{{/each}}
</div>
Expand All @@ -77,8 +82,10 @@
for="all-manhattan">Select all</label>
{{#each (lookup-community-district) as |cd|}}
{{#if (string-includes cd.boro 'Manhattan')}}
<div>
<Input id={{cd.searchField}} type="checkbox" checked={{allManhattan}} /><label
for={{cd.searchField}}>{{cd.searchField}}</label>
</div>
{{/if}}
{{/each}}
</div>
Expand All @@ -90,8 +97,10 @@
for="all-queens">Select all</label>
{{#each (lookup-community-district) as |cd|}}
{{#if (string-includes cd.boro 'Queens')}}
<div>
<Input id={{cd.searchField}} type="checkbox" checked={{allQueens}} /><label
for={{cd.searchField}}>{{cd.searchField}}</label>
</div>
{{/if}}
{{/each}}
</div>
Expand All @@ -103,8 +112,10 @@
for="all-staten-island">Select all</label>
{{#each (lookup-community-district) as |cd|}}
{{#if (string-includes cd.boro 'Staten Island')}}
<div>
<Input id={{cd.searchField}} type="checkbox" checked={{allStatenIsland}} /><label
for={{cd.searchField}}>{{cd.searchField}}</label>
</div>
{{/if}}
{{/each}}
</div>
Expand All @@ -115,6 +126,7 @@
</div>
</div>
<div class="subscribe-section">
<a class="button primary no-margin disabled" href="">Subscribe</a>
<a class="button primary no-margin disabled" type="submit" href="">Subscribe</a>
{{!-- <input type="submit" value="Subscribe"> --}}
</div>
</form>

0 comments on commit 9c16ce6

Please sign in to comment.