summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-10-09 11:36:15 +0000
committerDouwe Maan <douwe@gitlab.com>2015-10-09 11:36:15 +0000
commit192dd58d0358ba4c0993170589c9ed250e1dc547 (patch)
treebec088b512b580857ec2aaf6217d314a372880ae
parentab5066e5e61f2ff656639812f6f2d2f3b7d85d56 (diff)
parent29fe488b0cf9f8a79aad774c912be94bb737d36a (diff)
downloadgitlab-ce-192dd58d0358ba4c0993170589c9ed250e1dc547.tar.gz
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! :boom: See merge request !1553
-rw-r--r--app/assets/javascripts/merge_request_tabs.js.coffee13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.coffee b/app/assets/javascripts/merge_request_tabs.js.coffee
index 4e56791bde4..3e77ea515f8 100644
--- a/app/assets/javascripts/merge_request_tabs.js.coffee
+++ b/app/assets/javascripts/merge_request_tabs.js.coffee
@@ -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'
}