Move declarations

This commit is contained in:
Alfredo Sumaran 2016-04-13 10:54:51 -05:00
parent 153afd0cd4
commit 2783877e86
1 changed files with 3 additions and 4 deletions

View File

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