diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2016-03-20 15:10:16 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2016-03-20 15:10:16 +0000 |
commit | d3e9134601900e6e11dea5bd1fbabce57ef76fe3 (patch) | |
tree | 790e9642ed272774aa45fdd99f8ae2b50640f812 | |
parent | 1e420ccf59eae2015cda1a5d6236f22fc33db70c (diff) | |
parent | 423e0068407d0589e097ff76bb8301384b39229b (diff) | |
download | gitlab-ce-d3e9134601900e6e11dea5bd1fbabce57ef76fe3.tar.gz |
Merge branch 'rs-auto-expand-sidebar' into 'master'
Expand the issuable sidebar when coming back from the Changes tab
Unless the user explicitly requested the collapsed sidebar.
Fixes: #14353
See merge request !3256
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.coffee | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.coffee b/app/assets/javascripts/merge_request_tabs.js.coffee index 8322b4c46ad..839e6ec2c08 100644 --- a/app/assets/javascripts/merge_request_tabs.js.coffee +++ b/app/assets/javascripts/merge_request_tabs.js.coffee @@ -3,6 +3,8 @@ # Handles persisting and restoring the current tab selection and lazily-loading # content on the MergeRequests#show page. # +#= require jquery.cookie +# # ### Example Markup # # <ul class="nav-links merge-request-tabs"> @@ -68,11 +70,15 @@ class @MergeRequestTabs if action == 'commits' @loadCommits($target.attr('href')) + @expandView() else if action == 'diffs' @loadDiff($target.attr('href')) @shrinkView() else if action == 'builds' @loadBuilds($target.attr('href')) + @expandView() + else + @expandView() @setCurrentAction(action) @@ -189,11 +195,24 @@ class @MergeRequestTabs $('.container-fluid').removeClass('container-limited') shrinkView: -> - $gutterIcon = $('.js-sidebar-toggle i') + $gutterIcon = $('.js-sidebar-toggle i:visible') # Wait until listeners are set setTimeout( -> - # Only when sidebar is collapsed + # Only when sidebar is expanded if $gutterIcon.is('.fa-angle-double-right') - $gutterIcon.closest('a').trigger('click',[true]) + $gutterIcon.closest('a').trigger('click', [true]) + , 0) + + # Expand the issuable sidebar unless the user explicitly collapsed it + expandView: -> + return if $.cookie('collapsed_gutter') == 'true' + + $gutterIcon = $('.js-sidebar-toggle i:visible') + + # Wait until listeners are set + setTimeout( -> + # Only when sidebar is collapsed + if $gutterIcon.is('.fa-angle-double-left') + $gutterIcon.closest('a').trigger('click', [true]) , 0) |