diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2016-02-22 14:35:06 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2016-02-22 14:35:06 +0000 |
commit | 5803a5308f5a7a84cc84dd0a7d8a89565bae0717 (patch) | |
tree | 81e38e65cd3d1a8b85375c0f3cf386bbebb77c88 | |
parent | f51d8af5a72e563b3ea87668b6f4981dcbcdcd14 (diff) | |
parent | cd569a66ef07a88923de0f500d055f00ab598d38 (diff) | |
download | gitlab-ce-5803a5308f5a7a84cc84dd0a7d8a89565bae0717.tar.gz |
Merge branch 'issue_13463' into 'master'
Fix Side-by-side view after loading diff results
Fixes #13463
See merge request !2880
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.coffee | 8 | ||||
-rw-r--r-- | app/helpers/diff_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/nav_helper.rb | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.coffee b/app/assets/javascripts/merge_request_tabs.js.coffee index b10e1db7f3f..6f569f9e1aa 100644 --- a/app/assets/javascripts/merge_request_tabs.js.coffee +++ b/app/assets/javascripts/merge_request_tabs.js.coffee @@ -146,6 +146,7 @@ class @MergeRequestTabs success: (data) => document.querySelector("div#diffs").innerHTML = data.html $('div#diffs .js-syntax-highlight').syntaxHighlight() + @expandViewContainer() if @diffViewType() is 'parallel' @diffsLoaded = true @scrollToElement("#diffs") @@ -177,3 +178,10 @@ class @MergeRequestTabs options = $.extend({}, defaults, options) $.ajax(options) + + # Returns diff view type + diffViewType: -> + $('.inline-parallel-buttons a.active').data('view-type') + + expandViewContainer: -> + $('.container-fluid').removeClass('container-limited') diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 6a3ab3ea40a..d76db867c5a 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -137,7 +137,7 @@ module DiffHelper # Always use HTML to handle case where JSON diff rendered this button params_copy.delete(:format) - link_to url_for(params_copy), id: "#{name}-diff-btn", class: (selected ? 'btn active' : 'btn') do + link_to url_for(params_copy), id: "#{name}-diff-btn", class: (selected ? 'btn active' : 'btn'), data: { view_type: name } do title end end diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index 29cb753e62c..5d86bd490a8 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -23,6 +23,7 @@ module NavHelper if current_path?('merge_requests#show') || current_path?('merge_requests#diffs') || current_path?('merge_requests#commits') || + current_path?('merge_requests#builds') || current_path?('issues#show') if cookies[:collapsed_gutter] == 'true' "page-gutter right-sidebar-collapsed" |