Collect Mentorship Info (#551)

* add basic mentorship info

* add missing comma

* migrate test env
This commit is contained in:
Jess Lee 2018-07-06 10:56:24 -04:00 committed by Ben Halpern
parent 926991f5fc
commit 6b53c01762
5 changed files with 47 additions and 2 deletions

View file

@ -73,7 +73,7 @@ class User < ApplicationRecord
validates :website_url, :employer_name, :employer_url,
:employment_title, :education, :location,
length: { maximum: 100 }
validates :mostly_work_with, :currently_learning, :currently_hacking_on, :available_for,
validates :mostly_work_with, :currently_learning, :currently_hacking_on, :available_for, :mentee_description, :mentor_description,
length: { maximum: 500 }
validate :conditionally_validate_summary
validate :validate_feed_url
@ -296,6 +296,7 @@ class User < ApplicationRecord
def settings_tab_list
tab_list = ["Profile",
"Mentorship",
"Integrations",
"Notifications",
"Publishing from RSS",

View file

@ -66,8 +66,11 @@ class UserPolicy < ApplicationPolicy
location
looking_for_work
looking_for_work_publicly
mentee_description
mentor_description
mostly_work_with
name
offering_mentorship
permit_adjacent_sponsors
password
password_confirmation
@ -77,6 +80,7 @@ class UserPolicy < ApplicationPolicy
prefer_language_it
prefer_language_ja
profile_image
seeking_mentorship
summary
text_color_hex
username

View file

@ -0,0 +1,28 @@
<h2>This is currently a <strong>*beta program*</strong> for community members to help one another.</h2>
<p>If you're interested in participating as a mentor, mentee, or both, please indicate below and we will be in contact via email.</p>
<%= form_for(@user) do |f| %>
<h3>Offering Help:</h3>
<div class="field checkbox-label-first">
<%= f.label :offering_mentorship, "I'd like to be a mentor!"%>
<%= f.check_box :offering_mentorship %>
</div>
<div class="field">
<%= f.label :mentor_description, "How can you help?" %>
<%= f.text_area :mentor_description, placeholder: "Languages, subject preference, career advice, etc.", maxlength: 500 %>
</div>
<h3>Seeking Help:</h3>
<div class="field checkbox-label-first">
<%= f.label :seeking_mentorship, "I'm looking for a mentor!"%>
<%= f.check_box :seeking_mentorship %>
</div>
<div class="field">
<%= f.label :mentee_description, "How can we help?" %>
<%= f.text_area :mentee_description, placeholder: "Languages, subject preference, career advice, etc.", maxlength: 500 %>
</div>
<div class="field">
<label></label>
<%= f.hidden_field :tab, value: @tab %>
<%= f.submit "SUBMIT", class: "cta" %>
</div>
<% end %>

View file

@ -0,0 +1,8 @@
class AddMentorshipColumnsToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :offering_mentorship, :boolean
add_column :users, :seeking_mentorship, :boolean
add_column :users, :mentor_description, :text
add_column :users, :mentee_description, :text
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180703142743) do
ActiveRecord::Schema.define(version: 20180705194536) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -658,9 +658,12 @@ ActiveRecord::Schema.define(version: 20180703142743) do
t.boolean "looking_for_work", default: false
t.boolean "looking_for_work_publicly", default: false
t.datetime "membership_started_at"
t.text "mentee_description"
t.text "mentor_description"
t.integer "monthly_dues", default: 0
t.string "mostly_work_with"
t.string "name"
t.boolean "offering_mentorship"
t.string "old_old_username"
t.string "old_username"
t.datetime "onboarding_package_form_submmitted_at"
@ -682,6 +685,7 @@ ActiveRecord::Schema.define(version: 20180703142743) do
t.boolean "saw_onboarding", default: true
t.integer "score", default: 0
t.string "secret"
t.boolean "seeking_mentorship"
t.string "shipping_address"
t.string "shipping_address_line_2"
t.string "shipping_city"