-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pratishta/subscribe #1563
Draft
pratishta
wants to merge
18
commits into
develop
Choose a base branch
from
pratishta/subscribe
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Pratishta/subscribe #1563
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8e328b8
import works
pratishta 1ab8b13
add form
pratishta 2efa170
add boroughs
pratishta bdb6c57
Add css
pratishta 3b58434
Add component for subscription form
pratishta 437c849
Make select all checkbox conditional
pratishta 06e6ba7
Add styling
pratishta 3135e82
font
pratishta 4650dd6
border radius
pratishta 28031d9
Fix some styling and make update type conditional
pratishta 041fae0
more styling
pratishta 4b3b6e6
delete unnecessary files
pratishta 8a58cc9
Import component instead of ember
pratishta 9c16ce6
Initial work for form response obj
pratishta 219bdfb
Use subscriptions object to populate checkboxes
pratishta 09e87a4
attempt at select all checkbox
pratishta 23642d2
pair
pratishta 3e0b938
Rename subscribe page files, add logic to render all CDs and accordions
TylerMatteo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
didRender: function() { | ||
Check failure on line 4 in client/app/components/initialize-foundation.js GitHub Actions / Tests
|
||
$(this.element).foundation(); | ||
Check failure on line 5 in client/app/components/initialize-foundation.js GitHub Actions / Tests
|
||
}, | ||
}); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Component from '@glimmer/component'; | ||
import { action, set } from '@ember/object'; | ||
import { lookupCommunityDistrict } from '../helpers/lookup-community-district'; | ||
import { tracked } from '@glimmer/tracking'; | ||
Check failure on line 4 in client/app/components/subscription-form.js GitHub Actions / Tests
|
||
|
||
export default class SubscriptionFormComponent extends Component { | ||
|
||
communityDistrictsByBorough = {}; | ||
isCommunityDistrict = false; | ||
constructor(...args) { | ||
super(...args); | ||
|
||
const districts = lookupCommunityDistrict(); | ||
for (const district of districts) { | ||
const {code, num, boro} = district; | ||
if(boro in this.communityDistrictsByBorough === false) { | ||
this.communityDistrictsByBorough[boro] = [] | ||
} | ||
this.communityDistrictsByBorough[boro].push({code, num, boro}) | ||
} | ||
} | ||
|
||
@action | ||
checkWholeBorough(event) { | ||
for(const district of this.communityDistrictsByBorough[event.target.value]) { | ||
set(this.args.subscriptions, district.code, event.target.checked) | ||
} | ||
} | ||
|
||
@action | ||
closeAllAccordions(event) { | ||
$('.accordion').foundation('up', $('.accordion .accordion-content')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Route from "@ember/routing/route" | ||
import { action } from "@ember/object" | ||
import { lookupCommunityDistrict } from '../helpers/lookup-community-district'; | ||
|
||
|
||
export default class SubscribeRoute extends Route { | ||
|
||
model() { | ||
let subscriptions = {CW: false} | ||
const districts = lookupCommunityDistrict(); | ||
for (const district of districts) { | ||
subscriptions[district.code] = false | ||
} | ||
|
||
return {subscriptions, email: ""} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
// -------------------------------------------------- | ||
// Module: Subscription Form | ||
// -------------------------------------------------- | ||
|
||
div.disabled { | ||
pointer-events: none; | ||
opacity: 0.4; | ||
} | ||
|
||
.accordion-item { | ||
background-color: $white-smoke; | ||
border-radius: 12px; | ||
} | ||
|
||
.accordion-title { | ||
border: none; | ||
font-size: medium; | ||
color: $dark-gray; | ||
} | ||
|
||
.accordion-title:hover, .accordion-title:focus { | ||
background-color: transparent; | ||
} | ||
|
||
ul li.accordion-title:last-child { | ||
border-bottom: 5px; | ||
} | ||
|
||
.accordion-content { | ||
border: none; | ||
background-color: $white; | ||
} | ||
|
||
input[type=checkbox] { | ||
accent-color: $dcp-orange; | ||
width: 20px; | ||
height: 20px; | ||
} | ||
|
||
.subscribe-input-group { | ||
display: flex; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
|
||
label { | ||
padding-right: 12px; | ||
align-content: center; | ||
} | ||
|
||
Input { | ||
border-radius: 12px; | ||
} | ||
} | ||
|
||
.subscribe-container { | ||
background-color: $white; | ||
padding-top: 3rem; | ||
|
||
@include breakpoint(medium) { | ||
padding-top: 4rem; | ||
} | ||
} | ||
|
||
.subscribe-section { | ||
padding-bottom: 3.25rem; | ||
|
||
@include breakpoint(medium) { | ||
padding-bottom: 4rem; | ||
} | ||
} | ||
|
||
.subscribe-footer { | ||
h5 { | ||
font-size: 1.25rem; | ||
margin: 0 0 .75rem 0; | ||
} | ||
|
||
p { | ||
margin-bottom: .75rem; | ||
} | ||
} | ||
|
||
.district-selection { | ||
ul { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 24px; | ||
|
||
&:not(:last-of-type) { | ||
margin-bottom: 2.25rem; | ||
@include breakpoint(medium) { | ||
margin-bottom: 1.5rem; | ||
} | ||
} | ||
} | ||
|
||
li.accordion-item { | ||
border-radius: 0; | ||
background-color: transparent; | ||
|
||
> a.accordion-title { | ||
border-radius: 12px; | ||
background-color: #f1f2f4; | ||
} | ||
|
||
> div.accordion-content { | ||
background-color: $white; | ||
padding: 1.5rem 0 0 0; | ||
|
||
|
||
> div { | ||
display: flex; | ||
flex-wrap: wrap; | ||
> div { | ||
display: inline-flex; | ||
align-items: center; | ||
width: 100%; | ||
@include breakpoint(medium) { | ||
width: 20%; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
input { | ||
margin: 0; | ||
} | ||
|
||
li:last-child:not(.is-active)>.accordion-title { | ||
border-bottom: none; | ||
} | ||
|
||
li:last-child>.accordion-content:last-child { | ||
border-bottom: none; | ||
} | ||
} | ||
|
||
.button.primary { | ||
border-radius: 12px; | ||
padding-top: 20px; | ||
padding-bottom: 20px; | ||
padding-right: 40px; | ||
padding-left: 40px; | ||
} | ||
|
||
.update-type-section { | ||
display: flex; | ||
flex-direction: column; | ||
ul { | ||
margin-bottom: 0px; | ||
margin-left: 0px; | ||
list-style-type: none; | ||
} | ||
.update-type-question { | ||
padding-left: 0px | ||
} | ||
} | ||
|
||
.update-type-item { | ||
display: flex; | ||
flex-direction: row; | ||
margin-top: 1.5rem | ||
} | ||
|
||
.update-type-label { | ||
padding-left: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{yield}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<form> | ||
|
||
{{yield}} | ||
<div class="subscribe-section"> | ||
<div class="update-type-section"> | ||
<div class="update-type-question">Which would you like to receive updates for?</div> | ||
|
||
<ul> | ||
<li> | ||
<div class="update-type-item"> | ||
<Input @id="city-wide-checkbox" @type="checkbox" @checked={{isCityWide}}/> | ||
<div class="update-type-label"> | ||
<label for="city-wide-checkbox">Citywide Updates</label> | ||
<span class="text-small">You'll receive an email for all citywide projects, which are projects that aren’t | ||
associated with any CD.</span> | ||
</div> | ||
</div> | ||
</li> | ||
<li> | ||
<div class="update-type-item"> | ||
<Input @id="community-district-checkbox" @type="checkbox" @checked={{isCommunityDistrict}} | ||
{{on "change" this.closeAllAccordions}}/> | ||
<div class="update-type-label"> | ||
<label for="community-district-checkbox">Community District (CD) Updates</label> | ||
<span class="text-small">You'll receive an email for projects from all CDs you have selected.</span> | ||
</div> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<div class="subscribe-section"> | ||
<div class="district-selection"> | ||
<div class={{if this.isCommunityDistrict "" "disabled" }}> | ||
<h5>If you chose CD Updates, please select which community districts you would like to receive updates | ||
for:</h5> | ||
<p>You can find the Community District to any New York City address <a | ||
href="https://zola.planning.nyc.gov/">here</a>.</p> | ||
{{#initialize_foundation}} | ||
{{#each-in this.communityDistrictsByBorough as |borough districts|}} | ||
<ul class="accordion" id="foo" data-accordion data-multi-expand="true" data-allow-all-closed="true"> | ||
<li class="accordion-item accordionmenu-item-background" data-accordion-item> | ||
<a href="#" class="accordion-title">{{borough}}</a> | ||
<div class="accordion-content" data-tab-content> | ||
<div> | ||
<div> | ||
<Input id="all-brooklyn" type="checkbox" @value={{borough}} {{on "change" this.checkWholeBorough}} /><label | ||
for="all-brooklyn">Select all</label> | ||
</div> | ||
{{#each districts as |district| }} | ||
<div> | ||
<Input id={{district.code}} @type="checkbox" @checked={{ get this.args.subscriptions district.code }} /> | ||
<label | ||
for={{district.code}}>District {{district.num}}</label> | ||
</div> | ||
{{/each}} | ||
</div> | ||
</div> | ||
</li> | ||
</ul> | ||
{{/each-in}} | ||
{{/initialize_foundation}} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="subscribe-section"> | ||
<a class="button primary no-margin disabled" type="submit" href="">Subscribe</a> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class="cell subscribe-container"> | ||
<div class="grid-container"> | ||
<div class="grid-x grid-padding-x grid-padding-y align-middle" style="justify-content: center;"> | ||
<div class="cell large-8 subscribe-container"> | ||
<div class="subscribe-section"> | ||
<h1 class="header-xxl dcp-orange">Subscribe to ZAP Updates</h1> | ||
<span class="text-small">Get updated on milestones for all projects in any community district (CD) by signing up to receive | ||
emails on Zoning Application Portal.</span> | ||
</div> | ||
<SubscriptionForm @subscriptions={{this.model.subscriptions}}> | ||
<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}}/> | ||
</div> | ||
</div> | ||
</SubscriptionForm> | ||
<div class="subscribe-footer"> | ||
<h5>Cancel Your Subscription</h5> | ||
<p class="text-small">You can unsubscribe to ZAP emails at the end of any email updates you receive.</p> | ||
|
||
<h5>Definition of ZAP Updates</h5> | ||
<p class="text-small">Refer to <a href="/statuses">this page</a> for more information about what type of updates you will | ||
be receiving.</p> | ||
|
||
<h5>Privacy Policy</h5> | ||
<p class="text-small">For more information, refer to NYC.gov Privacy Policy and Terms of Use.</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more in line with previous usage and more performant if you put this in the helper.