Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Oppcenter job #60

Merged
merged 4 commits into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,18 @@ def worksheet


post '/contact' do
=begin
#for the spreadsheet, disabling this for now

begin
new_row = [params["first_name"], params["last_name"],params["best_way"],params["email_submission"], params["phone_submission"],params["text_submission"], params["referral"], params["neighborhood"], params["young_adult"], params["veteran"], params["no_transportation"],
params["homeless"], params["no_drivers_license"], params["no_state_id"], params["disabled"], params["childcare"], params["criminal"], params["previously_incarcerated"], params["using_drugs"], params["none"],params["resume"]]
begin
worksheet.insert_rows(worksheet.num_rows + 1, [new_row])
worksheet.save
mustache :jobsystem
end

end
=end
end


Expand Down
7 changes: 7 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@
String :address, :text=>true, :null=>false
String :phone, :text=>true, :null=>false
String :email, :text=>true, :null=>false
String :contact, :text=>true, :null=>false
end

create_table(:schema_info) do
Integer :version, :default=>0, :null=>false
end

create_table(:schema_seeds) do
String :filename, :text=>true, :null=>false

primary_key [:filename]
end

create_table(:traits) do
primary_key :id
String :name, :text=>true, :null=>false
Expand Down
22 changes: 21 additions & 1 deletion db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ CREATE TABLE opp_centers (
name text NOT NULL,
address text NOT NULL,
phone text NOT NULL,
email text NOT NULL
email text NOT NULL,
contact text NOT NULL
);


Expand Down Expand Up @@ -180,6 +181,17 @@ CREATE TABLE schema_info (

ALTER TABLE public.schema_info OWNER TO todd;

--
-- Name: schema_seeds; Type: TABLE; Schema: public; Owner: todd; Tablespace:
--

CREATE TABLE schema_seeds (
filename text NOT NULL
);


ALTER TABLE public.schema_seeds OWNER TO todd;

--
-- Name: traits; Type: TABLE; Schema: public; Owner: todd; Tablespace:
--
Expand Down Expand Up @@ -274,6 +286,14 @@ ALTER TABLE ONLY opp_centers
ADD CONSTRAINT opp_centers_pkey PRIMARY KEY (id);


--
-- Name: schema_seeds_pkey; Type: CONSTRAINT; Schema: public; Owner: todd; Tablespace:
--

ALTER TABLE ONLY schema_seeds
ADD CONSTRAINT schema_seeds_pkey PRIMARY KEY (filename);


--
-- Name: traits_pkey; Type: CONSTRAINT; Schema: public; Owner: todd; Tablespace:
--
Expand Down
90 changes: 62 additions & 28 deletions templates/jobsystem.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
</div>
</footer>

<form id="opp-form-element" method="post" action="/contact" onsubmit="alert('Thank you for submitting!')">
<section id="opp-form">
<section class="no-print">
<h1>Job System Sign-up Form</h1>
<form method="post" action="/contact" onsubmit="alert('Thank you for submitting!')">
<strong>Whats your name? *</strong>
<div style="float: right">
<strong> How did you learn about us? * </strong>
Expand Down Expand Up @@ -37,18 +37,18 @@
Opportunity Center is the best match for you</h2>
<strong>Which of these apply to you? *</strong> </br> </br>
<div id="attributes">
<input type="checkbox" id="young" name="young_adult" value="true" onclick="opportunityCenter(young_adult)">I am between the ages of 18-24</br>
<input type="checkbox" id="veteran" name="veteran" value="true" onclick="opportunityCenter(veteran)">I am a Veteran</br>
<input type="checkbox" id="no_transportation" name="no_transportation" value="true" onclick="opportunityCenter(no_transportation);">I don't always have a way to get to and from work</br>
<input type="checkbox" id="homeless" name="homeless" value="true" onclick="opportunityCenter(homeless)">I am homeless or staying with someone temporarily</br>
<input type="checkbox" id="no_drivers_license" name="no_drivers_license" value="true" onclick="opportunityCenter(no_drivers_license)">I don't have a driver's license</br>
<input type="checkbox" id="no_state_id" name="no_state_id" value="true" onclick="opportunityCenter(no_state_id)">I don't have a state-issued I.D.</br>
<input type="checkbox" id="disabled" name="disabled" value="true" onclick="opportunityCenter(disabled)">I am disabled</br>
<input type="checkbox" id="childcare" name="childcare" value="true" onclick="opportunityCenter(childcare)">I need childcare</br>
<input type="checkbox" id ="criminal" name="criminal" value="true" onclick="opportunityCenter(criminal)">I have an open criminal charge</br>
<input type="checkbox" id="previously_incarcerated" name="previously_incarcerated" value="true" onclick="opportunityCenter(previously_incarcerated)">I have been previously incarcerated</br>
<input type="checkbox" id="using_drugs" name="using_drugs" value="true" onclick="opportunityCenter(using_drugs)">I am using drugs and want to get help</br>
<input type="checkbox" id="none" name="none" value="true" onclick="opportunityCenter(none)">None of these apply to me</br> </br>
<input type="checkbox" id="young" name="young_adult" value="true" onclick="opportunityCenter(event)">I am between the ages of 18-24</br>
<input type="checkbox" id="veteran" name="veteran" value="true" onclick="opportunityCenter(event)">I am a Veteran</br>
<input type="checkbox" id="no_transportation" name="no_transportation" value="true" onclick="opportunityCenter();">I don't always have a way to get to and from work</br>
<input type="checkbox" id="homeless" name="homeless" value="true" onclick="opportunityCenter(event)">I am homeless or staying with someone temporarily</br>
<input type="checkbox" id="no_drivers_license" name="no_drivers_license" value="true" onclick="opportunityCenter(event)">I don't have a driver's license</br>
<input type="checkbox" id="no_state_id" name="no_state_id" value="true" onclick="opportunityCenter(event)">I don't have a state-issued I.D.</br>
<input type="checkbox" id="disabled" name="disabled" value="true" onclick="opportunityCenter(event)">I am disabled</br>
<input type="checkbox" id="childcare" name="childcare" value="true" onclick="opportunityCenter(event)">I need childcare</br>
<input type="checkbox" id ="criminal" name="criminal" value="true" onclick="opportunityCenter(event)">I have an open criminal charge</br>
<input type="checkbox" id="previously_incarcerated" name="previously_incarcerated" value="true" onclick="opportunityCenter(event)">I have been previously incarcerated</br>
<input type="checkbox" id="using_drugs" name="using_drugs" value="true" onclick="opportunityCenter(event)">I am using drugs and want to get help</br>
<input type="checkbox" id="none" name="none" value="true" onclick="opportunityCenter(event)">None of these apply to me</br> </br>
</div>
<strong>Which neighborhood is closest to where you live? *</strong> </br> </br>
<select name="neighborhood" required>
Expand Down Expand Up @@ -88,9 +88,9 @@
<input type="submit" class="basic-button">
</div>
<hr>
</form>
</div>
</section>
</form>
</section>

<section class="no-print">
Expand Down Expand Up @@ -176,23 +176,57 @@
}
}

function opportunityCenter(input) {
if (input.id == "homeless" || input.id == "disabled") {
if (document.getElementById("opportunity_center").innerHTML.indexOf('Carey') <= -1) {
document.getElementById("opportunity_center").innerHTML +=
"<p>Total Community Action (TCA)</br>1420 South Jeff Davis Pkwy New Orleans, La 70125</br>(504) 872-0334</br>James Cary</br>Email: [email protected]</br>Sidney Monroe</br>Email: [email protected]</p>";
function opportunityCenter(event) {
// event.preventDefault();
var checkboxes = Array.from(document.getElementById("attributes").children)
.filter((elt) => elt.type == 'checkbox');
console.log(checkboxes);
var opp_centers = [], input = undefined;
// Check all checkboxes, and add opp centers as needed.
for (k = 0; k < checkboxes.length; k++) {
if (checkboxes[k].checked) {
switch(checkboxes[k].id) {
case 'homeless':
case 'disabled':
opp_centers.push('tca');
break;
case 'criminal':
case 'previously_incarcerated':
opp_centers.push('goodwill');
break;
default:
opp_centers.push('job1');
}
}
} else if (input.id == "criminal" || input.id == "previously_incarcerated") {
if (document.getElementById("opportunity_center").innerHTML.indexOf('Boudoin') <= -1) {
document.getElementById("opportunity_center").innerHTML +=
"<p>Goodwill Industries</br>3400 Tulane Avenue New Orleans</br>Jada Boudoin</br>Telephone: (504) 456-3933</br>Email: [email protected]</p>";
}
} else {
if (document.getElementById("opportunity_center").innerHTML.indexOf('Tucker') <= -1) {
document.getElementById("opportunity_center").innerHTML +=
"<p>JOB1 Business and Career Solutions Center</br> Cassandra Tucker, Administrative Data Specialist </br>3400 Tulane Avenue, New Orleans</br>(504) 658-4500 – Main </br>(504) 658-4571 – Direct </br> [email protected]</p>";
}
// dedupe opp_centers array
opp_centers = Array.from(new Set(opp_centers));
// construct display strings
var display_content = "", form_inputs = "";
for (var j = 0; j < opp_centers.length; j++) {
switch (opp_centers[j]) {
case 'tca':
{{#opportunity.tca}}
display_content += "<p>{{name}}</br>{{address}}</br>{{phone}}</br>{{contact}}</br>{{email}}</p>";
form_inputs += "<input type='hidden' name='{{center}}' value='{{center}}'/>";
{{/opportunity.tca}}
break;
case 'goodwill':
{{#opportunity.goodwill}}
display_content += "<p>{{name}}</br>{{address}}</br>{{phone}}</br>{{contact}}</br>{{email}}</p>";
form_inputs += "<input type='hidden' name='{{center}}' value='{{center}}'/>";
{{/opportunity.goodwill}}
break;
case 'job1':
{{#opportunity.job1}}
display_content += "<p>{{name}}</br>{{address}}</br>{{phone}}</br>{{contact}}</br>{{email}}</p>";
form_inputs += "<input type='hidden' name='{{center}}' value='{{center}}'/>";
{{/opportunity.job1}}
break;
}
}
// update elements
document.getElementById("opportunity_center").innerHTML = display_content + form_inputs;
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAKNLU54D_sMOyuyzqGxS2dYUU00GoF1fA"></script>
Expand Down
17 changes: 16 additions & 1 deletion views/jobsystem.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
require './models/oppcenter'
module WorkForwardNola
module Views
# logic for jobsystem.html/jobsystem.mustache
class JobSystem < Layout
class Jobsystem < Layout
attr_reader :title
def opportunity
oppcenters = {}
OppCenter.all.each do |oc|
oppcenters[oc.center.to_sym] = {
center: oc.center,
name: oc.name,
contact: oc.contact,
address: oc.address,
email: oc.email,
phone: oc.phone
}
end
oppcenters
end
end
end
end