Skip to content
Snippets Groups Projects
Commit e7e71dbf authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

replace will_paginate with kaminari

parent 7ef766e9
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -42,7 +42,7 @@ gem 'stamp'
gem 'grit'
 
# Pagination
gem 'will_paginate', '~> 3.0'
gem 'kaminari'
 
# State machine
gem 'state_machine'
Loading
Loading
Loading
Loading
@@ -102,6 +102,9 @@ GEM
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.7.6)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.7.4)
libv8 (3.3.10.4)
libwebsocket (0.1.5)
Loading
Loading
@@ -234,7 +237,6 @@ GEM
whenever (0.8.2)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
will_paginate (3.0.3)
xpath (0.1.4)
nokogiri (~> 1.3)
 
Loading
Loading
@@ -258,6 +260,7 @@ DEPENDENCIES
guard-rspec
haml-rails
jquery-rails
kaminari
mysql2
pg
pry
Loading
Loading
@@ -280,4 +283,3 @@ DEPENDENCIES
uglifier (>= 1.0.3)
unicorn (~> 4.4.0)
whenever
will_paginate (~> 3.0)
Loading
Loading
@@ -15,7 +15,7 @@ class BuildsController < ApplicationController
 
raise ActiveRecord::RecordNotFound unless @build
 
@builds = @builds.paginate(:page => params[:page], :per_page => 20)
@builds = @builds.page(params[:page]).per(20)
end
 
def status
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ class ProjectsController < ApplicationController
def index
@projects = Project.order('id DESC')
@projects = @projects.public unless current_user
@projects = @projects.paginate(page: params[:page], per_page: 20)
@projects = @projects.page(params[:page]).per(20)
end
 
def show
Loading
Loading
@@ -21,7 +21,7 @@ class ProjectsController < ApplicationController
 
@builds = @project.builds
@builds = @builds.where(ref: @ref) if @ref
@builds = @builds.latest_sha.order('id DESC').paginate(page: params[:page], per_page: 20)
@builds = @builds.latest_sha.order('id DESC').page(params[:page]).per(20)
end
 
def details
Loading
Loading
Loading
Loading
@@ -85,7 +85,7 @@
%td.status= build.status
 
 
= will_paginate @builds
= paginate @builds
%br
.right
%a.btn.btn-small{href: run_project_path(@project, ref: @build.ref)} Run
Loading
Loading
%li
= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote
%li.disabled
= link_to raw(t 'views.pagination.truncate'), '#'
%li
= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}
%li
= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote
%li{class: "#{'active' if page.current?}"}
= link_to page, page.current? ? '#' : url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
= paginator.render do
.pagination
%ul
= first_page_tag unless current_page.first?
= prev_page_tag unless current_page.first?
- each_page do |page|
- if page.left_outer? || page.right_outer? || page.inside_window?
= page_tag page
- elsif !page.was_truncated?
= gap_tag
= next_page_tag unless current_page.last?
= last_page_tag unless current_page.last?
%li
= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote
Loading
Loading
@@ -24,7 +24,7 @@
%i.icon-globe
Public
.clearfix
= will_paginate @projects
= paginate @projects
- if @projects.empty?
.alert
No projects yet
Loading
Loading
@@ -50,7 +50,7 @@
 
= render @builds
 
= will_paginate @builds
= paginate @builds
- if @builds.empty?
.alert
No builds yet
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment