Commit f3134c2a authored by Alfredo Sumaran's avatar Alfredo Sumaran

Expose todos_per_page variable

parent 5c81fc43
class @Todos class @Todos
PER_PAGE = 20
constructor: (@name) -> constructor: (@name) ->
@todos_per_page = gon.todos_per_page || 20
@clearListeners() @clearListeners()
@initBtnListeners() @initBtnListeners()
...@@ -70,7 +69,7 @@ class @Todos ...@@ -70,7 +69,7 @@ class @Todos
currPages = @getRenderedPages() currPages = @getRenderedPages()
currPage = @getCurrentPage() currPage = @getCurrentPage()
newPages = Math.ceil(total / PER_PAGE) newPages = Math.ceil(total / @todos_per_page)
url = location.href # Includes query strings url = location.href # Includes query strings
# Refresh if no remaining Todos # Refresh if no remaining Todos
......
...@@ -2,6 +2,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController ...@@ -2,6 +2,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
before_action :find_todos, only: [:index, :destroy, :destroy_all] before_action :find_todos, only: [:index, :destroy, :destroy_all]
def index def index
gon.todos_per_page = Todo.default_per_page
@todos = @todos.page(params[:page]) @todos = @todos.page(params[:page])
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment