activeadmin-mongoid 0.0.1 → 0.0.2.jpmckinney.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,11 +10,16 @@ For more on Mongoid support in ActiveAdmin see [this issue](https://github.com/g
10
10
 
11
11
  ## Installation
12
12
 
13
- Add this line to your application's Gemfile:
13
+ ### Some Gems
14
+ Add the following gems to your application's Gemfile:
14
15
 
15
16
  ```ruby
16
17
  gem 'activeadmin-mongoid'
18
+ gem 'devise'
17
19
  ```
20
+ Devise is the gem used to managed admin authentication.
21
+ The gem is required to force itself ORM configuration.
22
+ Else the gem will try to use by default ActiveRecord ORM.
18
23
 
19
24
  You can safely remove the following lines, since are already activeadmin-mongoid dependencies:
20
25
 
@@ -24,10 +29,46 @@ gem 'meta_search', '>= 1.1.0.pre'
24
29
  gem 'sass-rails', ['~> 3.1', '>= 3.1.4']
25
30
  ```
26
31
 
27
- And then execute:
32
+ ### Remove Application Dependencies
33
+ In your config/application.rb, replace :
34
+
35
+ ```ruby
36
+ require 'rails/all'
37
+ ```
38
+
39
+ with :
40
+
41
+ ```ruby
42
+ require "action_controller/railtie"
43
+ require "action_mailer/railtie"
44
+ require "active_resource/railtie"
45
+ require "sprockets/railtie"
46
+ require "rails/test_unit/railtie"
47
+ ```
48
+
49
+ rails/all includes elements requiring ActiveRecord::Connection ...
50
+
51
+ ### Bundle & Crank
52
+
53
+ Execute:
28
54
 
29
55
  $ bundle
56
+ $ rails g devise:install
57
+ $ rails g active_admin:install
58
+
59
+ Check that the generated initializers/devise.rb file requires mongoid orm.
60
+ You may find a line like this :
61
+
62
+ ```ruby
63
+ require 'devise/orm/mongoid'
64
+ ```
65
+
66
+ Then create the admin user:
67
+
68
+ $ rails console
69
+ >> AdminUser.create :email => 'admin@example.com', :password => 'password', :password_confirmation => 'password'
30
70
 
71
+ And that's pretty much it !
31
72
 
32
73
  ## Contributing
33
74
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.version = ActiveAdmin::Mongoid::VERSION
17
17
  gem.license = 'MIT'
18
18
 
19
- gem.add_runtime_dependency 'mongoid', '~> 2.0'
19
+ gem.add_runtime_dependency 'mongoid', '>= 2.0'
20
20
  gem.add_runtime_dependency 'activeadmin', '~> 0.4'
21
21
  gem.add_runtime_dependency 'meta_search', '>= 1.1.0.pre'
22
22
  gem.add_runtime_dependency 'sass-rails', ['~> 3.1', '>= 3.1.4']
@@ -1,5 +1,3 @@
1
- require 'mongoid'
2
-
3
1
  module ActiveAdmin::Mongoid::Document
4
2
  extend ActiveSupport::Concern
5
3
 
@@ -1,24 +1,26 @@
1
- require 'active_admin'
2
- require 'inherited_resources'
3
-
4
1
  ActiveAdmin::Resource # autoload
5
2
  class ActiveAdmin::Resource
6
3
  def resource_table_name
7
- resource.collection_name
8
- end
9
-
10
- # Disable filters
11
- def add_default_sidebar_sections
4
+ resource_class.collection_name
12
5
  end
13
6
  end
14
7
 
15
8
  ActiveAdmin::ResourceController # autoload
16
9
  class ActiveAdmin::ResourceController
10
+ before_filter :skip_sidebar!
11
+
12
+ protected
13
+
14
+ # @todo remove once https://github.com/gregbell/active_admin/pull/1454 is merged
15
+ def skip_sidebar!
16
+ @skip_sidebar = true
17
+ end
18
+
17
19
  # Use #desc and #asc for sorting.
18
20
  def sort_order(chain)
19
21
  params[:order] ||= active_admin_config.sort_order
20
- table_name = active_admin_config.resource_table_name
21
- if params[:order] && params[:order] =~ /^([\w\_\.]+)_(desc|asc)$/
22
+ # @todo remove once https://github.com/mongoid/mongoid/pull/2175 is fixed
23
+ if params[:order] && params[:order] != 'id_desc' && params[:order] =~ /^([\w\_\.]+)_(desc|asc)$/
22
24
  chain.send($2, $1)
23
25
  else
24
26
  chain # just return the chain
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module Mongoid
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2.jpmckinney.0'
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require 'active_admin'
2
+ require 'mongoid'
2
3
 
3
4
  module ActiveAdmin
4
5
  module Mongoid
@@ -12,7 +13,6 @@ module ActiveAdmin
12
13
  setup_without_mongoid *args, &block
13
14
 
14
15
  require 'active_admin/mongoid/comments'
15
- require 'active_admin/mongoid/form_builder'
16
16
  require 'active_admin/mongoid/resource'
17
17
  require 'active_admin/mongoid/document'
18
18
  end
metadata CHANGED
@@ -1,30 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2.jpmckinney.0
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Elia Schito
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-17 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
16
- requirement: &70117976268100 !ruby/object:Gem::Requirement
16
+ requirement: &70246963106980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70117976268100
24
+ version_requirements: *70246963106980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activeadmin
27
- requirement: &70117976267460 !ruby/object:Gem::Requirement
27
+ requirement: &70246963106240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.4'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70117976267460
35
+ version_requirements: *70246963106240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: meta_search
38
- requirement: &70117976266920 !ruby/object:Gem::Requirement
38
+ requirement: &70246963105180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.1.0.pre
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70117976266920
46
+ version_requirements: *70246963105180
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sass-rails
49
- requirement: &70117976266280 !ruby/object:Gem::Requirement
49
+ requirement: &70246963104520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: 3.1.4
58
58
  type: :runtime
59
59
  prerelease: false
60
- version_requirements: *70117976266280
60
+ version_requirements: *70246963104520
61
61
  description: ActiveAdmin hacks to support Mongoid (some ActiveAdmin features are disabled)
62
62
  email:
63
63
  - elia@schito.me
@@ -75,7 +75,6 @@ files:
75
75
  - lib/active_admin/mongoid.rb
76
76
  - lib/active_admin/mongoid/comments.rb
77
77
  - lib/active_admin/mongoid/document.rb
78
- - lib/active_admin/mongoid/form_builder.rb
79
78
  - lib/active_admin/mongoid/resource.rb
80
79
  - lib/active_admin/mongoid/version.rb
81
80
  - lib/activeadmin-mongoid.rb
@@ -95,9 +94,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
94
  required_rubygems_version: !ruby/object:Gem::Requirement
96
95
  none: false
97
96
  requirements:
98
- - - ! '>='
97
+ - - ! '>'
99
98
  - !ruby/object:Gem::Version
100
- version: '0'
99
+ version: 1.3.1
101
100
  requirements: []
102
101
  rubyforge_project:
103
102
  rubygems_version: 1.8.17
@@ -105,3 +104,4 @@ signing_key:
105
104
  specification_version: 3
106
105
  summary: ActiveAdmin hacks to support Mongoid
107
106
  test_files: []
107
+ has_rdoc:
@@ -1,13 +0,0 @@
1
- require 'active_admin/form_builder'
2
-
3
- class ActiveAdmin::FormBuilder
4
- def inputs(*args, &block)
5
- # Store that we are creating inputs without a block
6
- @inputs_with_block = block_given? ? true : false
7
- content = with_new_form_buffer do
8
- super
9
- # form_buffers.last
10
- end
11
- form_buffers.last << content.html_safe
12
- end
13
- end