diff --git a/app/models/user.rb b/app/models/user.rb index 8b27444db..c4f8f16c9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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", diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index fa01ea2f7..998477cea 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -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 diff --git a/app/views/users/_mentorship.html.erb b/app/views/users/_mentorship.html.erb new file mode 100644 index 000000000..b5a33510b --- /dev/null +++ b/app/views/users/_mentorship.html.erb @@ -0,0 +1,28 @@ +

This is currently a *beta program* for community members to help one another.

+

If you're interested in participating as a mentor, mentee, or both, please indicate below and we will be in contact via email.

+ +<%= form_for(@user) do |f| %> +

Offering Help:

+
+ <%= f.label :offering_mentorship, "I'd like to be a mentor!"%> + <%= f.check_box :offering_mentorship %> +
+
+ <%= f.label :mentor_description, "How can you help?" %> + <%= f.text_area :mentor_description, placeholder: "Languages, subject preference, career advice, etc.", maxlength: 500 %> +
+

Seeking Help:

+
+ <%= f.label :seeking_mentorship, "I'm looking for a mentor!"%> + <%= f.check_box :seeking_mentorship %> +
+
+ <%= f.label :mentee_description, "How can we help?" %> + <%= f.text_area :mentee_description, placeholder: "Languages, subject preference, career advice, etc.", maxlength: 500 %> +
+
+ + <%= f.hidden_field :tab, value: @tab %> + <%= f.submit "SUBMIT", class: "cta" %> +
+<% end %> \ No newline at end of file diff --git a/db/migrate/20180705194536_add_mentorship_columns_to_user.rb b/db/migrate/20180705194536_add_mentorship_columns_to_user.rb new file mode 100644 index 000000000..6ffa18b24 --- /dev/null +++ b/db/migrate/20180705194536_add_mentorship_columns_to_user.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index ac7272c38..121293304 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"