Expose todos_per_page variable
This commit is contained in:
parent
5c81fc43fa
commit
f3134c2a70
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue