diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-26 16:17:07 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-26 16:17:07 +0000 |
commit | 06ab7d89f9835205ee4d2dfd64aac671a7efa891 (patch) | |
tree | aa5d7722bd7f92ccb47d0eb07138de3364fdaa01 /app | |
parent | 2fa77909ae6161ca21076ddbbcbfe52c7a4f7e40 (diff) | |
parent | e14d517b61233ac0a2cc2fe90f3a745133cf789c (diff) | |
download | gitlab-ce-06ab7d89f9835205ee4d2dfd64aac671a7efa891.tar.gz |
Merge branch 'rs-issue-1887' into 'master'
Reorder MergeRequestTabs constructor
The tab was being activated before we set the `[commits|diffs]Loaded`
variable, so even when the `/diffs` route is accessed directly, like
from the "Side-by-side" link, the tab was being loaded from its default
source.
Fixes #1887
See merge request !892
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.coffee | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.coffee b/app/assets/javascripts/merge_request_tabs.js.coffee index de9a4c2cc2f..5dc441f64b5 100644 --- a/app/assets/javascripts/merge_request_tabs.js.coffee +++ b/app/assets/javascripts/merge_request_tabs.js.coffee @@ -49,13 +49,15 @@ class @MergeRequestTabs # Store the `location` object, allowing for easier stubbing in tests @_location = location + switch @opts.action + when 'commits' + @commitsLoaded = true + when 'diffs' + @diffsLoaded = true + @bindEvents() @activateTab(@opts.action) - switch @opts.action - when 'commits' then @commitsLoaded = true - when 'diffs' then @diffsLoaded = true - bindEvents: -> $(document).on 'shown.bs.tab', '.merge-request-tabs a[data-toggle="tab"]', @tabShown @@ -67,6 +69,7 @@ class @MergeRequestTabs @loadCommits($target.attr('href')) else if action == 'diffs' @loadDiff($target.attr('href')) + @stickyDiffHeaders() @setCurrentAction(action) @@ -134,12 +137,15 @@ class @MergeRequestTabs url: "#{source}.json" success: (data) => document.getElementById('diffs').innerHTML = data.html - $('.diff-header').trigger('sticky_kit:recalc') + @stickyDiffHeaders() @diffsLoaded = true toggleLoading: -> $('.mr-loading-status .loading').toggle() + stickyDiffHeaders: -> + $('.diff-header').trigger('sticky_kit:recalc') + _get: (options) -> defaults = { beforeSend: @toggleLoading |