active_admin_sidebar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+ # Specify your gem's dependencies in active_admin_sidebar.gemspec
3
+
4
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,30 @@
1
+ active_admin_sidebar
2
+ ====================
3
+
4
+ easy change sidebar position with activeadmin
5
+
6
+
7
+ 1) change sidebar position dynamically with before_filter
8
+
9
+ # app/admin/posts.rb
10
+ ActiveAdmin.register Post do
11
+ before_filter :sidebar_left!
12
+ end
13
+
14
+ # app/admin/comments.rb
15
+ ActiveAdmin.register Comment do
16
+ before_filter :sidebar_right!
17
+ end
18
+
19
+
20
+
21
+ 2) move sidebar to left within all resource
22
+
23
+
24
+ # == Controller Filters
25
+ #
26
+ # You can add before, after and around filters to all of your
27
+ # Active Admin resources from here.
28
+ #
29
+ config.before_filter :sidebar_left!
30
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "active_admin_sidebar/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "active_admin_sidebar"
7
+ s.version = ActiveAdminSidebar::VERSION
8
+ s.authors = ["Igor"]
9
+ s.email = ["fedoronchuk@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{active_admin_sidebar gem}
12
+ s.description = %q{extension for activeadmin gem to manage sidebar}
13
+
14
+ s.add_dependency "activeadmin"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ end
@@ -0,0 +1,17 @@
1
+ body.active_admin #active_admin_content.left_sidebar #sidebar{
2
+ float: left;
3
+ margin-left: 0;
4
+
5
+ }
6
+ body.active_admin #active_admin_content.left_sidebar #main_content_wrapper{
7
+ float:left;
8
+ width:70%;
9
+ margin-right:0;
10
+ margin-left:5px;
11
+ margin-left:5px;
12
+ float:left;
13
+ }
14
+
15
+ body.active_admin #active_admin_content.left_sidebar #main_content_wrapper #main_content{
16
+ margin:0;
17
+ }
@@ -0,0 +1,31 @@
1
+ class ActiveAdmin::Views::Pages::Base < Arbre::HTML::Document
2
+
3
+ def build_page_content
4
+ build_flash_messages
5
+ classes = Arbre::HTML::ClassList.new
6
+
7
+ classes << 'without_sidebar' if skip_sidebar?
8
+ classes << 'with_sidebar' unless skip_sidebar?
9
+ classes << 'left_sidebar' if left_sidebar?
10
+
11
+ div :id => "active_admin_content", :class => classes do
12
+
13
+ build_sidebar unless skip_sidebar? || right_sidebar?
14
+ build_main_content_wrapper
15
+ build_sidebar unless skip_sidebar? || left_sidebar?
16
+
17
+ end
18
+ end
19
+
20
+
21
+ def left_sidebar?
22
+ assigns[:sidebar_position] == :left
23
+ end
24
+
25
+ def right_sidebar?
26
+ !left_sidebar?
27
+ end
28
+
29
+
30
+
31
+ end
@@ -0,0 +1,11 @@
1
+ module ActiveAdminSidebar
2
+ module Positions
3
+ def left_sidebar!
4
+ @sidebar_position = :left
5
+ end
6
+ def right_sidebar!
7
+ @sidebar_position = :right
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveAdminSidebar
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'active_admin'
2
+ require "active_admin_sidebar/version"
3
+ require 'active_admin_sidebar/activeadmin_views_pages_base'
4
+ require 'active_admin_sidebar/positions'
5
+
6
+ module ActiveAdminSidebar
7
+ class Engine < Rails::Engine
8
+ config.after_initialize do
9
+ ActiveAdmin::ResourceController.send :include, ActiveAdminSidebar::Positions
10
+ end
11
+ end
12
+ end
13
+
14
+
15
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_admin_sidebar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Igor
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activeadmin
16
+ requirement: &70222216838700 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70222216838700
25
+ description: extension for activeadmin gem to manage sidebar
26
+ email:
27
+ - fedoronchuk@gmail.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - Gemfile
33
+ - README.rdoc
34
+ - Rakefile
35
+ - active_admin_sidebar.gemspec
36
+ - app/assets/stylesheets/active_admin_sidebar/index.css
37
+ - lib/active_admin_sidebar.rb
38
+ - lib/active_admin_sidebar/activeadmin_views_pages_base.rb
39
+ - lib/active_admin_sidebar/positions.rb
40
+ - lib/active_admin_sidebar/version.rb
41
+ homepage: ''
42
+ licenses: []
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 1.8.17
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: active_admin_sidebar gem
65
+ test_files: []
66
+ has_rdoc: