From 4302bf9b7cbd3be3b936a23ff270e79385b94eee Mon Sep 17 00:00:00 2001 From: Todd Loupe Date: Sun, 29 Apr 2018 07:20:46 +0000 Subject: [PATCH 1/4] Added connectivity to the job form with oppcenters --- app.rb | 7 ++- db/schema.rb | 7 +++ db/schema.sql | 22 ++++++++- templates/jobsystem.mustache | 90 +++++++++++++++++++++++++----------- templates/manage.mustache | 8 ++++ views/jobsystem.rb | 17 ++++++- 6 files changed, 119 insertions(+), 32 deletions(-) diff --git a/app.rb b/app.rb index 9a37775..7e5b758 100644 --- a/app.rb +++ b/app.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index f0ae651..55894f1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/db/schema.sql b/db/schema.sql index e2c43a5..3aee7e9 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -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 ); @@ -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: -- @@ -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: -- diff --git a/templates/jobsystem.mustache b/templates/jobsystem.mustache index b6324c6..8f3d047 100644 --- a/templates/jobsystem.mustache +++ b/templates/jobsystem.mustache @@ -6,10 +6,10 @@ +

Job System Sign-up Form

- Whats your name? *
How did you learn about us? * @@ -37,18 +37,18 @@ Opportunity Center is the best match for you Which of these apply to you? *

- I am between the ages of 18-24
- I am a Veteran
- I don't always have a way to get to and from work
- I am homeless or staying with someone temporarily
- I don't have a driver's license
- I don't have a state-issued I.D.
- I am disabled
- I need childcare
- I have an open criminal charge
- I have been previously incarcerated
- I am using drugs and want to get help
- None of these apply to me

+ I am between the ages of 18-24
+ I am a Veteran
+ I don't always have a way to get to and from work
+ I am homeless or staying with someone temporarily
+ I don't have a driver's license
+ I don't have a state-issued I.D.
+ I am disabled
+ I need childcare
+ I have an open criminal charge
+ I have been previously incarcerated
+ I am using drugs and want to get help
+ None of these apply to me

Which neighborhood is closest to where you live? *


-
+
@@ -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 += - "

Total Community Action (TCA)
1420 South Jeff Davis Pkwy New Orleans, La 70125
(504) 872-0334
James Cary
Email: James.Carey@tca-NOLA.org
Sidney Monroe
Email: Sidney.Monroe@tca-nola.org

"; + 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 += - "

Goodwill Industries
3400 Tulane Avenue New Orleans
Jada Boudoin
Telephone: (504) 456-3933
Email: jboudoin@goodwillno.org

"; - } - } else { - if (document.getElementById("opportunity_center").innerHTML.indexOf('Tucker') <= -1) { - document.getElementById("opportunity_center").innerHTML += - "

JOB1 Business and Career Solutions Center
Cassandra Tucker, Administrative Data Specialist
3400 Tulane Avenue, New Orleans
(504) 658-4500 – Main
(504) 658-4571 – Direct
crtucker@nola.gov

"; + } + // 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 += "

{{name}}
{{address}}
{{phone}}
{{contact}}
{{email}}

"; + form_inputs += ""; + {{/opportunity.tca}} + break; + case 'goodwill': + {{#opportunity.goodwill}} + display_content += "

{{name}}
{{address}}
{{phone}}
{{contact}}
{{email}}

"; + form_inputs += ""; + {{/opportunity.goodwill}} + break; + case 'job1': + {{#opportunity.job1}} + display_content += "

{{name}}
{{address}}
{{phone}}
{{contact}}
{{email}}

"; + form_inputs += ""; + {{/opportunity.job1}} + break; } } + // update elements + document.getElementById("opportunity_center").innerHTML = display_content + form_inputs; } diff --git a/templates/manage.mustache b/templates/manage.mustache index ab85a11..04ebbea 100644 --- a/templates/manage.mustache +++ b/templates/manage.mustache @@ -15,6 +15,14 @@ {{#opportunity}}

{{> partials/opportunity_center_field }}

{{/opportunity}} + + {{^ forExample}} + for example, on this page, the definition doesn't exist so this should display + {{/ forExample}} + + {{# forExample}} + this should not display + {{/forExample}}
diff --git a/views/jobsystem.rb b/views/jobsystem.rb index 7c9478e..34de6ad 100644 --- a/views/jobsystem.rb +++ b/views/jobsystem.rb @@ -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 From f7e8d38bf15e03d89df589a3401173bf4f138957 Mon Sep 17 00:00:00 2001 From: Todd Loupe Date: Sun, 29 Apr 2018 07:28:06 +0000 Subject: [PATCH 2/4] fixed temp changes from manage page --- templates/manage.mustache | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/templates/manage.mustache b/templates/manage.mustache index 04ebbea..0718bae 100644 --- a/templates/manage.mustache +++ b/templates/manage.mustache @@ -12,17 +12,6 @@

Update Opportunity Center Information:

- {{#opportunity}} -

{{> partials/opportunity_center_field }}

- {{/opportunity}} - - {{^ forExample}} - for example, on this page, the definition doesn't exist so this should display - {{/ forExample}} - - {{# forExample}} - this should not display - {{/forExample}}
From 8b46cface74e1ff1510d2e7b3ec0bbc6b1f7d64d Mon Sep 17 00:00:00 2001 From: Todd Loupe Date: Sun, 29 Apr 2018 07:31:06 +0000 Subject: [PATCH 3/4] fix temp manage page issues --- templates/manage.mustache | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/manage.mustache b/templates/manage.mustache index 0718bae..3632c6c 100644 --- a/templates/manage.mustache +++ b/templates/manage.mustache @@ -11,7 +11,10 @@

Update Opportunity Center Information:

- + + {{#opportunity}} +

{{> partials/opportunity_center_field }}

+ {{/opportunity}}
@@ -31,6 +34,4 @@
  • Every trait number in the "trait" column should be an id in the "traits" TAB.
  • For more info, see documentation about the spreadsheet.

    - - \ No newline at end of file + \ No newline at end of file From ac2554a707e9b43009e1f1ab06927182334161fd Mon Sep 17 00:00:00 2001 From: Todd Loupe Date: Sun, 29 Apr 2018 07:34:24 +0000 Subject: [PATCH 4/4] fixed temp again --- templates/manage.mustache | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/manage.mustache b/templates/manage.mustache index 3632c6c..ab85a11 100644 --- a/templates/manage.mustache +++ b/templates/manage.mustache @@ -11,7 +11,7 @@

    Update Opportunity Center Information:

    - + {{#opportunity}}

    {{> partials/opportunity_center_field }}

    {{/opportunity}} @@ -34,4 +34,6 @@
  • Every trait number in the "trait" column should be an id in the "traits" TAB.
  • For more info, see documentation about the spreadsheet.

    - \ No newline at end of file + + \ No newline at end of file