diff options
author | Arinde Eniola <eniolaarinde1@gmail.com> | 2016-04-14 22:56:02 +0100 |
---|---|---|
committer | Arinde Eniola <eniolaarinde1@gmail.com> | 2016-04-15 16:30:39 +0100 |
commit | 8568a7337e7b79950449bb5b3c7ccb4633be4f2b (patch) | |
tree | 9e20efa76a4987e8ac6c58657f6b2d64c30a3606 | |
parent | d2366d7ef739b68f08a17dfee6dc4a934af3b17a (diff) | |
download | gitlab-ce-8568a7337e7b79950449bb5b3c7ccb4633be4f2b.tar.gz |
refactor merge_request_tabs to use sidebar logic
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.coffee | 32 | ||||
-rw-r--r-- | app/assets/javascripts/sidebar.js.coffee | 2 |
2 files changed, 6 insertions, 28 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.coffee b/app/assets/javascripts/merge_request_tabs.js.coffee index 1ab6e5114bc..e98db63f51f 100644 --- a/app/assets/javascripts/merge_request_tabs.js.coffee +++ b/app/assets/javascripts/merge_request_tabs.js.coffee @@ -4,6 +4,7 @@ # content on the MergeRequests#show page. # #= require jquery.cookie +#= require sidebar # # ### Example Markup # @@ -70,16 +71,16 @@ class @MergeRequestTabs if action == 'commits' @loadCommits($target.attr('href')) - @expandView() + RightSidebar.expandSidebar() else if action == 'diffs' @loadDiff($target.attr('href')) if bp? and bp.getBreakpointSize() isnt 'lg' - @shrinkView() + RightSidebar.collapseSidebar() else if action == 'builds' @loadBuilds($target.attr('href')) - @expandView() + RightSidebar.expandSidebar() else - @expandView() + RightSidebar.expandSidebar() @setCurrentAction(action) @@ -222,26 +223,3 @@ class @MergeRequestTabs expandViewContainer: -> $('.container-fluid').removeClass('container-limited') - - shrinkView: -> - $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-left') - $gutterIcon.closest('a').trigger('click', [true]) - , 0) diff --git a/app/assets/javascripts/sidebar.js.coffee b/app/assets/javascripts/sidebar.js.coffee index 6024b39ae97..57ae93987ce 100644 --- a/app/assets/javascripts/sidebar.js.coffee +++ b/app/assets/javascripts/sidebar.js.coffee @@ -1,7 +1,7 @@ collapsed = 'page-sidebar-collapsed' expanded = 'page-sidebar-expanded' -toggleRightSidebar = +@RightSidebar = collapseSidebar: -> $gutterIcon = $('.js-sidebar-toggle i:visible') |