Commit 192dd58d authored by Douwe Maan's avatar Douwe Maan

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