Sha256: dde0bae45c9bfa8cdf032cb23a04db57225a600ec62861323b98e0b1b1167b3d

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

$(document).ready ->
  if $('body').hasClass('index') && ($('#active_admin_content').hasClass('collapsible_sidebar'))

    $aa_content = $('#active_admin_content')

    $aa_content.find('.sidebar_section:first>h3').append(
      '<span class="collapse_btn icono-caret-left" title="Hide sidebar"></span>')

    $aa_content.prepend(
      '<span class="uncollapse_btn icono-caret-right" title="Show sidebar"></span>')

    set_collapsed_sidebar = (value) ->
      $.getJSON(this.href, {collapsed_sidebar: value})

    $aa_content.on 'click', '.collapse_btn, .uncollapse_btn', (e) ->
      if !$aa_content.hasClass('collapsed_sidebar')
        set_collapsed_sidebar(true)
        $aa_content.removeClass('left_sidebar')
        $aa_content.addClass('collapsed_sidebar')
      else
        set_collapsed_sidebar(false)
        $aa_content.removeClass('collapsed_sidebar')
        $aa_content.addClass('left_sidebar')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_admin_sidebar-0.1.0.rc3 app/assets/javascripts/active_admin_sidebar.coffee