Sha256: d5e3132d010c46ae65ffb188916d8368e2d94add48487bc200ee7547137565e6

Contents?: true

Size: 730 Bytes

Versions: 4

Compression:

Stored size: 730 Bytes

Contents

module ActiveAdminSidebar
  module Positions
    def left_sidebar!(options = {})
      @sidebar_options = { position: :left }
      if options.fetch(:collapsed, false)
        collapsed_sidebar
        @sidebar_options.merge!(
          is_collapsed: session[:collapsed_sidebar],
          collapsed: true
        )
      end
    end

    def right_sidebar!
      @sidebar_options = { position: :right }
    end

    def collapsed_sidebar
      if request.xhr?
        if params[:collapsed_sidebar].present?
          collapsed = params[:collapsed_sidebar].to_s == 'true'
          session[:collapsed_sidebar] = collapsed
          render json: { collapsed_sidebar: collapsed } and return
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_admin_sidebar-2.0.0 lib/active_admin_sidebar/positions.rb
active_admin_sidebar-1.2.0 lib/active_admin_sidebar/positions.rb
active_admin_sidebar-1.1.0 lib/active_admin_sidebar/positions.rb
active_admin_sidebar-1.0.0 lib/active_admin_sidebar/positions.rb