diff options
author | Hannes Rosenögger <123haynes@gmail.com> | 2015-09-23 22:38:39 +0000 |
---|---|---|
committer | Hannes Rosenögger <123haynes@gmail.com> | 2015-09-23 22:38:39 +0000 |
commit | 68cb24c4393b2c4e40700ba05039ed1412adcd64 (patch) | |
tree | 37a5599625ea4e6967415e76f857583f3eaf5377 | |
parent | fd6b5099fbb0198cbf02ffcb647cb93253a42c0f (diff) | |
parent | fe6ea911073a723e9472632e90363fafb9a50553 (diff) | |
download | gitlab-ce-68cb24c4393b2c4e40700ba05039ed1412adcd64.tar.gz |
Merge branch 'pagination-last-page' into 'master'
Pagination last page
First commit adds a link to the last page.
Unless there are less than 5 pages to show.
Also updates the `Kaminari` gem to the latest version, which is a minor update. [Changelog](https://github.com/amatsuda/kaminari/blob/master/CHANGELOG.rdoc)
See merge request !1334
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | app/assets/stylesheets/generic/pagination.scss | 2 | ||||
-rw-r--r-- | app/views/kaminari/gitlab/_first_page.html.haml | 2 | ||||
-rw-r--r-- | app/views/kaminari/gitlab/_last_page.html.haml | 2 | ||||
-rw-r--r-- | app/views/kaminari/gitlab/_paginator.html.haml | 9 |
7 files changed, 15 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG index 8f7d118eca6..3f16a370a94 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ v 8.1.0 (unreleased) - Show CI status on all pages where commits list is rendered - Automatically enable CI when push .gitlab-ci.yml file to repository - Fix cases where Markdown did not render links in activity feed (Stan Hu) + - Add first and last to pagination (Zeger-Jan van de Weg) v 8.0.2 (unreleased) - Skip check_initd_configured_correctly on omnibus installs @@ -77,7 +77,7 @@ gem "stamp", '~> 0.5.0' gem 'enumerize', '~> 0.7.0' # Pagination -gem "kaminari", "~> 0.15.1" +gem "kaminari", "~> 0.16.3" # HAML gem "haml-rails", '~> 0.5.3' diff --git a/Gemfile.lock b/Gemfile.lock index 320f7629fb6..6070beb9d07 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -367,7 +367,7 @@ GEM railties (>= 3.2.16) json (1.8.3) jwt (1.5.1) - kaminari (0.15.1) + kaminari (0.16.3) actionpack (>= 3.0.0) activesupport (>= 3.0.0) kgio (2.9.3) @@ -846,7 +846,7 @@ DEPENDENCIES jquery-scrollto-rails (~> 1.4.3) jquery-turbolinks (~> 2.0.1) jquery-ui-rails (~> 4.2.1) - kaminari (~> 0.15.1) + kaminari (~> 0.16.3) letter_opener (~> 1.1.2) mail_room (~> 0.5.1) minitest (~> 5.7.0) diff --git a/app/assets/stylesheets/generic/pagination.scss b/app/assets/stylesheets/generic/pagination.scss index a937677ebdc..6677f94dafd 100644 --- a/app/assets/stylesheets/generic/pagination.scss +++ b/app/assets/stylesheets/generic/pagination.scss @@ -9,6 +9,8 @@ margin: 0; display: block; + li.first, + li.last, li.next, li.prev { > a { diff --git a/app/views/kaminari/gitlab/_first_page.html.haml b/app/views/kaminari/gitlab/_first_page.html.haml index 41c9c0b3af6..ada7306d98d 100644 --- a/app/views/kaminari/gitlab/_first_page.html.haml +++ b/app/views/kaminari/gitlab/_first_page.html.haml @@ -5,5 +5,5 @@ -# num_pages: total number of pages -# per_page: number of items to fetch per page -# remote: data-remote -%span.first +%li.first = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote diff --git a/app/views/kaminari/gitlab/_last_page.html.haml b/app/views/kaminari/gitlab/_last_page.html.haml index b03a206224c..3431d029bcc 100644 --- a/app/views/kaminari/gitlab/_last_page.html.haml +++ b/app/views/kaminari/gitlab/_last_page.html.haml @@ -5,5 +5,5 @@ -# num_pages: total number of pages -# per_page: number of items to fetch per page -# remote: data-remote -%span.last +%li.last = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {remote: remote} diff --git a/app/views/kaminari/gitlab/_paginator.html.haml b/app/views/kaminari/gitlab/_paginator.html.haml index b8d419b5894..2f645186921 100644 --- a/app/views/kaminari/gitlab/_paginator.html.haml +++ b/app/views/kaminari/gitlab/_paginator.html.haml @@ -8,10 +8,15 @@ = paginator.render do %div.gl-pagination %ul.pagination.clearfix - = prev_page_tag unless current_page.first? + - unless current_page.first? + = first_page_tag unless num_pages < 5 # As kaminari will always show the first 5 pages + = prev_page_tag - 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? + - unless current_page.last? + = next_page_tag + = last_page_tag unless num_pages < 5 + |