diff --git a/app/assets/javascripts/todos.js.coffee b/app/assets/javascripts/todos.js.coffee index f16b735ece0da9c5708a29a7ecbc01efb50bf9b0..37b4d2f66c76f00eb9f0a8127239674574cc0837 100644 --- a/app/assets/javascripts/todos.js.coffee +++ b/app/assets/javascripts/todos.js.coffee @@ -93,21 +93,12 @@ class @Todos if newPages isnt currPages # Redirect to previous page if there's one available if currPages > 1 and currPage is currPages - url = @updateQueryStringParameter(url, 'page', currPages - 1) + pageParams = + page: currPages - 1 + url = gl.utils.mergeUrlParams(pageParams, url) location.replace url - updateQueryStringParameter: (uri, key, value) -> - separator = if uri.indexOf('?') isnt -1 then '&' else '?' - - # Matches key and value - regex = new RegExp('([?&])' + key + '=.*?(&|#|$)', 'i') - - if uri.match(regex) - return uri.replace(regex, '$1' + key + '=' + value + '$2') - - uri + separator + key + '=' + value - goToTodoUrl: (e)-> todoLink = $(this).data('url') if e.metaKey