summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-04-13 10:54:51 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-04-13 10:56:46 -0500
commit2783877e869c7bfec30423f0a1e73bc33c269453 (patch)
treed873b6ad2e3db479051e6baf20f8fbfb5980be82
parent153afd0cd4e2f5cad7d13cb489fbaa5854ff6b0c (diff)
downloadgitlab-ce-2783877e869c7bfec30423f0a1e73bc33c269453.tar.gz
Move declarations
-rw-r--r--app/assets/javascripts/todos.js.coffee7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/assets/javascripts/todos.js.coffee b/app/assets/javascripts/todos.js.coffee
index 37b4d2f66c7..08b29bd8214 100644
--- a/app/assets/javascripts/todos.js.coffee
+++ b/app/assets/javascripts/todos.js.coffee
@@ -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