summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-11-30 17:39:50 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2017-12-01 18:41:07 +0100
commite7990a16ded06f495e0c4aa40f8519ab76e00c5b (patch)
tree717f0472cf95c4ae5e24edc631c3c3d3e6425ea5 /app
parentc594659fea15c6dd17b9ea4c6b88c5a418f10ab9 (diff)
downloadgitlab-ce-pagination-without-count-flag.tar.gz
Allow disabling of page numbers using Flipperpagination-without-count-flag
This allows page numbers to be disabled globally by enabling the feature "paginate_without_count". This allows us to test the performance impact of not having to run COUNT(*) queries, while still being able to revert easily if necessary. See https://gitlab.com/gitlab-org/gitlab-ce/issues/36077 for more information.
Diffstat (limited to 'app')
-rw-r--r--app/helpers/pagination_helper.rb21
-rw-r--r--app/views/dashboard/todos/index.html.haml2
-rw-r--r--app/views/shared/projects/_list.html.haml2
3 files changed, 2 insertions, 23 deletions
diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb
deleted file mode 100644
index 83dd76a01dd..00000000000
--- a/app/helpers/pagination_helper.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-module PaginationHelper
- def paginate_collection(collection, remote: nil)
- if collection.is_a?(Kaminari::PaginatableWithoutCount)
- paginate_without_count(collection)
- elsif collection.respond_to?(:total_pages)
- paginate_with_count(collection, remote: remote)
- end
- end
-
- def paginate_without_count(collection)
- render(
- 'kaminari/gitlab/without_count',
- previous_path: path_to_prev_page(collection),
- next_path: path_to_next_page(collection)
- )
- end
-
- def paginate_with_count(collection, remote: nil)
- paginate(collection, remote: remote, theme: 'gitlab')
- end
-end
diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml
index a5686002328..4c4e9dabdaa 100644
--- a/app/views/dashboard/todos/index.html.haml
+++ b/app/views/dashboard/todos/index.html.haml
@@ -72,7 +72,7 @@
.js-todos-all
- if @todos.any?
.js-todos-list-container
- .js-todos-options{ data: { per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages } }
+ .js-todos-options{ data: { per_page: @todos.limit_value, current_page: @todos.current_page } }
.panel.panel-default.panel-without-border.panel-without-margin
%ul.content-list.todos-list
= render @todos
diff --git a/app/views/shared/projects/_list.html.haml b/app/views/shared/projects/_list.html.haml
index 0bedfea3502..109c99b0dda 100644
--- a/app/views/shared/projects/_list.html.haml
+++ b/app/views/shared/projects/_list.html.haml
@@ -23,6 +23,6 @@
= icon('lock fw', base: 'circle', class: 'fa-lg private-fork-icon')
%strong= pluralize(@private_forks_count, 'private fork')
%span &nbsp;you have no access to.
- = paginate_collection(projects, remote: remote)
+ = paginate(projects, remote: remote)
- else
.nothing-here-block No projects found