activeadmin-mongoid 0.0.2.jpmckinney.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -4
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/Gemfile +27 -1
- data/README.md +0 -5
- data/Rakefile +6 -1
- data/activeadmin-mongoid.gemspec +8 -4
- data/lib/active_admin/mongoid.rb +26 -17
- data/lib/active_admin/mongoid/adaptor.rb +65 -0
- data/lib/active_admin/mongoid/comments.rb +12 -5
- data/lib/active_admin/mongoid/criteria.rb +10 -0
- data/lib/active_admin/mongoid/document.rb +43 -2
- data/lib/active_admin/mongoid/filter_form_builder.rb +31 -0
- data/lib/active_admin/mongoid/generators/install.rb +7 -0
- data/lib/active_admin/mongoid/helpers/collection.rb +10 -0
- data/lib/active_admin/mongoid/resource.rb +51 -33
- data/lib/active_admin/mongoid/version.rb +1 -1
- data/lib/tasks/activeadmin-mongoid_tasks.rake +4 -0
- data/spec/features/smoke_spec.rb +60 -0
- data/spec/spec_helper.rb +42 -0
- data/spec/support/capybara.rb +1 -0
- data/tasks/js.rake +32 -0
- data/tasks/test.rake +75 -0
- data/test_app/.gitignore +15 -0
- data/test_app/.rspec +1 -0
- data/test_app/README.rdoc +261 -0
- data/test_app/Rakefile +7 -0
- data/test_app/app/admin/admin_users.rb +20 -0
- data/test_app/app/admin/dashboard.rb +33 -0
- data/test_app/app/admin/posts.rb +3 -0
- data/test_app/app/assets/images/rails.png +0 -0
- data/test_app/app/assets/javascripts/active_admin.js +1 -0
- data/test_app/app/assets/javascripts/application.js +15 -0
- data/test_app/app/assets/stylesheets/active_admin.css.scss +29 -0
- data/test_app/app/assets/stylesheets/application.css +13 -0
- data/test_app/app/controllers/application_controller.rb +3 -0
- data/test_app/app/helpers/application_helper.rb +2 -0
- data/test_app/app/mailers/.gitkeep +0 -0
- data/test_app/app/models/.gitkeep +0 -0
- data/test_app/app/models/admin_user.rb +40 -0
- data/test_app/app/models/post.rb +6 -0
- data/test_app/app/views/layouts/application.html.erb +14 -0
- data/test_app/config.ru +4 -0
- data/test_app/config/_link_mongoid_config.rb +7 -0
- data/test_app/config/application.rb +70 -0
- data/test_app/config/boot.rb +6 -0
- data/test_app/config/database.yml +25 -0
- data/test_app/config/environment.rb +5 -0
- data/test_app/config/environments/development.rb +31 -0
- data/test_app/config/environments/production.rb +64 -0
- data/test_app/config/environments/test.rb +35 -0
- data/test_app/config/initializers/active_admin.rb +210 -0
- data/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test_app/config/initializers/devise.rb +246 -0
- data/test_app/config/initializers/inflections.rb +15 -0
- data/test_app/config/initializers/mime_types.rb +5 -0
- data/test_app/config/initializers/secret_token.rb +7 -0
- data/test_app/config/initializers/session_store.rb +8 -0
- data/test_app/config/initializers/wrap_parameters.rb +10 -0
- data/test_app/config/locales/devise.en.yml +59 -0
- data/test_app/config/locales/en.yml +5 -0
- data/test_app/config/mongoid.2.yml +20 -0
- data/test_app/config/mongoid.3.yml +96 -0
- data/test_app/config/routes.rb +4 -0
- data/test_app/db/migrate/20130514223107_create_admin_notes.rb +17 -0
- data/test_app/db/migrate/20130514223108_move_admin_notes_to_comments.rb +26 -0
- data/test_app/db/seeds.rb +7 -0
- data/test_app/lib/assets/.gitkeep +0 -0
- data/test_app/lib/tasks/.gitkeep +0 -0
- data/test_app/log/.gitkeep +0 -0
- data/test_app/public/404.html +26 -0
- data/test_app/public/422.html +26 -0
- data/test_app/public/500.html +25 -0
- data/test_app/public/favicon.ico +0 -0
- data/test_app/public/index.html +241 -0
- data/test_app/public/robots.txt +5 -0
- data/test_app/script/rails +6 -0
- data/test_app/spec/models/admin_user_spec.rb +5 -0
- data/test_app/test/fixtures/.gitkeep +0 -0
- data/test_app/test/functional/.gitkeep +0 -0
- data/test_app/test/integration/.gitkeep +0 -0
- data/test_app/test/performance/browsing_test.rb +12 -0
- data/test_app/test/test_helper.rb +7 -0
- data/test_app/test/unit/.gitkeep +0 -0
- data/test_app/vendor/assets/javascripts/.gitkeep +0 -0
- data/test_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test_app/vendor/plugins/.gitkeep +0 -0
- metadata +136 -29
data/test_app/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
TestApp::Application.load_tasks
|
@@ -0,0 +1,20 @@
|
|
1
|
+
ActiveAdmin.register AdminUser do
|
2
|
+
index do
|
3
|
+
column :email
|
4
|
+
column :current_sign_in_at
|
5
|
+
column :last_sign_in_at
|
6
|
+
column :sign_in_count
|
7
|
+
default_actions
|
8
|
+
end
|
9
|
+
|
10
|
+
filter :email
|
11
|
+
|
12
|
+
form do |f|
|
13
|
+
f.inputs "Admin Details" do
|
14
|
+
f.input :email
|
15
|
+
f.input :password
|
16
|
+
f.input :password_confirmation
|
17
|
+
end
|
18
|
+
f.actions
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
ActiveAdmin.register_page "Dashboard" do
|
2
|
+
|
3
|
+
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
|
4
|
+
|
5
|
+
content :title => proc{ I18n.t("active_admin.dashboard") } do
|
6
|
+
div :class => "blank_slate_container", :id => "dashboard_default_message" do
|
7
|
+
span :class => "blank_slate" do
|
8
|
+
span I18n.t("active_admin.dashboard_welcome.welcome")
|
9
|
+
small I18n.t("active_admin.dashboard_welcome.call_to_action")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Here is an example of a simple dashboard with columns and panels.
|
14
|
+
#
|
15
|
+
# columns do
|
16
|
+
# column do
|
17
|
+
# panel "Recent Posts" do
|
18
|
+
# ul do
|
19
|
+
# Post.recent(5).map do |post|
|
20
|
+
# li link_to(post.title, admin_post_path(post))
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
# column do
|
27
|
+
# panel "Info" do
|
28
|
+
# para "Welcome to ActiveAdmin."
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
end # content
|
33
|
+
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require active_admin/base
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// SASS variable overrides must be declared before loading up Active Admin's styles.
|
2
|
+
//
|
3
|
+
// To view the variables that Active Admin provides, take a look at
|
4
|
+
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the
|
5
|
+
// Active Admin source.
|
6
|
+
//
|
7
|
+
// For example, to change the sidebar width:
|
8
|
+
// $sidebar-width: 242px;
|
9
|
+
|
10
|
+
// Active Admin's got SASS!
|
11
|
+
@import "active_admin/mixins";
|
12
|
+
@import "active_admin/base";
|
13
|
+
|
14
|
+
// Overriding any non-variable SASS must be done after the fact.
|
15
|
+
// For example, to change the default status-tag color:
|
16
|
+
//
|
17
|
+
// body.active_admin {
|
18
|
+
// .status_tag { background: #6090DB; }
|
19
|
+
// }
|
20
|
+
//
|
21
|
+
// Notice that Active Admin CSS rules are nested within a
|
22
|
+
// 'body.active_admin' selector to prevent conflicts with
|
23
|
+
// other pages in the app. It is best to wrap your changes in a
|
24
|
+
// namespace so they are properly recognized. You have options
|
25
|
+
// if you e.g. want different styles for different namespaces:
|
26
|
+
//
|
27
|
+
// .active_admin applies to any Active Admin namespace
|
28
|
+
// .admin_namespace applies to the admin namespace (eg: /admin)
|
29
|
+
// .other_namespace applies to a custom namespace named other (eg: /other)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
File without changes
|
File without changes
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class AdminUser
|
2
|
+
include Mongoid::Document
|
3
|
+
# Include default devise modules. Others available are:
|
4
|
+
# :token_authenticatable, :confirmable,
|
5
|
+
# :lockable, :timeoutable and :omniauthable
|
6
|
+
devise :database_authenticatable,
|
7
|
+
:recoverable, :rememberable, :trackable, :validatable
|
8
|
+
|
9
|
+
## Database authenticatable
|
10
|
+
field :email, :type => String, :default => ""
|
11
|
+
field :encrypted_password, :type => String, :default => ""
|
12
|
+
|
13
|
+
## Recoverable
|
14
|
+
field :reset_password_token, :type => String
|
15
|
+
field :reset_password_sent_at, :type => Time
|
16
|
+
|
17
|
+
## Rememberable
|
18
|
+
field :remember_created_at, :type => Time
|
19
|
+
|
20
|
+
## Trackable
|
21
|
+
field :sign_in_count, :type => Integer, :default => 0
|
22
|
+
field :current_sign_in_at, :type => Time
|
23
|
+
field :last_sign_in_at, :type => Time
|
24
|
+
field :current_sign_in_ip, :type => String
|
25
|
+
field :last_sign_in_ip, :type => String
|
26
|
+
|
27
|
+
## Confirmable
|
28
|
+
# field :confirmation_token, :type => String
|
29
|
+
# field :confirmed_at, :type => Time
|
30
|
+
# field :confirmation_sent_at, :type => Time
|
31
|
+
# field :unconfirmed_email, :type => String # Only if using reconfirmable
|
32
|
+
|
33
|
+
## Lockable
|
34
|
+
# field :failed_attempts, :type => Integer, :default => 0 # Only if lock strategy is :failed_attempts
|
35
|
+
# field :unlock_token, :type => String # Only if unlock strategy is :email or :both
|
36
|
+
# field :locked_at, :type => Time
|
37
|
+
|
38
|
+
## Token authenticatable
|
39
|
+
# field :authentication_token, :type => String
|
40
|
+
end
|
data/test_app/config.ru
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
root = Pathname(File.expand_path('../..', __FILE__))
|
3
|
+
version = Mongoid::VERSION.to_i
|
4
|
+
|
5
|
+
current_config = root.join("config/mongoid.#{version}.yml").read
|
6
|
+
config_file = root.join('config/mongoid.yml')
|
7
|
+
config_file.open('w') {|c| c << current_config }
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path('../_link_mongoid_config', __FILE__)
|
2
|
+
require File.expand_path('../boot', __FILE__)
|
3
|
+
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
# require "active_record/railtie"
|
6
|
+
require "action_controller/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
require "active_resource/railtie"
|
9
|
+
require "sprockets/railtie"
|
10
|
+
require "rails/test_unit/railtie"
|
11
|
+
|
12
|
+
if defined?(Bundler)
|
13
|
+
# If you precompile assets before deploying to production, use this line
|
14
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
15
|
+
# If you want your assets lazily compiled in production, use this line
|
16
|
+
# Bundler.require(:default, :assets, Rails.env)
|
17
|
+
end
|
18
|
+
|
19
|
+
module TestApp
|
20
|
+
class Application < Rails::Application
|
21
|
+
# Settings in config/environments/* take precedence over those specified here.
|
22
|
+
# Application configuration should go into files in config/initializers
|
23
|
+
# -- all .rb files in that directory are automatically loaded.
|
24
|
+
|
25
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
26
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
27
|
+
|
28
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
29
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
30
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
31
|
+
|
32
|
+
# Activate observers that should always be running.
|
33
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
34
|
+
|
35
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
36
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
37
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
38
|
+
|
39
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
40
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
41
|
+
# config.i18n.load_path += ['/Users/elia/.rvm/gems/ruby-2.0.0-p0/gems/activeadmin-0.6.0/lib/active_admin/locales/en.yml']
|
42
|
+
config.i18n.default_locale = :en
|
43
|
+
|
44
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
45
|
+
config.encoding = "utf-8"
|
46
|
+
|
47
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
48
|
+
config.filter_parameters += [:password]
|
49
|
+
|
50
|
+
# Enable escaping HTML in JSON.
|
51
|
+
config.active_support.escape_html_entities_in_json = true
|
52
|
+
|
53
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
54
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
55
|
+
# like if you have constraints or database-specific column types
|
56
|
+
# config.active_record.schema_format = :sql
|
57
|
+
|
58
|
+
# Enforce whitelist mode for mass assignment.
|
59
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
60
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
61
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
62
|
+
# config.active_record.whitelist_attributes = true
|
63
|
+
|
64
|
+
# Enable the asset pipeline
|
65
|
+
config.assets.enabled = true
|
66
|
+
|
67
|
+
# Version of your assets, change this if you want to expire all your assets
|
68
|
+
config.assets.version = '1.0'
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: ":memory:"
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,31 @@
|
|
1
|
+
TestApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
|
26
|
+
# Do not compress assets
|
27
|
+
config.assets.compress = false
|
28
|
+
|
29
|
+
# Expands the lines which load the assets
|
30
|
+
config.assets.debug = true
|
31
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
TestApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
+
config.serve_static_assets = false
|
13
|
+
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
+
config.assets.compile = false
|
19
|
+
|
20
|
+
# Generate digests for assets URLs
|
21
|
+
config.assets.digest = true
|
22
|
+
|
23
|
+
# Defaults to nil and saved in location specified by config.assets.prefix
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
25
|
+
|
26
|
+
# Specifies the header that your server uses for sending files
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
+
|
30
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
+
# config.force_ssl = true
|
32
|
+
|
33
|
+
# See everything in the log (default is :info)
|
34
|
+
# config.log_level = :debug
|
35
|
+
|
36
|
+
# Prepend all log lines with the following tags
|
37
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
38
|
+
|
39
|
+
# Use a different logger for distributed setups
|
40
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
|
+
|
42
|
+
# Use a different cache store in production
|
43
|
+
# config.cache_store = :mem_cache_store
|
44
|
+
|
45
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
46
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
47
|
+
|
48
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
49
|
+
# config.assets.precompile += %w( search.js )
|
50
|
+
|
51
|
+
# Disable delivery errors, bad email addresses will be ignored
|
52
|
+
# config.action_mailer.raise_delivery_errors = false
|
53
|
+
|
54
|
+
# Enable threaded mode
|
55
|
+
# config.threadsafe!
|
56
|
+
|
57
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
+
# the I18n.default_locale when a translation can not be found)
|
59
|
+
config.i18n.fallbacks = true
|
60
|
+
|
61
|
+
# Send deprecation notices to registered listeners
|
62
|
+
config.active_support.deprecation = :notify
|
63
|
+
|
64
|
+
end
|