Commit e13333aa authored by Robert Speicher's avatar Robert Speicher

Make the loading spinner toggle more explicit

Occasionally the loading spinner would stay visible after the tab
finished loading. This change makes the toggle explicit so that it's
always shown on `beforeSend`, and always hidden on `complete`.

Plus a bonus semi-colon eradication! 💥
parent ada2c455
......@@ -69,7 +69,7 @@ class @MergeRequestTabs
scrollToElement: (container) ->
if window.location.hash
top = $(container + " " + window.location.hash).offset().top
$('body').scrollTo(top);
$('body').scrollTo(top)
# Activate a tab based on the current action
activateTab: (action) ->
......@@ -139,13 +139,16 @@ class @MergeRequestTabs
@diffsLoaded = true
@scrollToElement(".diffs")
toggleLoading: ->
$('.mr-loading-status .loading').toggle()
# Show or hide the loading spinner
#
# status - Boolean, true to show, false to hide
toggleLoading: (status) ->
$('.mr-loading-status .loading').toggle(status)
_get: (options) ->
defaults = {
beforeSend: @toggleLoading
complete: @toggleLoading
beforeSend: => @toggleLoading(true)
complete: => @toggleLoading(false)
dataType: 'json'
type: 'GET'
}
......
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