Commit 755a894c911d6eb5604b97bee758306c41cd8d4a

Authored by randx
1 parent 1fefd7cb

Issues pagination

app/assets/stylesheets/common.scss
@@ -461,8 +461,27 @@ img.lil_av { @@ -461,8 +461,27 @@ img.lil_av {
461 border-top:none; 461 border-top:none;
462 462
463 form { 463 form {
464 - padding-top:16px; 464 + padding:9px 0;
  465 + margin:0px;
465 } 466 }
  467 +
  468 + .pills {
  469 + li {
  470 + padding:3px 0;
  471 + &.active a { background-color:$style_color; }
  472 + a {
  473 + border-radius:7px;
  474 + }
  475 + }
  476 + }
  477 + }
  478 +
  479 + &.bottom {
  480 + padding: 0 10px;
  481 + background:#f5f5f5;
  482 + border-top: 1px solid #eee;
  483 + @include round-borders-bottom(4px);
  484 + border-bottom:none;
466 } 485 }
467 486
468 &.padded { 487 &.padded {
@@ -1008,3 +1027,13 @@ p.time { @@ -1008,3 +1027,13 @@ p.time {
1008 .thin_area{ 1027 .thin_area{
1009 height: 150px; 1028 height: 150px;
1010 } 1029 }
  1030 +
  1031 +.gitlab_pagination {
  1032 + span {
  1033 + padding:0 10px;
  1034 +
  1035 + a {
  1036 + color:$link_color;
  1037 + }
  1038 + }
  1039 +}
app/controllers/issues_controller.rb
@@ -28,7 +28,7 @@ class IssuesController < ApplicationController @@ -28,7 +28,7 @@ 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 31 + end.page(params[:page]).per(10)
32 32
33 @issues = @issues.includes(:author, :project) 33 @issues = @issues.includes(:author, :project)
34 34
app/views/admin/projects/index.html.haml
@@ -19,4 +19,4 @@ @@ -19,4 +19,4 @@
19 %td= last_commit(project) 19 %td= last_commit(project)
20 %td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small" 20 %td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small"
21 %td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger" 21 %td= link_to 'Destroy', [:admin, project], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
22 -= paginate @admin_projects 22 += paginate @admin_projects, :theme => "admin"
app/views/admin/users/index.html.haml
@@ -20,4 +20,4 @@ @@ -20,4 +20,4 @@
20 %td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}", :class => "btn small" 20 %td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}", :class => "btn small"
21 %td= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger" 21 %td= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
22 22
23 -= paginate @admin_users 23 += paginate @admin_users, :theme => "admin"
app/views/issues/_issues.html.haml
@@ -3,3 +3,5 @@ @@ -3,3 +3,5 @@
3 3
4 - @issues.non_critical.each do |issue| 4 - @issues.non_critical.each do |issue|
5 = render(:partial => 'issues/show', :locals => {:issue => issue}) 5 = render(:partial => 'issues/show', :locals => {:issue => issue})
  6 +
  7 +%li= paginate @issues, :remote => true, :theme => "gitlab"
app/views/issues/index.html.haml
@@ -38,7 +38,6 @@ @@ -38,7 +38,6 @@
38 - if @issues.blank? 38 - if @issues.blank?
39 %li 39 %li
40 %p.padded Nothing to show here 40 %p.padded Nothing to show here
41 -  
42 :javascript 41 :javascript
43 var href = $('.issue_search').parent().attr('action'); 42 var href = $('.issue_search').parent().attr('action');
44 var last_terms = ''; 43 var last_terms = '';
app/views/kaminari/_first_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "First" page  
2 --# available local variables  
3 --# url: url to the first page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%span.first  
9 - = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote  
app/views/kaminari/_gap.html.haml
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 --# Non-link tag that stands for skipped pages...  
2 --# available local variables  
3 --# current_page: a page object for the currently displayed page  
4 --# num_pages: total number of pages  
5 --# per_page: number of items to fetch per page  
6 --# remote: data-remote  
7 -%span.page.gap  
8 - = raw(t 'views.pagination.truncate')  
app/views/kaminari/_last_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "Last" page  
2 --# available local variables  
3 --# url: url to the last page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%span.last  
9 - = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}  
app/views/kaminari/_next_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "Next" page  
2 --# available local variables  
3 --# url: url to the next page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%li.next  
9 - = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote  
app/views/kaminari/_page.html.haml
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 --# Link showing page number  
2 --# available local variables  
3 --# page: a page object for "this" page  
4 --# url: url to this page  
5 --# current_page: a page object for the currently displayed page  
6 --# num_pages: total number of pages  
7 --# per_page: number of items to fetch per page  
8 --# remote: data-remote  
9 -%li{:class => "page#{' active' if page.current?}"}  
10 - = link_to page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}  
app/views/kaminari/_paginator.html.haml
@@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
1 --# The container tag  
2 --# available local variables  
3 --# current_page: a page object for the currently displayed page  
4 --# num_pages: total number of pages  
5 --# per_page: number of items to fetch per page  
6 --# remote: data-remote  
7 --# paginator: the paginator that renders the pagination tags inside  
8 -= paginator.render do  
9 - %div.pagination  
10 - %ul  
11 - = prev_page_tag unless current_page.first?  
12 - - each_page do |page|  
13 - - if page.left_outer? || page.right_outer? || page.inside_window?  
14 - = page_tag page  
15 - - elsif !page.was_truncated?  
16 - = gap_tag  
17 - = next_page_tag unless current_page.last?  
app/views/kaminari/_prev_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "Previous" page  
2 --# available local variables  
3 --# url: url to the previous page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%li{:class => "prev" }  
9 - = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote  
app/views/kaminari/admin/_first_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "First" page
  2 +-# available local variables
  3 +-# url: url to the first page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%span.first
  9 + = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote
app/views/kaminari/admin/_gap.html.haml 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +-# Non-link tag that stands for skipped pages...
  2 +-# available local variables
  3 +-# current_page: a page object for the currently displayed page
  4 +-# num_pages: total number of pages
  5 +-# per_page: number of items to fetch per page
  6 +-# remote: data-remote
  7 +%span.page.gap
  8 + = raw(t 'views.pagination.truncate')
app/views/kaminari/admin/_last_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "Last" page
  2 +-# available local variables
  3 +-# url: url to the last page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%span.last
  9 + = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}
app/views/kaminari/admin/_next_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "Next" page
  2 +-# available local variables
  3 +-# url: url to the next page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%li.next
  9 + = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote
app/views/kaminari/admin/_page.html.haml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +-# Link showing page number
  2 +-# available local variables
  3 +-# page: a page object for "this" page
  4 +-# url: url to this page
  5 +-# current_page: a page object for the currently displayed page
  6 +-# num_pages: total number of pages
  7 +-# per_page: number of items to fetch per page
  8 +-# remote: data-remote
  9 +%li{:class => "page#{' active' if page.current?}"}
  10 + = link_to page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
app/views/kaminari/admin/_paginator.html.haml 0 → 100644
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
  1 +-# The container tag
  2 +-# available local variables
  3 +-# current_page: a page object for the currently displayed page
  4 +-# num_pages: total number of pages
  5 +-# per_page: number of items to fetch per page
  6 +-# remote: data-remote
  7 +-# paginator: the paginator that renders the pagination tags inside
  8 += paginator.render do
  9 + %div.pagination
  10 + %ul
  11 + = prev_page_tag unless current_page.first?
  12 + - each_page do |page|
  13 + - if page.left_outer? || page.right_outer? || page.inside_window?
  14 + = page_tag page
  15 + - elsif !page.was_truncated?
  16 + = gap_tag
  17 + = next_page_tag unless current_page.last?
app/views/kaminari/admin/_prev_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "Previous" page
  2 +-# available local variables
  3 +-# url: url to the previous page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%li{:class => "prev" }
  9 + = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote
app/views/kaminari/gitlab/_first_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "First" page
  2 +-# available local variables
  3 +-# url: url to the first page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%span.first
  9 + = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote
app/views/kaminari/gitlab/_gap.html.haml 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +-# Non-link tag that stands for skipped pages...
  2 +-# available local variables
  3 +-# current_page: a page object for the currently displayed page
  4 +-# num_pages: total number of pages
  5 +-# per_page: number of items to fetch per page
  6 +-# remote: data-remote
  7 +%span.page.gap
  8 + = raw(t 'views.pagination.truncate')
app/views/kaminari/gitlab/_last_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "Last" page
  2 +-# available local variables
  3 +-# url: url to the last page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%span.last
  9 + = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}
app/views/kaminari/gitlab/_next_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "Next" page
  2 +-# available local variables
  3 +-# url: url to the next page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%span.next
  9 + = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote
app/views/kaminari/gitlab/_page.html.haml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +-# Link showing page number
  2 +-# available local variables
  3 +-# page: a page object for "this" page
  4 +-# url: url to this page
  5 +-# current_page: a page object for the currently displayed page
  6 +-# num_pages: total number of pages
  7 +-# per_page: number of items to fetch per page
  8 +-# remote: data-remote
  9 +%span{:class => "page#{' current' if page.current?}"}
  10 + = link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
app/views/kaminari/gitlab/_paginator.html.haml 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +-# The container tag
  2 +-# available local variables
  3 +-# current_page: a page object for the currently displayed page
  4 +-# num_pages: total number of pages
  5 +-# per_page: number of items to fetch per page
  6 +-# remote: data-remote
  7 +-# paginator: the paginator that renders the pagination tags inside
  8 += paginator.render do
  9 + %nav.gitlab_pagination
  10 + -#= first_page_tag unless current_page.first?
  11 + = prev_page_tag
  12 + - each_page do |page|
  13 + - if page.left_outer? || page.right_outer? || page.inside_window?
  14 + = page_tag page
  15 + - elsif !page.was_truncated?
  16 + = gap_tag
  17 + = next_page_tag
  18 + -#= last_page_tag unless current_page.last?
app/views/kaminari/gitlab/_prev_page.html.haml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +-# Link to the "Previous" page
  2 +-# available local variables
  3 +-# url: url to the previous page
  4 +-# current_page: a page object for the currently displayed page
  5 +-# num_pages: total number of pages
  6 +-# per_page: number of items to fetch per page
  7 +-# remote: data-remote
  8 +%span.prev
  9 + = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote