Skip to content

Commit

Permalink
Adding changes to Users controller and view, and updated routes.
Browse files Browse the repository at this point in the history
  • Loading branch information
sherrimitchell committed Oct 2, 2015
1 parent 4dd106a commit 9229afb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
6 changes: 5 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class UsersController < ApplicationController

def show
@user = User.find(params[:id])
end

def new
@user = User.new
end
Expand All @@ -11,7 +16,6 @@ def create
else
flash[:error] = 'Your entry was incorrect. Please try again.'
end
render
end

private
Expand Down
23 changes: 17 additions & 6 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,33 @@
<%= f.label :first_name %>
<%= f.text_field :first_name, class: 'form-control' %>

<%= f.label :last_name %>
<%= f.label :last_name %>
<%= f.text_field :last_name, class: 'form-control' %>

<%= f.label :username %>
<%= f.text_field :username, class: 'form-control' %>

<%= f.label :email %>
<%= f.email_field :email, class: 'form-control' %>

<%= f.label :username %>
<%= f.text_field :username, class: 'form-control' %>

<%= f.label :password %>
<%= f.password_field :password, class: 'form-control' %>
<%= f.text_field :password, class: 'form-control' %>

<%= f.label :about_me %>
<%= f.text_field :about_me, class: 'form-control' %>

<%= f.label :avatar %>
<%= f.text_field :avatar, class: 'form-control' %>

<% end %>
<%= f.label :twitter %>
<%= f.text_field :twitter, class: 'form-control' %>

<%= f.label :github %>
<%= f.text_field :github, class: 'form-control' %>

<%= f.label :linkedin %>
<%= f.text_field :linkedin, class: 'form-control' %>

<%= f.submit "Save changes", class: "btn btn-primary" %>

<% end %>
5 changes: 4 additions & 1 deletion app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
"Yay! It worked."
"Yay! It worked."

<%= render "form" %>

8 changes: 6 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
# See how all your routes lay out with "rake routes".

# You can have the root of your site routed with "root"
root 'dashboard#index'

get 'users/new'
root 'dashboard#index'

get 'users/new', to: 'users#new'
post '/users', to: 'users#create'
get '/users/:id', to: 'users#show'


# Example of regular route:
# get 'products/:id' => 'catalog#view'
Expand Down

0 comments on commit 9229afb

Please sign in to comment.