Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step 1 #23

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 19 additions & 2 deletions app/controllers/after_signup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@ class AfterSignupController < ApplicationController
before_filter :authenticate_user!

def step_0
@user_basic_profile = current_user.basic_profile
render 'step_0'
end

def step_1
@user_basic_profile = current_user.basic_profile
binding.pry
render 'step_1'
end

def step_2
@user_basic_profile = current_user.basic_profile
if @user_basic_profile.update(basic_profile_params)
render 'step_2'
end
end

def save
# save form details
redirect_to feed_path
@user_basic_profile = current_user.basic_profile
if @user_basic_profile.update(basic_profile_params)
redirect_to feed_path
end
end

private

def basic_profile_params
params.require(:basic_profile).permit(:professional_brand_statement, :passion, :want_to_try, :perfect_weekend, :strengths, :next_year_goals)
end
end
6 changes: 4 additions & 2 deletions app/controllers/linkedin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class LinkedinController < ApplicationController

def index
if LinkedinOauthSetting.find_by_user_id(current_user.id)
redirect_to "/me"
redirect_to "/feed"
else
redirect_to step_0_path
end
end

Expand All @@ -22,13 +24,13 @@ def linkedin_profile
end

def oauth_account

client = LinkedIn::Client.new(ENV['LINKED_IN_CLIENT_ID'], ENV['LINKED_IN_CLIENT_SECRET'], @@config)
pin = params[:oauth_verifier]
if pin
atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)
LinkedinOauthSetting.create!(:asecret => asecret, :atoken => atoken, :user_id => current_user.id)
end
get_basic_profile #very important
redirect_to step_1_path
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/after_signup/step_0.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
Lorem ipsum defacto...
</p>
<div>
<%= link_to 'Skip this process', '#' %>
<%= link_to 'Skip this process', step_1_path %>
<%= link_to 'Continue to LinkedIn', '/linkedin_oauth_url' %>
</div>
10 changes: 5 additions & 5 deletions app/views/after_signup/step_1.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1>My Professional Objectives</h1>

<p>
Lorem ipsum
</p>

<h3><%= link_to "Next", step_2_path %></h3>
<%= form_for @user_basic_profile do |f| %>
<%= f.label :professional_brand_statement %>
<%= f.text_field :professional_brand_statement, class: 'form-control', required: true %>
<% end %>
<h3><%= link_to "Next", step_2_path(basic_profile_params) %></h3>
15 changes: 12 additions & 3 deletions app/views/after_signup/step_2.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<h1>About Me</h1>

<p>
My personal bio
</p>
<%= form_for @user_basic_profile do |f| %>
<%= f.label :passion %>
<%= f.text_field :passion, class: 'form-control', required: true, %>
<%= f.label :want_to_try %>
<%= f.text_field :want_to_try, class: 'form-control', required: true, %>
<%= f.label :perfect_weekend %>
<%= f.text_field :perfect_weekend, class: 'form-control', required: true, %>
<%= f.label :strengths %>
<%= f.text_field :strengths, class: 'form-control', required: true, %>
<%= f.label :next_year_goals %>
<%= f.text_field :next_year_goals, class: 'form-control', required: true, %>
<% end %>

<h3><%= link_to "Done", save_profile_path %></h3>