From f3134c2a7045accd70f6877874c43c3ead134d35 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran <alfredo@gitlab.com> Date: Wed, 30 Mar 2016 17:11:51 -0500 Subject: [PATCH] Expose todos_per_page variable --- app/assets/javascripts/todos.js.coffee | 5 ++--- app/controllers/dashboard/todos_controller.rb | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/todos.js.coffee b/app/assets/javascripts/todos.js.coffee index 29dad4ed6fd..ce44a16e224 100644 --- a/app/assets/javascripts/todos.js.coffee +++ b/app/assets/javascripts/todos.js.coffee @@ -1,7 +1,6 @@ class @Todos - PER_PAGE = 20 - constructor: (@name) -> + @todos_per_page = gon.todos_per_page || 20 @clearListeners() @initBtnListeners() @@ -70,7 +69,7 @@ class @Todos currPages = @getRenderedPages() currPage = @getCurrentPage() - newPages = Math.ceil(total / PER_PAGE) + newPages = Math.ceil(total / @todos_per_page) url = location.href # Includes query strings # Refresh if no remaining Todos diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 5abf97342c3..d91311aa51a 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -2,6 +2,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController before_action :find_todos, only: [:index, :destroy, :destroy_all] def index + gon.todos_per_page = Todo.default_per_page @todos = @todos.page(params[:page]) end -- GitLab