Skip to content

Commit da460dd

Browse files
committed
Update README for v3, bump version to 3.0.0
- Bump gem and npm version to 3.0.0 - Update README: ActiveAdmin 3.x, fix headings, fix code examples - Use block form for before_action examples - Simplify NPM section, remove hardcoded version - Fix typos and outdated references
1 parent 25d62b2 commit da460dd

3 files changed

Lines changed: 38 additions & 51 deletions

File tree

README.md

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,107 +5,94 @@
55

66
# ActiveAdmin Sidebar
77

8-
Provides ability to manipulate sidebar position for ActiveAdmin (tested with ActiveAdmin ~> 1.0.0)
8+
Manipulate sidebar position and add collapsible sidebar support for ActiveAdmin 3.x.
99

1010
## Install
1111

12-
Add following line to the `Gemfile`
12+
Add to your `Gemfile`:
1313

1414
```ruby
1515
gem 'active_admin_sidebar'
1616
```
1717

18-
##### Using assets via Sprockets
19-
Add following line to the `app/assets/stylesheets/active_admin.css.scss`
18+
### Using assets via Sprockets
19+
20+
Add to `app/assets/stylesheets/active_admin.scss`:
2021

2122
```scss
22-
@import "active_admin_sidebar";
23+
@import "active_admin_sidebar";
2324
```
2425

25-
If you want to use collapsing feature, add following line
26+
Add to `app/assets/javascripts/active_admin.js`:
2627

27-
```javascripts
28-
//= require active_admin_sidebar
28+
```javascript
29+
//= require active_admin_sidebar
2930
```
3031

31-
to the `app/assets/javascripts/active_admin.js`
32-
33-
##### Using assets via Webpacker (or any other assets bundler) as a NPM module (Yarn package)
34-
35-
Execute:
32+
### Using assets via NPM
3633

3734
$ npm i @activeadmin-plugins/active_admin_sidebar
3835

3936
Or
4037

4138
$ yarn add @activeadmin-plugins/active_admin_sidebar
4239

43-
Or add manually to `package.json`:
44-
45-
```json
46-
"dependencies": {
47-
"@activeadmin-plugins/active_admin_sidebar": "2.0.0"
48-
}
49-
```
50-
and execute:
51-
52-
$ yarn
53-
54-
Add the following line into `app/assets/javascripts/active_admin.js`:
40+
Add to `app/assets/javascripts/active_admin.js`:
5541

5642
```javascript
5743
import '@activeadmin-plugins/active_admin_sidebar';
5844
```
5945

60-
Add the following line into `app/assets/stylesheets/active_admin.scss`:
46+
Add to `app/assets/stylesheets/active_admin.scss`:
6147

62-
```css
48+
```scss
6349
@import '@activeadmin-plugins/active_admin_sidebar';
6450
```
6551

66-
# Configuration per resource
52+
## Configuration per resource
6753

68-
Changing sidebar position dynamically with before_action
54+
Change sidebar position with `before_action`:
6955

7056
```ruby
71-
# app/admin/posts.rb
72-
ActiveAdmin.register Post do
73-
before_action :left_sidebar!, only: [:show]
57+
# app/admin/posts.rb
58+
ActiveAdmin.register Post do
59+
before_action only: [:index] do
60+
left_sidebar!
7461
end
62+
end
7563

76-
# app/admin/comments.rb
77-
ActiveAdmin.register Comment do
78-
before_action :right_sidebar!
64+
# app/admin/comments.rb
65+
ActiveAdmin.register Comment do
66+
before_action do
67+
right_sidebar!
7968
end
69+
end
8070
```
8171

8272
## Global configuration
8373

84-
Moving sidebar to the left within all resource. Set configuration in `config/initializers/active_admin.rb`
74+
Move sidebar to the left for all resources in `config/initializers/active_admin.rb`:
8575

8676
```ruby
87-
# == Controller before-actions
88-
#
89-
# You can add before, after and around actions to all of your resources
90-
ActiveAdmin.setup do |config|
91-
config.before_action do
92-
left_sidebar! if respond_to?(:left_sidebar!)
93-
end
77+
ActiveAdmin.setup do |config|
78+
config.before_action do
79+
left_sidebar! if respond_to?(:left_sidebar!)
9480
end
81+
end
9582
```
9683

9784
## Collapsible sidebar
9885

9986
Add a toggle button to collapse/expand the sidebar. State is persisted per-resource across page navigations.
10087

10188
```ruby
102-
# Collapsible sidebar (starts expanded)
103-
left_sidebar!(collapsible: true)
104-
right_sidebar!(collapsible: true)
89+
# Collapsible sidebar (starts expanded)
90+
left_sidebar!(collapsible: true)
91+
right_sidebar!(collapsible: true)
10592

106-
# Collapsible sidebar (starts collapsed)
107-
left_sidebar!(collapsible: true, start_collapsed: true)
108-
right_sidebar!(collapsible: true, start_collapsed: true)
93+
# Collapsible sidebar (starts collapsed)
94+
left_sidebar!(collapsible: true, start_collapsed: true)
95+
right_sidebar!(collapsible: true, start_collapsed: true)
10996
```
11097

11198
![Demo](https://activeadmin-plugins.github.io/active_admin_sidebar/demo.gif "Collapsible sidebar demo")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module ActiveAdminSidebar
2-
VERSION = '2.0.0'.freeze
2+
VERSION = '3.0.0'.freeze
33
end

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@activeadmin-plugins/active_admin_sidebar",
3-
"version": "2.0.0",
3+
"version": "3.0.0",
44
"description": "Extension for ActiveAdmin gem to manage sidebar",
55
"main": "src/active_admin_sidebar.js",
66
"style": "src/active_admin_sidebar.scss",

0 commit comments

Comments
 (0)