Commit 52d8ed9e4f716f7bf89bc544aa38a810a007f244

Authored by randx
1 parent 755a894c

Pagination for Merge Requests. Fixed for issues

app/assets/stylesheets/common.scss
@@ -476,8 +476,7 @@ img.lil_av { @@ -476,8 +476,7 @@ img.lil_av {
476 } 476 }
477 } 477 }
478 478
479 - &.bottom {  
480 - padding: 0 10px; 479 + .bottom {
481 background:#f5f5f5; 480 background:#f5f5f5;
482 border-top: 1px solid #eee; 481 border-top: 1px solid #eee;
483 @include round-borders-bottom(4px); 482 @include round-borders-bottom(4px);
@@ -1029,11 +1028,11 @@ p.time { @@ -1029,11 +1028,11 @@ p.time {
1029 } 1028 }
1030 1029
1031 .gitlab_pagination { 1030 .gitlab_pagination {
1032 - span {  
1033 - padding:0 10px;  
1034 -  
1035 - a {  
1036 - color:$link_color;  
1037 - } 1031 + span a { color:$link_color; }
  1032 + .prev, .next, .current, .page a {
  1033 + padding:10px;
  1034 + }
  1035 + .current {
  1036 + border-bottom:2px solid $style_color;
1038 } 1037 }
1039 } 1038 }
app/controllers/issues_controller.rb
@@ -28,9 +28,9 @@ class IssuesController < ApplicationController @@ -28,9 +28,9 @@ class IssuesController < ApplicationController
28 when 2 then @project.issues.closed 28 when 2 then @project.issues.closed
29 when 3 then @project.issues.opened.assigned(current_user) 29 when 3 then @project.issues.opened.assigned(current_user)
30 else @project.issues.opened 30 else @project.issues.opened
31 - end.page(params[:page]).per(10) 31 + end.page(params[:page]).per(20)
32 32
33 - @issues = @issues.includes(:author, :project) 33 + @issues = @issues.includes(:author, :project).order("critical, updated_at")
34 34
35 respond_to do |format| 35 respond_to do |format|
36 format.html # index.html.erb 36 format.html # index.html.erb
app/controllers/merge_requests_controller.rb
@@ -28,7 +28,7 @@ class MergeRequestsController < ApplicationController @@ -28,7 +28,7 @@ class MergeRequestsController < ApplicationController
28 when 2 then @merge_requests.closed 28 when 2 then @merge_requests.closed
29 when 3 then @merge_requests.opened.assigned(current_user) 29 when 3 then @merge_requests.opened.assigned(current_user)
30 else @merge_requests.opened 30 else @merge_requests.opened
31 - end 31 + end.page(params[:page]).per(20)
32 32
33 @merge_requests = @merge_requests.includes(:author, :project).order("created_at desc") 33 @merge_requests = @merge_requests.includes(:author, :project).order("created_at desc")
34 end 34 end
app/views/issues/_issues.html.haml
1 -- @issues.critical.each do |issue| 1 +- @issues.select(&:critical).each do |issue|
2 = render(:partial => 'issues/show', :locals => {:issue => issue}) 2 = render(:partial => 'issues/show', :locals => {:issue => issue})
3 3
4 -- @issues.non_critical.each do |issue| 4 +- @issues.reject(&:critical).each do |issue|
5 = render(:partial => 'issues/show', :locals => {:issue => issue}) 5 = render(:partial => 'issues/show', :locals => {:issue => issue})
6 6
7 -%li= paginate @issues, :remote => true, :theme => "gitlab" 7 +- if @issues.present?
  8 + %li.bottom
  9 + .row
  10 + .span10= paginate @issues, :remote => true, :theme => "gitlab"
  11 + .span4.right
  12 + %span.cgray.right #{@issues.total_count} issues for this filter
app/views/kaminari/gitlab/_paginator.html.haml
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 -# paginator: the paginator that renders the pagination tags inside 7 -# paginator: the paginator that renders the pagination tags inside
8 = paginator.render do 8 = paginator.render do
9 %nav.gitlab_pagination 9 %nav.gitlab_pagination
10 - -#= first_page_tag unless current_page.first?  
11 = prev_page_tag 10 = prev_page_tag
12 - each_page do |page| 11 - each_page do |page|
13 - if page.left_outer? || page.right_outer? || page.inside_window? 12 - if page.left_outer? || page.right_outer? || page.inside_window?
@@ -15,4 +14,3 @@ @@ -15,4 +14,3 @@
15 - elsif !page.was_truncated? 14 - elsif !page.was_truncated?
16 = gap_tag 15 = gap_tag
17 = next_page_tag 16 = next_page_tag
18 - -#= last_page_tag unless current_page.last?  
app/views/merge_requests/index.html.haml
@@ -27,5 +27,10 @@ @@ -27,5 +27,10 @@
27 - if @merge_requests.blank? 27 - if @merge_requests.blank?
28 %li 28 %li
29 %p.padded Nothing to show here 29 %p.padded Nothing to show here
30 - 30 + - if @merge_requests.present?
  31 + %li.bottom
  32 + .row
  33 + .span10= paginate @merge_requests, :theme => "gitlab"
  34 + .span4.right
  35 + %span.cgray.right #{@merge_requests.total_count} merge requests for this filter
31 36