Merge branch 'rs-mr-tab-loader' into 'master'
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! 💥 See merge request !1553
This commit is contained in:
commit
192dd58d03
1 changed files with 8 additions and 5 deletions
|
@ -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'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue