Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Done with user edit/update, index, and destroy actions.
- Loading branch information
1 parent
f0840ac
commit 4506d6a
Showing
17 changed files
with
166 additions
and
10 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
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
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
<li> | |||
<%= gravatar_for user, :size => 30 %> | |||
<%= link_to user.name, user %> | |||
<% if current_user.admin? %> | |||
| <%= link_to "delete", user, :method => :delete, :confirm => "You sure?", | |||
:title => "Delete #{user.name}" %> | |||
<% 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,29 @@ | |||
<h1>Edit user</h1> | |||
|
|||
<%= form_for(@user) do |f| %> | |||
<%= render 'shared/error_messages', :object => f.object %> | |||
<div class="field"> | |||
<%= f.label :name %><br /> | |||
<%= f.text_field :name %> | |||
</div> | |||
<div class="field"> | |||
<%= f.label :email %><br /> | |||
<%= f.text_field :email %> | |||
</div> | |||
<div class="field"> | |||
<%= f.label :password %><br /> | |||
<%= f.password_field :password %> | |||
</div> | |||
<div class="field"> | |||
<%= f.label :password_confirmation, "Confirmation" %><br /> | |||
<%= f.password_field :password_confirmation %> | |||
</div> | |||
<div class="actions"> | |||
<%= f.submit "Update" %> | |||
</div> | |||
<% end %> | |||
|
|||
<div> | |||
<%= gravatar_for @user %> | |||
<a href="http://gravatar.com/emails">change</a> | |||
</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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
<h1>All users</h1> | |||
|
|||
<%= will_paginate %> | |||
|
|||
<ul class="users"> | |||
<%= render @users %> | |||
</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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
class AddAdminToUsers < ActiveRecord::Migration | |||
def self.up | |||
add_column :users, :admin, :boolean, :default => false | |||
end | |||
|
|||
def self.down | |||
remove_column :users, :admin | |||
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
namespace :db do | |||
desc "Fill database with sample data" | |||
task :populate => :environment do | |||
Rake::Task['db:reset'].invoke | |||
admin = User.create!(:name => "pankonjab", | |||
:email => "pankonjab@example.com", | |||
:password => "kljuse", | |||
:password_confirmation => "kljuse") | |||
admin.toggle!(:admin) | |||
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 | |||
|
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