diff options
| author | hukl <contact@smyck.org> | 2009-08-31 13:22:14 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-08-31 13:22:14 +0200 |
| commit | a9b003b7c3e636f32b7f031d12cf1aa41dbca1b9 (patch) | |
| tree | 5688b73d15ac0161115d3d7637f28ca5beaa0770 | |
| parent | 0f24cfe22b76b6480737c5ab119c394437613b5e (diff) | |
paginate assets view
| -rw-r--r-- | app/controllers/assets_controller.rb | 13 | ||||
| -rw-r--r-- | app/views/assets/index.html.erb | 3 |
2 files changed, 7 insertions, 9 deletions
diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index 4734a54..b1abb0f 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb | |||
| @@ -2,15 +2,12 @@ class AssetsController < ApplicationController | |||
| 2 | 2 | ||
| 3 | layout 'admin' | 3 | layout 'admin' |
| 4 | 4 | ||
| 5 | # GET /assets | ||
| 6 | # GET /assets.xml | ||
| 7 | def index | 5 | def index |
| 8 | @assets = Asset.all | 6 | @assets = Asset.all.paginate( |
| 9 | 7 | :page => params[:page], | |
| 10 | respond_to do |format| | 8 | :per_page => 20, |
| 11 | format.html # index.html.erb | 9 | :order => 'id DESC' |
| 12 | format.xml { render :xml => @assets } | 10 | ) |
| 13 | end | ||
| 14 | end | 11 | end |
| 15 | 12 | ||
| 16 | # GET /assets/1 | 13 | # GET /assets/1 |
diff --git a/app/views/assets/index.html.erb b/app/views/assets/index.html.erb index c9be684..fc7c029 100644 --- a/app/views/assets/index.html.erb +++ b/app/views/assets/index.html.erb | |||
| @@ -3,10 +3,11 @@ | |||
| 3 | <% end %> | 3 | <% end %> |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | <%= will_paginate @assets %> | ||
| 7 | |||
| 6 | <table> | 8 | <table> |
| 7 | <tr> | 9 | <tr> |
| 8 | </tr> | 10 | </tr> |
| 9 | |||
| 10 | <% @assets.each do |asset| %> | 11 | <% @assets.each do |asset| %> |
| 11 | <tr> | 12 | <tr> |
| 12 | <td><%= image_tag asset.upload.url(:thumb) %></td> | 13 | <td><%= image_tag asset.upload.url(:thumb) %></td> |
