-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish user edit, update, index, and destroy actions
- Loading branch information
Showing
24 changed files
with
398 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
session:<%= debug session[:return_to] %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<li> | ||
<%= gravatar_for user, size: 52 %> | ||
<%= link_to user.name, user %> | ||
<% if current_user.admin? && !current_user?(user) %> | ||
| <%= link_to "delete", user, method: :delete, | ||
data: { confirm: "You sure?" } %> | ||
<% end %> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<% provide(:title, "Edit user") %> | ||
<h1>Update your profile</h1> | ||
|
||
<div class="row"> | ||
<div class="span6 offset3"> | ||
<%= form_for(@user) do |f| %> | ||
<%= render 'shared/error_messages' %> | ||
|
||
<%= f.label :name %> | ||
<%= f.text_field :name %> | ||
|
||
<%= f.label :email %> | ||
<%= f.text_field :email %> | ||
|
||
<%= f.label :password %> | ||
<%= f.password_field :password %> | ||
|
||
<%= f.label :password_confirmation, "Confirm Password" %> | ||
<%= f.password_field :password_confirmation %> | ||
|
||
<%= f.submit "Save changes", class: "btn btn-large btn-primary" %> | ||
<% end %> | ||
<%= gravatar_for @user %> | ||
<a href="http://gravatar.com/emails">change</a> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<% provide(:title, 'All users') %> | ||
<h1>All users</h1> | ||
<%= will_paginate %> | ||
<ul class="users"> | ||
<% @users.each do |user| %> | ||
<%= render user %> | ||
<% end %> | ||
</ul> | ||
<%= will_paginate %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddAdminToUsers < ActiveRecord::Migration | ||
def change | ||
add_column :users, :admin, :boolean, default: false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace :db do | ||
desc "Fill database with sample data" | ||
task populate: :environment do | ||
User.create!(name: "Example User", | ||
email: "[email protected]", | ||
password: "foobar", | ||
password_confirmation: "foobar", | ||
admin: true) | ||
99.times do |n| | ||
name = Faker::Name.name | ||
email = "example-#{n+1}@railstutorial.org" | ||
password = "password" | ||
User.create!(name: name, | ||
email: email, | ||
password: password, | ||
password_confirmation: password) | ||
end | ||
end | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
FactoryGirl.define do | ||
factory :user do | ||
name "Michael Hartl" | ||
email "michael@example.com" | ||
sequence(:name) { |n| "Person #{n}" } | ||
sequence(:email) { |n| "person_#{n}@example.com" } | ||
password "foobar" | ||
password_confirmation "foobar" | ||
|
||
factory :admin do | ||
admin true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.