 #
 # Handles persisting and restoring the current tab selection and lazily-loading
 # content on the MergeRequests#show page.
+#
+#= require jquery.cookie
 #
 # ### Example Markup
 #


    if action == 'commits'
      @loadCommits($target.attr('href'))
    else if action == 'diffs'
      @loadDiff($target.attr('href'))
      @shrinkView()
    else if action == 'builds'
      @loadBuilds($target.attr('href'))

    @setCurrentAction(action)


    $('.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)
