Skip to content

Commit

Permalink
Add name field to user registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Hill committed Oct 21, 2013
1 parent 5afa9e8 commit bf9befc
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/users.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
6 changes: 6 additions & 0 deletions app/assets/stylesheets/users.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
body {
margin-top: 80px;
}
8 changes: 8 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

before_filter :configure_permitted_parameters, if: :devise_controller?

protected

def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :name
end
end
10 changes: 10 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class UsersController < ApplicationController

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

def poupon
end

end
2 changes: 2 additions & 0 deletions app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module UsersHelper
end
5 changes: 4 additions & 1 deletion app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>

<div><%= f.label :name %><br />
<%= f.text_field :name %></div>

<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<%= f.email_field :email, :autofocus => true %></div>

<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
Expand Down
3 changes: 3 additions & 0 deletions app/views/users/poupon.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>Grey Poupon</h1>
<h3>Get ready to spread!</h3>
<iframe width="560" height="315" src="//www.youtube.com/embed/mqIZa3PTX6c" frameborder="0" allowfullscreen></iframe>
1 change: 1 addition & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>@user.name</h1>
2 changes: 1 addition & 1 deletion config/locales/devise.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ en:
updated_not_active: "Your password was changed successfully."
registrations:
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
signed_up: "You're ready to spread."
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
Expand Down
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Mustrd::Application.routes.draw do

root to: 'users#poupon'

devise_for :users
resource :users, only: [:show]

# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
Expand Down
5 changes: 5 additions & 0 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'spec_helper'

describe UsersController do

end
2 changes: 1 addition & 1 deletion spec/features/user_feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
click_button 'Sign up'

expect(current_path).to eq root_path
expect(page).to have_css('.notice', text: 'Ready to spread, Ketchup')
expect(page).to have_css('.alert', text: "You're ready to spread.")
end

end
Expand Down
15 changes: 15 additions & 0 deletions spec/helpers/users_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'

# Specs in this file have access to a helper object that includes
# the UsersHelper. For example:
#
# describe UsersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe UsersHelper do
# pending "add some examples to (or delete) #{__FILE__}"
end
2 changes: 1 addition & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'spec_helper'

describe User do
pending "add some examples to (or delete) #{__FILE__}"
# pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit bf9befc

Please sign in to comment.