From 0fe499b701d8b0c69114945c09c3280934729077 Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Thu, 24 Jan 2013 02:35:14 -0500 Subject: [PATCH] Cleaned up User admin index --- app/controllers/users_controller.rb | 2 +- app/models/user.rb | 2 +- app/views/users/index.html.erb | 18 +++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ccd6d01..796ac9f 100755 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -7,7 +7,7 @@ class UsersController < ApplicationController # GET /users # GET /users.json def index - @users = User.all + @users = Kaminari.paginate_array(User.all).page(params[:page]).per(10) respond_to do |format| format.html # index.html.erb diff --git a/app/models/user.rb b/app/models/user.rb index c0c59b4..9d7d27a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -10,7 +10,7 @@ class User < ActiveRecord::Base validates :username, :presence => true, :uniqueness => true # Setup accessible (or protected) attributes for your model - attr_accessible :username, :email, :password, :password_confirmation, :remember_me + attr_accessible :username, :email, :password, :password_confirmation, :remember_me, :is_admin has_many :topics, :dependent => :destroy has_many :posts, :dependent => :destroy diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index df56dec..90aeca7 100755 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,8 +1,11 @@ -

All Users

+
+
+

All Users

+
- - - +
+ + @@ -28,9 +31,10 @@ <% end %> + - -
Username Email Login Count<%= link_to "Delete", user, :method => :delete, :confirm => "Are you sure?" %>
- +
<%= paginate(@users)%>

<%= link_to "New User", new_user_path %>

+
+