-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
106 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Activeadmin::Mongoid | ||
# ActiveAdmin::Mongoid | ||
|
||
TODO: Write a gem description | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
# -*- encoding: utf-8 -*- | ||
# coding: utf-8 | ||
require File.expand_path('../lib/activeadmin-mongoid/version', __FILE__) | ||
|
||
Gem::Specification.new do |gem| | ||
gem.authors = ["Elia Schito"] | ||
gem.email = ["perlelia@gmail.com"] | ||
gem.description = %q{TODO: Write a gem description} | ||
gem.summary = %q{TODO: Write a gem summary} | ||
gem.homepage = "" | ||
gem.authors = ['Elia Schito'] | ||
gem.email = ['elia@schito.me'] | ||
gem.description = %q{ActiveAdmin hacks to support Mongoid (some ActiveAdmin features are disabled)} | ||
gem.summary = %q{ActiveAdmin hacks to support Mongoid} | ||
gem.homepage = '' | ||
|
||
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
gem.files = `git ls-files`.split("\n") | ||
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
gem.name = "activeadmin-mongoid" | ||
gem.require_paths = ["lib"] | ||
gem.version = Activeadmin::Mongoid::VERSION | ||
gem.name = 'activeadmin-mongoid' | ||
gem.require_paths = ['lib'] | ||
gem.version = ActiveAdmin::Mongoid::VERSION | ||
|
||
gem.add_runtime_dependency 'mongoid', '~> 2.0' | ||
gem.add_runtime_dependency 'activeadmin', '~> 0.4' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'activeadmin-mongoid/version' | ||
|
||
require 'active_admin' | ||
require 'active_admin/resource_controller' | ||
require 'active_admin/mongoid/form_builder' | ||
|
||
module ActiveAdmin::Mongoid | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'active_admin' | ||
require 'active_admin/mongoid/comments' | ||
require 'active_admin/mongoid/form_builder' | ||
require 'active_admin/mongoid/resource' | ||
require 'active_admin/mongoid/document' | ||
|
||
module ActiveAdmin::Mongoid | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module ActiveAdmin::Namespace | ||
# Disable comments | ||
def comments? | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module ActiveAdmin::Mongoid::Document | ||
extend ActiveSupport::Concern | ||
|
||
module ClassMethods | ||
def content_columns | ||
@content_columns ||= fields.map(&:second).select {|f| f.name !~ /(^_|^(created|updated)_at)/} | ||
end | ||
|
||
def columns | ||
@columns ||= fields.map(&:second) | ||
end | ||
|
||
def reorder *args | ||
scoped | ||
end | ||
end | ||
end | ||
|
||
Mongoid::Document.send :include, ActiveAdmin::Mongoid::Document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'active_admin/form_builder' | ||
|
||
class ActiveAdmin::FormBuilder | ||
def inputs(*args, &block) | ||
# Store that we are creating inputs without a block | ||
@inputs_with_block = block_given? ? true : false | ||
content = with_new_form_buffer do | ||
super | ||
# form_buffers.last | ||
end | ||
form_buffers.last << content.html_safe | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'active_admin/resource' | ||
require 'active_admin/resource_controller' | ||
|
||
module ActiveAdmin | ||
class Resource | ||
def resource_table_name | ||
resource.collection_name | ||
end | ||
|
||
# Disable filters | ||
def add_default_sidebar_sections | ||
end | ||
end | ||
|
||
ResourceController # autoload | ||
class ResourceController | ||
# Use #desc and #asc for sorting. | ||
def sort_order(chain) | ||
params[:order] ||= active_admin_config.sort_order | ||
table_name = active_admin_config.resource_table_name | ||
if params[:order] && params[:order] =~ /^([\w\_\.]+)_(desc|asc)$/ | ||
chain.send($2, $1) | ||
else | ||
chain # just return the chain | ||
end | ||
end | ||
|
||
# Disable filters | ||
def search(chain) | ||
chain | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module ActiveAdmin | ||
module Mongoid | ||
VERSION = '0.0.1' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
require "activeadmin-mongoid/version" | ||
|
||
module Activeadmin | ||
module Mongoid | ||
# Your code goes here... | ||
end | ||
end | ||
require 'active_admin-mongoid' |
This file was deleted.
Oops, something went wrong.
9a245c3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted you to know that you now have two versions of ActiveAdmin in the gemspec.