Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
添加will_paginate分页组件
Browse files Browse the repository at this point in the history
  • Loading branch information
songlipeng2003 committed Dec 12, 2013
1 parent 0d1a5f1 commit 52a4fb5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Gemfile
Expand Up @@ -51,11 +51,18 @@ group :development, :test do
gem 'database_cleaner', '~>1.2.0'
end

# assets
gem 'bootstrap-generators', '~> 3.0'
gem 'select2-rails', '~> 3.5.2'

#表单
gem 'simple_form', '~> 3.0.1'

gem 'rails-i18n', '~> 4.0.0'

gem 'devise', '~> 3.2.2'
#d登陆
gem 'devise', '~> 3.2.2'

# 分页
gem 'will_paginate', '~> 3.0'
gem 'will_paginate-bootstrap', '~> 1.0.0'
5 changes: 5 additions & 0 deletions Gemfile.lock
Expand Up @@ -156,6 +156,9 @@ GEM
json (>= 1.8.0)
warden (1.2.3)
rack (>= 1.0)
will_paginate (3.0.5)
will_paginate-bootstrap (1.0.0)
will_paginate (>= 3.0.3)
xpath (2.0.0)
nokogiri (~> 1.3)

Expand All @@ -181,3 +184,5 @@ DEPENDENCIES
simple_form (~> 3.0.1)
turbolinks
uglifier (>= 1.3.0)
will_paginate (~> 3.0)
will_paginate-bootstrap (~> 1.0.0)
2 changes: 1 addition & 1 deletion app/controllers/products_controller.rb
Expand Up @@ -4,7 +4,7 @@ class ProductsController < ApplicationController
# GET /products
# GET /products.json
def index
@products = Product.all
@products = Product.paginate(:page => params[:page], :per_page => 20)
end

# GET /products/1
Expand Down
1 change: 1 addition & 0 deletions app/views/products/index.html.erb
Expand Up @@ -30,4 +30,5 @@
<% end %>
</tbody>
</table>
<%= will_paginate @products, renderer: BootstrapPagination::Rails %>
</div>
5 changes: 5 additions & 0 deletions config/locales/will_paginate.zh-CN.yml
@@ -0,0 +1,5 @@
"zh-CN":
will_paginate:
next_label: "下一页 &#8594;"
previous_label: "&#8592; 上一页"
page_gap: "&hellip;"

0 comments on commit 52a4fb5

Please sign in to comment.