Expose todos_per_page variable

This commit is contained in:
Alfredo Sumaran 2016-03-30 17:11:51 -05:00
parent 5c81fc43fa
commit f3134c2a70
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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