-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/nonprofit form error message (#514)
* Node version fixed * Remove package-lock.json * package-lock.json removed * Google ads conversion tracking second iteration. * Preview param bug fix * feature(application): add flash messages partial * fix(add nonprofit): add model validations, remove reload meta tag, disable turbo in form, and improve form markup. * fix(add a nonprofit): create separate routes for each type of message * fix(add a nonprofit): create separate controllers and views for each type of message * fix(add a nonprofit): disable globally links to message form. * refactor(messages): rename controllers, views, and path helpers --------- Co-authored-by: Alan Soto <[email protected]>
- Loading branch information
1 parent
91366ec
commit 676812f
Showing
14 changed files
with
173 additions
and
101 deletions.
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
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,2 @@ | ||
class ContactMessagesController < NonprofitRequestsController | ||
end |
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
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,11 @@ | ||
import { Controller } from '@hotwired/stimulus' | ||
|
||
export default class extends Controller { | ||
static values = { targetUrls: Array } | ||
|
||
disableTurboForTargetUrls(event) { | ||
if (this.targetUrlsValue.includes(event.detail.url)) { | ||
event.preventDefault(); | ||
} | ||
} | ||
} |
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,54 @@ | ||
.main.flex.flex-col.items-center | ||
h2 class="pb-4 text-2xl font-bold text-center pt-6 md:pt-16 md:mt-2 md:pb-9 text-gray-3" | ||
| Get in Touch | ||
|
||
p class="max-w-lg px-8 mx-auto text-center pb-7 sm:text-lg sm:pb-9 text-gray-3" | ||
| Send us a message and we'll get back to you within 3-5 business days. | ||
|
||
div class="md:hidden -z-1" | ||
div class="absolute top-0 left-0 -z-1" | ||
= inline_svg_tag 'mob-blur-left-contact.svg', class:"w-10/12 xs:w-full" | ||
div class="absolute top-0 right-0 -z-1" | ||
= inline_svg_tag 'mob-blur-right-contact.svg', size:"169*248" | ||
|
||
div class="hidden md:flex" | ||
div class="absolute top-0 left-0 pl-20 lg:pl-32 -z-1 xl:pl-80" | ||
= inline_svg_tag 'desk-blur-left-contact.svg', size:"523*419" | ||
div class="absolute top-0 inset-x-1/2 -z-1" | ||
= inline_svg_tag 'desk-blur-right-contact.svg', size:"258*248" | ||
|
||
= form_with model: @message, url: create_contact_message_path, method: :post, data: { controller: 'contact-form', "turbo": false} do |f| | ||
.c-form class="gap-6 pb-11 md:pb-36" | ||
- if @message.errors.any? | ||
div class="w-full" | ||
p class="text-red-500 italic font-semibold" | ||
| Please review the problems below: | ||
ul | ||
- @message.errors.full_messages.each do |message| | ||
li class="text-red-500 text-sm" | ||
= "- #{message}" | ||
div class="w-full" | ||
= f.label :name, "*Name" | ||
= f.text_field :name, class:"c-input", required: true | ||
div class="w-full" | ||
= f.label :email, "*Email" | ||
= f.email_field :email, class:"c-input", required: true | ||
div class="w-full" | ||
= f.label :phone | ||
= f.telephone_field :phone, class: "c-input" | ||
div class="w-full" | ||
= f.label :subject, "*Subject" | ||
= f.select :subject,\ | ||
[['I want to add a nonprofit to Giving Connection.', '1'],['I want to claim ownership of a nonprofit profile on Giving Connection.', '2'], ['Other', '3']],\ | ||
{include_blank: "Select a subject"}, {class: "c-input pr-7 bg-white", required: true, data: { action: "change->contact-form#subjectSelected",'contact-form-target': 'subject'}} | ||
|
||
div class="w-full" | ||
= f.label :content, "*Message" | ||
= f.text_area :content, class:"c-input h-40", required: true, data: { 'contact-form-target': 'message'} | ||
// Honeypot | ||
= invisible_captcha :street, :message | ||
div class="w-full" | ||
= recaptcha_tags | ||
|
||
div class="mt-3" | ||
= f.submit "Send message", class:"c-button" |
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
This file was deleted.
Oops, something went wrong.
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,76 @@ | ||
.main.flex.flex-col.items-center | ||
h2 class="pb-4 text-2xl font-bold text-center pt-6 md:pt-16 md:mt-2 md:pb-9 text-gray-3" | ||
| Add or Claim a Nonprofit | ||
|
||
p class="max-w-2xl px-8 mx-auto text-center pb-7 sm:text-lg sm:pb-9 text-gray-3" | ||
| Giving Connection is a platform designed to connect people with nonprofits in their communities. | ||
p class="max-w-2xl px-8 mx-auto text-center pb-7 sm:text-lg sm:pb-9 text-gray-3" | ||
| In order to create a nonprofit profile that is listed in Giving Connection's search results, a representative from your nonprofit should fill out the following form. | ||
p class="max-w-2xl px-8 mx-auto text-center pb-7 sm:text-lg sm:pb-9 text-gray-3" | ||
| After we verify the nonprofit organization, we will contact the representative listed below to set up an account. You should expect to hear back from us within 3-5 business days. | ||
|
||
div class="md:hidden -z-1" | ||
div class="absolute top-0 left-0 -z-1" | ||
= inline_svg_tag 'mob-blur-left-contact.svg', class:"w-10/12 xs:w-full" | ||
div class="absolute top-0 right-0 -z-1" | ||
= inline_svg_tag 'mob-blur-right-contact.svg', size:"169*248" | ||
|
||
div class="hidden md:flex" | ||
div class="absolute top-0 left-0 pl-20 lg:pl-32 -z-1 xl:pl-80" | ||
= inline_svg_tag 'desk-blur-left-contact.svg', size:"523*419" | ||
div class="absolute top-0 inset-x-1/2 -z-1" | ||
= inline_svg_tag 'desk-blur-right-contact.svg', size:"258*248" | ||
|
||
= form_with model: @message, url: create_nonprofit_request_path, method: :post, data: { controller: 'contact-form', "turbo": false} do |f| | ||
.c-form class="gap-6 pb-11 md:pb-36" | ||
- if @message.errors.any? | ||
div class="w-full" | ||
p class="text-red-500 italic font-semibold" | ||
| Please review the problems below: | ||
ul | ||
- @message.errors.full_messages.each do |message| | ||
li class="text-red-500 text-sm" | ||
= "- #{message}" | ||
div class="w-full" | ||
= f.label :name, "*Name" | ||
= f.text_field :name, class:"c-input", required: true | ||
div class="w-full" | ||
= f.label :email, "*Email" | ||
= f.email_field :email, class:"c-input", required: true | ||
div class="w-full" | ||
= f.label :phone | ||
= f.telephone_field :phone, class: "c-input" | ||
div class="w-full" | ||
= f.label :subject, "*Subject" | ||
= f.select :subject,\ | ||
[['I want to add a nonprofit to Giving Connection.', '1'],['I want to claim ownership of a nonprofit profile on Giving Connection.', '2'], ['Other', '3']],\ | ||
{include_blank: "Select a subject"}, {class: "c-input pr-7 bg-white", required: true, data: { action: "change->contact-form#subjectSelected",'contact-form-target': 'subject'}} | ||
|
||
div class="w-full" | ||
= f.label :organization_name, "*Organization Name" | ||
= f.text_field :organization_name, class:"c-input", required: true | ||
div class="w-full" | ||
= f.label :organization_website, "Organization Website" | ||
= f.text_field :organization_website, class:"c-input", placeholder:"Your Website" | ||
div class="w-full" | ||
= f.label :organization_ein, "Organization EIN" | ||
= f.text_field :organization_ein, class:"c-input", placeholder:"Your Organization EIN" | ||
div class="w-full" | ||
= f.label :profile_admin_name, "*Profile Admin Name" | ||
p class="mt-1.5 text-xs leading-normal" | ||
| Your profile admin is the person who will be updating the page information. | ||
= f.text_field :profile_admin_name, class:"c-input", required: true | ||
div class="w-full" | ||
= f.label :profile_admin_email, "*Profile Admin Email" | ||
= f.text_field :profile_admin_email, class:"c-input", required: true | ||
|
||
div class="w-full" | ||
= f.label :content, "*Message" | ||
= f.text_area :content, class:"c-input h-40", data: { 'contact-form-target': 'message'}, required: true | ||
// Honeypot | ||
= invisible_captcha :street, :message | ||
div class="w-full" | ||
= recaptcha_tags | ||
|
||
div class="mt-3" | ||
= f.submit "Send message", class:"c-button" |
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,3 @@ | ||
<% flash.each do |type, message| %> | ||
<%= render Alert::Component.new(type: type, message: message) %> | ||
<% end %> |
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