Permalink
Browse files

add kaminari at users#index

  • Loading branch information...
1 parent 60554de commit c5090a466c8a68f0c47629e564a34da5667fbef0 @banyan committed Feb 28, 2012
View
@@ -7,6 +7,7 @@ gem 'mysql2'
gem 'rspec-rails'
gem 'prefetch-rspec'
gem 'jquery-rails'
+gem 'kaminari'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
View
@@ -60,6 +60,10 @@ GEM
railties (>= 3.2.0.beta, < 5.0)
thor (~> 0.14)
json (1.6.5)
+ kaminari (0.13.0)
+ actionpack (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ railties (>= 3.0.0)
kgio (2.7.2)
mail (2.4.1)
i18n (>= 0.4.0)
@@ -182,6 +186,7 @@ DEPENDENCIES
hirb-unicode
jquery-rails
json
+ kaminari
mysql2
omniauth-facebook
omniauth-github
@@ -68,7 +68,8 @@ body > div {
padding: 0 $font-size;
max-width: $cwidth;
nav {
- background-color: $dark;
+ font-size: 120%;
+ background-color: #fff;
}
.join {
font-size: 120%;
@@ -3,13 +3,8 @@ class UsersController < ApplicationController
before_filter :login_required, :only => %w(edit update)
def index
- @users = User.all
+ @users = User.order.page params[:page]
@vimrcs = Vimrc.all
- @user_for_gravatar = User.order("id DESC").limit(84).map
-
- respond_to do |format|
- format.html
- end
end
def new
View
@@ -6,6 +6,9 @@ class User < ActiveRecord::Base
accepts_nested_attributes_for :vimrcs, allow_destroy: true, :reject_if => proc { |attributes| attributes['url'].blank? }
accepts_nested_attributes_for :gitmodules, allow_destroy: true, :reject_if => proc { |attributes| attributes['url'].blank? }
+ default_scope order: 'users.created_at DESC'
+ paginates_per 30
+
include Gravtastic
gravtastic secure: true, size: 24
@@ -1,14 +1,27 @@
<h2>Users</h2>
+
<article>
<dl>
<dt>registerd users</dt>
- <dd><%= @users.size %></dd>
+ <dd><%= User.all.size %></dd>
<dt>registerd vimrcs</dt>
<dd><%= @vimrcs.size %></dd>
</dl>
- <section class="avateres">
- <% @user_for_gravatar.each do |user| %>
- <%= link_to image_tag(user.gravatar_url(size: 50, default: current_url + "/assets/vimpushergirl_default_icon.gif")), "/#{user.username}" %>
- <% end %>
+ <section>
+ <table>
+ <tr>
+ <th></th>
+ <th>username</th>
+ <th>member since</th>
+ </tr>
+ <% @users.each do |user| %>
+ <tr>
+ <td><%= link_to image_tag(user.gravatar_url(size: 50, default: current_url + "/assets/vimpushergirl_default_icon.gif")), "/#{user.username}" %></td>
+ <td><%= link_to user.username, "/#{user.username}" %></td>
+ <td><%= user.created_at.to_date %></td>
+ </tr>
+ <% end %>
+ </table>
</section>
+ <%= paginate @users %>
</article>

0 comments on commit c5090a4

Please sign in to comment.