Sha256: a5f0843a6816f48637221c63b7929f4c76fb5b79a36d7c794820c3ec0f973328

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

class ActiveAdmin::Views::Pages::Base < Arbre::HTML::Document

  def build_page_content
    build_flash_messages
    div id: "active_admin_content", class: main_content_classes do
      build_sidebar unless skip_sidebar? || right_sidebar?
      build_main_content_wrapper
      build_sidebar unless skip_sidebar? || left_sidebar?
    end
  end

  def left_sidebar?
    assigns[:sidebar_options].try!(:[], :position) == :left
  end

  def collapsible_sidebar?
    left_sidebar? && !!assigns[:sidebar_options].try!(:[], :collapsed)
  end

  def sidebar_is_collapsed?
    !!assigns[:sidebar_options].try!(:[], :is_collapsed)
  end

  def right_sidebar?
     !left_sidebar?
  end

  def main_content_classes
    classes = Arbre::HTML::ClassList.new
    if skip_sidebar?
      classes << "without_sidebar"
    else
      classes << "with_sidebar"
      classes << "left_sidebar" if left_sidebar?
      if collapsible_sidebar?
        classes << "collapsible_sidebar"
        classes << "collapsed_sidebar" if sidebar_is_collapsed?
      end
    end
    classes
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_admin_sidebar-1.0.0 lib/active_admin_sidebar/activeadmin_views_pages_base.rb
active_admin_sidebar-0.1.0.rc3 lib/active_admin_sidebar/activeadmin_views_pages_base.rb