Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2016-12-20 21:52:09 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2016-12-22 02:53:24 +0300
commit805bbe889328bff55b49290294721405148cc980 (patch)
tree0beb7c9621db87d5f11928ca8231af8b1de21a6c /app/controllers/projects/snippets_controller.rb
parent9b66aa6e04ab66af7ce11e26076ebf431ca938c5 (diff)
adds specs for respective behaviour
Diffstat (limited to 'app/controllers/projects/snippets_controller.rb')
-rw-r--r--app/controllers/projects/snippets_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb
index 7083b29b6a3..02a97c1c574 100644
--- a/app/controllers/projects/snippets_controller.rb
+++ b/app/controllers/projects/snippets_controller.rb
@@ -1,6 +1,5 @@
class Projects::SnippetsController < Projects::ApplicationController
include ToggleAwardEmoji
- include KaminariPagination
before_action :module_enabled
before_action :snippet, only: [:show, :edit, :destroy, :update, :raw, :toggle_award_emoji]
@@ -26,7 +25,10 @@ class Projects::SnippetsController < Projects::ApplicationController
project: @project,
scope: params[:scope]
)
- @snippets = bounded_pagination(@snippets, params[:page])
+ @snippets = @snippets.page(params[:page])
+ if @snippets.out_of_range? && @snippets.total_pages != 0
+ redirect_to namespace_project_snippets_path(page: @snippets.total_pages)
+ end
end
def new