Commit 2783877e authored by Alfredo Sumaran's avatar Alfredo Sumaran

Move declarations

parent 153afd0c
...@@ -73,14 +73,10 @@ class @Todos ...@@ -73,14 +73,10 @@ class @Todos
getTodosPerPage: -> getTodosPerPage: ->
@el.data('perPage') @el.data('perPage')
redirectIfNeeded: (total) -> redirectIfNeeded: (total) ->
currPages = @getTotalPages() currPages = @getTotalPages()
currPage = @getCurrentPage() currPage = @getCurrentPage()
newPages = Math.ceil(total / @getTodosPerPage())
url = location.href # Includes query strings
# Refresh if no remaining Todos # Refresh if no remaining Todos
if not total if not total
location.reload() location.reload()
...@@ -89,6 +85,9 @@ class @Todos ...@@ -89,6 +85,9 @@ class @Todos
# Do nothing if no pagination # Do nothing if no pagination
return if not currPages return if not currPages
newPages = Math.ceil(total / @getTodosPerPage())
url = location.href # Includes query strings
# If new total of pages is different than we have now # If new total of pages is different than we have now
if newPages isnt currPages if newPages isnt currPages
# Redirect to previous page if there's one available # Redirect to previous page if there's one available
......
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