mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-23 03:26:07 +10:00
Expand the issuable sidebar when coming back from the Changes tab
Unless the user explicitly requested the collapsed sidebar.
This commit is contained in:
@@ -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 expanded
|
||||
if $gutterIcon.is('.fa-angle-double-right')
|
||||
$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-right')
|
||||
$gutterIcon.closest('a').trigger('click',[true])
|
||||
if $gutterIcon.is('.fa-angle-double-left')
|
||||
$gutterIcon.closest('a').trigger('click', [true])
|
||||
, 0)
|
||||
|
||||
Reference in New Issue
Block a user