Sha256: 3ed64838844018aa190cb6dcb7941490c7669bf0eaca4f94c2c46c755b6b704d

Contents?: true

Size: 1.52 KB

Versions: 14

Compression:

Stored size: 1.52 KB

Contents

# Sidebar Sections

Sidebars allow you to put whatever content you want on the side the page.

```ruby
sidebar :help do
  "Need help? Email us at help@example.com"
end
```

This will generate a sidebar on every page for that resource. The first
argument is used as the title, and can be a symbol, string, or lambda.

You can also use [Arbre](https://github.com/activeadmin/arbre) to define HTML content.

```ruby
sidebar :help do
  ul do
    li "Second List First Item"
    li "Second List Second Item"
  end
end
```

Sidebars can be rendered on a specific action by passing `:only` or `:except`.

```ruby
sidebar :help, only: :index do
  "Need help? Email us at help@example.com"
end
```

If you want to conditionally display a sidebar section, use the :if option and
pass it a proc which will be rendered within the view context.

```ruby
sidebar :help, if: proc{ current_admin_user.super_admin? } do
  "Only for super admins!"
end
```

You can also render a partial:

```ruby
sidebar :help                    # app/views/admin/posts/_help_sidebar.html.erb
sidebar :help, partial: 'custom' # app/views/admin/posts/_custom.html.erb
```

It's possible to add custom class name to the sidebar parent element by passing
`class` option:

```ruby
sidebar :help, class: 'custom_class'
```

By default sidebars are positioned in the same order as they defined, but it's also
possible to specify their position manually:

```ruby
sidebar :help, priority: 0 # will push Help section to the top (above default Filters section)
```

Default sidebar priority is `10`.

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
yousty-activeadmin-1.0.17.pre docs/7-sidebars.md
yousty-activeadmin-1.0.16.pre docs/7-sidebars.md
yousty-activeadmin-1.0.15.pre docs/7-sidebars.md
yousty-activeadmin-1.0.14.pre docs/7-sidebars.md
yousty-activeadmin-1.0.13.pre docs/7-sidebars.md
yousty-activeadmin-1.0.12.pre docs/7-sidebars.md
yousty-activeadmin-1.0.11.pre docs/7-sidebars.md
yousty-activeadmin-1.0.10.pre docs/7-sidebars.md
yousty-activeadmin-1.0.9.pre docs/7-sidebars.md
yousty-activeadmin-1.0.8.pre docs/7-sidebars.md
activeadmin-1.0.0.pre1 docs/7-sidebars.md
yousty-activeadmin-1.0.7.pre docs/7-sidebars.md
yousty-activeadmin-1.0.6.pre docs/7-sidebars.md
yousty-activeadmin-1.0.5.pre docs/7-sidebars.md