activeadmin-mongomapper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in activeadmin-mongoid.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Doabit
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # ActiveAdmin::Mongomapper
2
+
3
+ Idea from [activeadmin-mongoid](https://github.com/elia/activeadmin-mongoid)
4
+
5
+ ActiveAdmin hacks to support Mongomapper.
6
+ Some ActiveAdmin features are disabled:
7
+
8
+ - comments
9
+ - sidebar filters
10
+
11
+ For more on Mongomapper support in ActiveAdmin see [this issue](https://github.com/gregbell/active_admin/issues/26).
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'mm-devise'
19
+ gem 'activeadmin-mongomapper'
20
+ ```
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
34
+
35
+ ## Copyright
36
+
37
+ Copyright © 2012 Doabit. See LICENSE for details.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/active_admin/mongo_mapper/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ['Doabit']
6
+ gem.email = ['doinsist@gmail.com']
7
+ gem.description = %q{ActiveAdmin hacks to support mongomapper (some ActiveAdmin features are disabled)}
8
+ gem.summary = %q{ActiveAdmin hacks to support mongomapper}
9
+ gem.homepage = ''
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = 'activeadmin-mongomapper'
15
+ gem.require_paths = ['lib']
16
+ gem.version = ActiveAdmin::MongoMapper::VERSION
17
+ gem.license = 'MIT'
18
+
19
+ gem.add_runtime_dependency 'mongo_mapper', '~> 0.11.1'
20
+ gem.add_runtime_dependency 'mm-devise', '~> 1.2'
21
+ gem.add_runtime_dependency 'activeadmin', '~> 0.4'
22
+ end
@@ -0,0 +1,21 @@
1
+ # require 'active_admin'
2
+
3
+ module ActiveAdmin
4
+ module MongoMapper
5
+ end
6
+
7
+ class << self
8
+ alias setup_without_mongo_mapper setup
9
+
10
+ # Load monkey patches *after* the setup process
11
+ def setup *args, &block
12
+ setup_without_mongo_mapper *args, &block
13
+
14
+ require 'active_admin/mongo_mapper/comments'
15
+ require 'active_admin/mongo_mapper/document'
16
+ require 'active_admin/mongo_mapper/resource'
17
+ require 'active_admin/mongo_mapper/resource_controller'
18
+ require 'active_admin/mongo_mapper/views'
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ module ActiveAdmin
2
+ class Namespace
3
+ def comments?
4
+ false
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ module ActiveAdmin
2
+ module MongoMapper
3
+ module Document
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+ def content_columns
8
+ @content_columns ||= keys.map(&:second).select {|f| f.name !~ /(^_|^(created|updated)_at)/}
9
+ end
10
+
11
+ def columns
12
+ @columns ||= keys.map(&:second)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ MongoMapper::Document.plugin ActiveAdmin::MongoMapper::Document
@@ -0,0 +1,11 @@
1
+ module ActiveAdmin
2
+ class Resource
3
+ def resource_table_name
4
+ resource_class.collection_name
5
+ end
6
+
7
+ # Disable filters
8
+ def add_default_sidebar_sections
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ module ActiveAdmin
2
+ class ResourceController
3
+ def sort_order(chain)
4
+ params[:order] ||= active_admin_config.sort_order
5
+ if params[:order] && params[:order] =~ /^([\w\_\.]+)_(desc|asc)$/
6
+ chain.send(:sort, $1.to_sym.send($2))
7
+ else
8
+ chain
9
+ end
10
+ end
11
+
12
+ # Disable filters
13
+ def search(chain)
14
+ chain
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module ActiveAdmin
2
+ module MongoMapper
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ module ActiveAdmin
2
+ module Views
3
+ module Pages
4
+ class Index
5
+ protected
6
+ def items_in_collection?
7
+ collection.limit(1).exists?
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ require 'active_admin/mongo_mapper'
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeadmin-mongomapper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Doabit
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mongo_mapper
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.11.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.11.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: mm-devise
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.2'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.2'
46
+ - !ruby/object:Gem::Dependency
47
+ name: activeadmin
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '0.4'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
62
+ description: ActiveAdmin hacks to support mongomapper (some ActiveAdmin features are
63
+ disabled)
64
+ email:
65
+ - doinsist@gmail.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - Gemfile
72
+ - LICENSE
73
+ - README.md
74
+ - Rakefile
75
+ - activeadmin-mongomapper.gemspec
76
+ - lib/active_admin/mongo_mapper.rb
77
+ - lib/active_admin/mongo_mapper/comments.rb
78
+ - lib/active_admin/mongo_mapper/document.rb
79
+ - lib/active_admin/mongo_mapper/resource.rb
80
+ - lib/active_admin/mongo_mapper/resource_controller.rb
81
+ - lib/active_admin/mongo_mapper/version.rb
82
+ - lib/active_admin/mongo_mapper/views.rb
83
+ - lib/activeadmin-mongomapper.rb
84
+ homepage: ''
85
+ licenses:
86
+ - MIT
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 1.8.21
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: ActiveAdmin hacks to support mongomapper
109
+ test_files: []
110
+ has_rdoc: