1- active_admin_sidebar
2- ====================
1+ # ActiveAdminSidebar
32
4- easy change sidebar position with activeadmin (tested with activeadmin ~> 1.0.0.pre)
3+ Provides ability to manipulate sidebar position with activeadmin (tested with activeadmin ~ > 1.0.0.pre)
54
65
76Add including of css file
87
8+ ``` scss
99 @import " active_admin_sidebar" ;
10+ ```
1011
11- to the app/assets/stylesheets/active_admin.css.scss
12+ to the
13+ ```
14+ app/assets/stylesheets/active_admin.css.scss
15+ ```
1216
1317And including of coffee file (optional, need only for collapsed sidebar)
1418
19+ ``` js
1520 // = require active_admin_sidebar
21+ ```
1622
17- to the app/assets/javascripts/active_admin.js
18-
23+ to the
24+ ```
25+ app/assets/javascripts/active_admin.js
26+ ```
1927
2028Changing sidebar position dynamically with before_filter
21-
29+ ``` ruby
2230 # app/admin/posts.rb
2331 ActiveAdmin .register Post do
2432 before_filter :left_sidebar! , only: [:show ]
@@ -28,12 +36,12 @@ Changing sidebar position dynamically with before_filter
2836 ActiveAdmin .register Comment do
2937 before_filter :right_sidebar!
3038 end
31-
39+ ```
3240
3341
3442Moving sidebar to the left within all resource (config/initializers/active_admin.rb)
3543
36-
44+ ``` ruby
3745 # == Controller Filters
3846 #
3947 # You can add before, after and around filters to all of your
@@ -42,24 +50,22 @@ Moving sidebar to the left within all resource (config/initializers/active_admin
4250 config.before_filter do
4351 left_sidebar! if respond_to?(:left_sidebar! )
4452 end
53+ ```
4554
4655Also you can use sidebar collapsing. It will add css icon in title of first sidebar will save current state in session
47-
56+ ``` ruby
4857 left_sidebar!(collapsed: true )
49-
58+ ```
5059You can override button color according to your color theme:
51-
60+ ``` css
5261 body .active_admin {
5362 #active _admin _content .left _sidebar , #active _admin _content .collapsed _sidebar {
5463 .collapse _btn , .uncollapse _btn {
55- cursor: pointer;
5664 background-color : #767270 ;
57- border-radius: 5px;
58- color: #ffffff;
5965 }
6066 }
6167 }
62-
68+ ```
6369
6470Example
6571
0 commit comments