Skip to content
Snippets Groups Projects
Commit f3134c2a authored by Alfredo Sumaran's avatar Alfredo Sumaran
Browse files

Expose todos_per_page variable

parent 5c81fc43
No related branches found
No related tags found
2 merge requests!4779Test/#123 Master,!3428Refresh page according remaining todos
Pipeline #
class @Todos class @Todos
PER_PAGE = 20
constructor: (@name) -> constructor: (@name) ->
@todos_per_page = gon.todos_per_page || 20
@clearListeners() @clearListeners()
@initBtnListeners() @initBtnListeners()
   
Loading
@@ -70,7 +69,7 @@ class @Todos
Loading
@@ -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
Loading
Loading
Loading
@@ -2,6 +2,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
Loading
@@ -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
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment