activeadmin 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +15 -1
- data/Gemfile +41 -11
- data/LICENSE +5 -0
- data/README.rdoc +202 -87
- data/Rakefile +51 -15
- data/activeadmin.gemspec +310 -131
- data/cucumber.yml +1 -0
- data/features/comments/commenting.feature +81 -0
- data/features/comments/viewing_index.feature +19 -0
- data/features/edit_page.feature +77 -0
- data/features/first_boot.feature +16 -0
- data/features/global_navigation.feature +30 -0
- data/features/index/formats.feature +10 -0
- data/features/index/index_as_block.feature +15 -0
- data/features/index/index_as_blog.feature +50 -0
- data/features/index/index_as_grid.feature +45 -0
- data/features/index/index_as_table.feature +79 -0
- data/features/index/index_scopes.feature +52 -0
- data/features/index/pagination.feature +23 -0
- data/features/new_page.feature +75 -0
- data/features/registering_assets.feature +35 -0
- data/features/registering_resources.feature +33 -0
- data/features/show/default_content.feature +43 -0
- data/features/show/page_title.feature +33 -0
- data/features/sidebar_sections.feature +128 -0
- data/features/specifying_actions.feature +16 -0
- data/features/step_definitions/action_item_steps.rb +7 -0
- data/features/step_definitions/additional_web_steps.rb +67 -0
- data/features/step_definitions/asset_steps.rb +7 -0
- data/features/step_definitions/attribute_steps.rb +15 -0
- data/features/step_definitions/comment_steps.rb +8 -0
- data/features/step_definitions/configuration_steps.rb +31 -0
- data/features/step_definitions/factory_steps.rb +28 -0
- data/features/step_definitions/flash_steps.rb +3 -0
- data/features/step_definitions/format_steps.rb +7 -0
- data/features/step_definitions/index_scope_steps.rb +20 -0
- data/features/step_definitions/pagination_steps.rb +8 -0
- data/features/step_definitions/sidebar_steps.rb +11 -0
- data/features/step_definitions/tab_steps.rb +3 -0
- data/features/step_definitions/user_steps.rb +20 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/env.rb +88 -0
- data/features/support/paths.rb +48 -0
- data/features/users/logging_in.feature +34 -0
- data/features/users/logging_out.feature +13 -0
- data/lib/active_admin.rb +155 -79
- data/lib/active_admin/abstract_view_factory.rb +95 -0
- data/lib/active_admin/action_items.rb +4 -15
- data/lib/active_admin/arbre.rb +23 -0
- data/lib/active_admin/arbre/attributes.rb +20 -0
- data/lib/active_admin/arbre/class_list.rb +28 -0
- data/lib/active_admin/arbre/collection.rb +27 -0
- data/lib/active_admin/arbre/context.rb +8 -0
- data/lib/active_admin/arbre/core_extensions.rb +5 -0
- data/lib/active_admin/arbre/document.rb +42 -0
- data/lib/active_admin/arbre/element.rb +151 -0
- data/lib/active_admin/arbre/html.rb +84 -0
- data/lib/active_admin/arbre/html5_elements.rb +47 -0
- data/lib/active_admin/arbre/tag.rb +129 -0
- data/lib/active_admin/arbre/text_node.rb +35 -0
- data/lib/active_admin/callbacks.rb +87 -0
- data/lib/active_admin/comments.rb +73 -0
- data/lib/active_admin/comments/comment.rb +15 -0
- data/lib/active_admin/comments/configuration.rb +16 -0
- data/lib/active_admin/comments/namespace_helper.rb +14 -0
- data/lib/active_admin/comments/resource_helper.rb +17 -0
- data/lib/active_admin/comments/show_page_helper.rb +23 -0
- data/lib/active_admin/comments/views.rb +3 -0
- data/lib/active_admin/comments/views/active_admin_comment.rb +0 -0
- data/lib/active_admin/comments/views/active_admin_comments.rb +82 -0
- data/lib/active_admin/component.rb +22 -0
- data/lib/active_admin/controller_action.rb +12 -0
- data/lib/active_admin/dashboards.rb +0 -2
- data/lib/active_admin/dashboards/dashboard_controller.rb +10 -5
- data/lib/active_admin/dashboards/section.rb +5 -14
- data/lib/active_admin/devise.rb +43 -0
- data/lib/active_admin/dsl.rb +202 -0
- data/lib/active_admin/event.rb +31 -0
- data/lib/active_admin/form_builder.rb +68 -50
- data/lib/active_admin/iconic.rb +51 -0
- data/lib/active_admin/iconic/icons.rb +142 -0
- data/lib/active_admin/namespace.rb +102 -16
- data/lib/active_admin/renderer.rb +18 -3
- data/lib/active_admin/resource.rb +110 -9
- data/lib/active_admin/resource/belongs_to.rb +31 -0
- data/lib/active_admin/resource_controller.rb +45 -260
- data/lib/active_admin/resource_controller/action_builder.rb +21 -0
- data/lib/active_admin/resource_controller/actions.rb +53 -0
- data/lib/active_admin/resource_controller/callbacks.rb +47 -0
- data/lib/active_admin/resource_controller/collection.rb +142 -0
- data/lib/active_admin/resource_controller/filters.rb +58 -0
- data/lib/active_admin/resource_controller/form.rb +42 -0
- data/lib/active_admin/resource_controller/menu.rb +29 -0
- data/lib/active_admin/resource_controller/page_configurations.rb +53 -0
- data/lib/active_admin/resource_controller/scoping.rb +36 -0
- data/lib/active_admin/resource_controller/sidebars.rb +38 -0
- data/lib/active_admin/scope.rb +17 -0
- data/lib/active_admin/sidebar.rb +8 -47
- data/lib/active_admin/stylesheets/active_admin.scss +418 -0
- data/lib/active_admin/stylesheets/active_admin/_comments.scss +40 -0
- data/lib/active_admin/stylesheets/active_admin/_flash_messages.scss +13 -0
- data/lib/active_admin/stylesheets/active_admin/_forms.scss +168 -0
- data/lib/active_admin/stylesheets/active_admin/_header.scss +108 -0
- data/lib/active_admin/stylesheets/active_admin/_typography.scss +100 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_all.scss +8 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_buttons.scss +27 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_gradients.scss +21 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_icons.scss +20 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_reset.scss +165 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_rounded.scss +43 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_sections.scss +27 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_shadows.scss +21 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_variables.scss +12 -0
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_factory.rb +21 -0
- data/lib/active_admin/view_helpers.rb +17 -100
- data/lib/active_admin/view_helpers/assigns_with_indifferent_access_helper.rb +7 -0
- data/lib/active_admin/view_helpers/auto_link_helper.rb +41 -0
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +29 -0
- data/lib/active_admin/view_helpers/display_helper.rb +38 -0
- data/lib/active_admin/view_helpers/filter_form_helper.rb +174 -0
- data/lib/active_admin/view_helpers/form_helper.rb +12 -0
- data/lib/active_admin/view_helpers/icon_helper.rb +12 -0
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +26 -0
- data/lib/active_admin/view_helpers/renderer_helper.rb +29 -0
- data/lib/active_admin/view_helpers/sidebar_helper.rb +15 -0
- data/lib/active_admin/view_helpers/status_tag_helper.rb +13 -0
- data/lib/active_admin/view_helpers/table_helper.rb +12 -0
- data/lib/active_admin/view_helpers/title_helper.rb +11 -0
- data/lib/active_admin/view_helpers/view_factory_helper.rb +11 -0
- data/lib/active_admin/views.rb +8 -0
- data/lib/active_admin/views/action_items.rb +17 -0
- data/lib/active_admin/views/components/attributes_table.rb +66 -0
- data/lib/active_admin/views/components/columns.rb +49 -0
- data/lib/active_admin/views/components/paginated_collection.rb +74 -0
- data/lib/active_admin/views/components/panel.rb +26 -0
- data/lib/active_admin/views/components/scopes.rb +64 -0
- data/lib/active_admin/views/components/sidebar_section.rb +30 -0
- data/lib/active_admin/views/components/table_for.rb +174 -0
- data/lib/active_admin/views/dashboard_section_renderer.rb +19 -0
- data/lib/active_admin/views/header_renderer.rb +37 -0
- data/lib/active_admin/views/index_as_block.rb +24 -0
- data/lib/active_admin/views/index_as_blog.rb +89 -0
- data/lib/active_admin/views/index_as_grid.rb +49 -0
- data/lib/active_admin/views/index_as_table.rb +73 -0
- data/lib/active_admin/views/pages/base.rb +138 -0
- data/lib/active_admin/views/pages/dashboard.rb +61 -0
- data/lib/active_admin/views/pages/edit.rb +27 -0
- data/lib/active_admin/views/pages/index.rb +64 -0
- data/lib/active_admin/views/pages/new.rb +27 -0
- data/lib/active_admin/views/pages/show.rb +56 -0
- data/lib/active_admin/views/tabs_renderer.rb +52 -0
- data/lib/active_admin/views/templates/active_admin/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/lib/active_admin/views/templates/active_admin/devise/mailer/unlock_instructions.html.erb +7 -0
- data/lib/active_admin/views/templates/active_admin/devise/passwords/edit.html.erb +16 -0
- data/lib/active_admin/views/templates/active_admin/devise/passwords/new.html.erb +14 -0
- data/lib/active_admin/views/templates/active_admin/devise/sessions/new.html.erb +18 -0
- data/lib/active_admin/views/templates/active_admin/devise/shared/_links.erb +20 -0
- data/lib/active_admin/views/templates/active_admin/devise/unlocks/new.html.erb +12 -0
- data/lib/active_admin/views/templates/active_admin_dashboard/index.html.arb +1 -0
- data/lib/active_admin/views/templates/active_admin_default/edit.html.arb +1 -0
- data/lib/active_admin/views/{active_admin_default → templates/active_admin_default}/index.csv.erb +0 -0
- data/lib/active_admin/views/templates/active_admin_default/index.html.arb +1 -0
- data/lib/active_admin/views/templates/active_admin_default/new.html.arb +1 -0
- data/lib/active_admin/views/templates/active_admin_default/show.html.arb +1 -0
- data/lib/active_admin/views/{layouts → templates/layouts}/active_admin.html.erb +3 -4
- data/lib/active_admin/views/templates/layouts/active_admin_logged_out.html.erb +31 -0
- data/lib/generators/active_admin/devise/devise_generator.rb +45 -0
- data/lib/generators/active_admin/install/install_generator.rb +18 -3
- data/lib/generators/active_admin/install/templates/active_admin.js +41 -0
- data/lib/generators/active_admin/install/templates/{active_admin.rb → active_admin.rb.erb} +33 -3
- data/lib/generators/active_admin/install/templates/active_admin_vendor.js +1 -1
- data/lib/generators/active_admin/install/templates/dashboards.rb +3 -4
- data/lib/generators/active_admin/install/templates/images/admin_notes_icon.png +0 -0
- data/lib/generators/active_admin/install/templates/images/loading.gif +0 -0
- data/lib/generators/active_admin/install/templates/images/nested_menu_arrow.gif +0 -0
- data/lib/generators/active_admin/install/templates/images/nested_menu_arrow_dark.gif +0 -0
- data/lib/generators/active_admin/install/templates/images/orderable.png +0 -0
- data/lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb +16 -0
- data/lib/generators/active_admin/install/templates/migrations/2_move_admin_notes_to_comments.rb +25 -0
- data/spec/integration/belongs_to_spec.rb +42 -0
- data/spec/integration/index_as_table_spec.rb +0 -119
- data/spec/integration/layout_spec.rb +3 -37
- data/spec/spec_helper.rb +89 -50
- data/spec/support/integration_example_group.rb +37 -0
- data/spec/support/rails_template.rb +21 -9
- data/spec/support/rails_template_with_data.rb +32 -0
- data/spec/support/templates/cucumber.rb +28 -0
- data/spec/unit/abstract_view_factory_spec.rb +79 -0
- data/spec/unit/action_builder_spec.rb +19 -7
- data/spec/unit/action_items_spec.rb +16 -30
- data/spec/unit/active_admin_spec.rb +10 -22
- data/spec/unit/arbre/html/element_finder_methods_spec.rb +54 -0
- data/spec/unit/arbre/html/element_spec.rb +224 -0
- data/spec/unit/arbre/html/tag_attributes_spec.rb +61 -0
- data/spec/unit/arbre/html/tag_spec.rb +63 -0
- data/spec/unit/arbre/html_spec.rb +185 -0
- data/spec/unit/auto_link_spec.rb +38 -0
- data/spec/unit/belongs_to_spec.rb +44 -0
- data/spec/unit/breadcrumbs_spec.rb +110 -0
- data/spec/unit/comments_spec.rb +53 -0
- data/spec/unit/component_spec.rb +18 -0
- data/spec/unit/components/attributes_table_spec.rb +100 -0
- data/spec/unit/components/columns_spec.rb +75 -0
- data/spec/unit/components/panel_spec.rb +31 -0
- data/spec/unit/components/sidebar_section_spec.rb +37 -0
- data/spec/unit/components/table_for_spec.rb +130 -0
- data/spec/unit/dashboard_controller_spec.rb +26 -0
- data/spec/unit/dashboard_section_spec.rb +10 -17
- data/spec/unit/display_name_spec.rb +29 -0
- data/spec/unit/event_spec.rb +41 -0
- data/spec/unit/filter_form_builder_spec.rb +99 -77
- data/spec/unit/form_builder_spec.rb +69 -69
- data/spec/unit/namespace_spec.rb +61 -3
- data/spec/unit/pretty_format_spec.rb +35 -0
- data/spec/unit/registration_spec.rb +40 -1
- data/spec/unit/renderer_spec.rb +8 -0
- data/spec/unit/resource_controller_spec.rb +105 -6
- data/spec/unit/resource_spec.rb +78 -11
- data/spec/unit/routing_spec.rb +82 -6
- data/spec/unit/scope_spec.rb +31 -0
- data/spec/unit/tabs_renderer_spec.rb +24 -2
- data/spec/unit/view_factory_spec.rb +16 -0
- metadata +268 -82
- data/.gitignore +0 -25
- data/active_admin.gemspec +0 -22
- data/lib/active_admin/action_builder.rb +0 -60
- data/lib/active_admin/breadcrumbs.rb +0 -26
- data/lib/active_admin/dashboards/renderer.rb +0 -45
- data/lib/active_admin/dashboards/section_renderer.rb +0 -28
- data/lib/active_admin/filters.rb +0 -189
- data/lib/active_admin/pages.rb +0 -11
- data/lib/active_admin/pages/base.rb +0 -92
- data/lib/active_admin/pages/edit.rb +0 -21
- data/lib/active_admin/pages/index.rb +0 -58
- data/lib/active_admin/pages/index/blog.rb +0 -65
- data/lib/active_admin/pages/index/table.rb +0 -48
- data/lib/active_admin/pages/index/thumbnails.rb +0 -40
- data/lib/active_admin/pages/new.rb +0 -21
- data/lib/active_admin/pages/show.rb +0 -54
- data/lib/active_admin/table_builder.rb +0 -162
- data/lib/active_admin/tabs_renderer.rb +0 -39
- data/lib/active_admin/views/active_admin_dashboard/index.html.erb +0 -1
- data/lib/active_admin/views/active_admin_default/edit.html.erb +0 -1
- data/lib/active_admin/views/active_admin_default/index.html.erb +0 -1
- data/lib/active_admin/views/active_admin_default/new.html.erb +0 -1
- data/lib/active_admin/views/active_admin_default/show.html.erb +0 -1
- data/lib/generators/active_admin/install/templates/active_admin.css +0 -325
- data/lib/generators/active_admin/install/templates/images/orderable.gif +0 -0
- data/spec/integration/index_as_blog_spec.rb +0 -65
- data/spec/integration/index_as_thumbnails_spec.rb +0 -43
- data/spec/integration/new_view_spec.rb +0 -52
- data/spec/integration/show_view_spec.rb +0 -91
- data/spec/unit/sidebar_spec.rb +0 -96
- data/spec/unit/table_builder_spec.rb +0 -162
data/CHANGELOG.rdoc
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
== 0.
|
1
|
+
== 0.2.0 (2011-05-12)
|
2
|
+
|
3
|
+
0.2.0 is essentially an entire re-write of Active Admin. Here are some
|
4
|
+
of the highlights. 250 commits. Enough said.
|
5
|
+
|
6
|
+
* Features & Enhancements
|
7
|
+
* Full visual redesign
|
8
|
+
* Integrated Devise for authentication
|
9
|
+
* Brand new view and component layer called Arbre (Project coming soon)
|
10
|
+
* Added ActiveAdmin::Comments
|
11
|
+
|
12
|
+
* Bug Fixes
|
13
|
+
* Too many to list! Been in production for close to a year
|
14
|
+
|
15
|
+
== 0.1.1 (2010-09-15)
|
2
16
|
|
3
17
|
* Bug Fixes
|
4
18
|
* Fixed issues running on Ruby 1.9.2
|
data/Gemfile
CHANGED
@@ -1,16 +1,46 @@
|
|
1
1
|
# These resources are needed to setup the test env
|
2
2
|
source 'http://rubygems.org'
|
3
3
|
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
gem '
|
8
|
-
|
9
|
-
gem '
|
10
|
-
|
4
|
+
# Set the RAILS env variable to test against diffirent versions of rails
|
5
|
+
case ENV["RAILS"]
|
6
|
+
when "3.0.0"
|
7
|
+
gem 'rails', '= 3.0.0'
|
8
|
+
when "3.0.1"
|
9
|
+
gem 'rails', '= 3.0.1'
|
10
|
+
when "3.0.2"
|
11
|
+
gem 'rails', '= 3.0.2'
|
12
|
+
when "3.0.3"
|
13
|
+
gem 'rails', '= 3.0.3'
|
14
|
+
when "3.0.4"
|
15
|
+
gem 'rails', '= 3.0.4'
|
16
|
+
when "3.0.5"
|
17
|
+
gem 'rails', '= 3.0.5'
|
18
|
+
when "3.0.6"
|
19
|
+
gem 'rails', '= 3.0.6'
|
20
|
+
else
|
21
|
+
# Default gems for in the gemspec
|
22
|
+
gem 'rails', '>= 3.0.0'
|
23
|
+
end
|
24
|
+
|
25
|
+
gem "meta_search", '>= 0.9.2'
|
26
|
+
gem 'devise', '>= 1.1.2'
|
27
|
+
gem 'formtastic', '>= 1.1.0'
|
28
|
+
gem 'will_paginate', '>= 3.0.pre2'
|
11
29
|
gem 'inherited_views'
|
12
|
-
gem '
|
30
|
+
gem 'haml', '>= 3.0.18'
|
31
|
+
|
32
|
+
group :development, :test do
|
33
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
34
|
+
gem 'jeweler', '1.5.2'
|
35
|
+
end
|
13
36
|
|
14
|
-
|
15
|
-
gem 'rspec', '2.0.0.beta.
|
16
|
-
gem 'rspec-rails', '2.0.0.beta.
|
37
|
+
group :test do
|
38
|
+
gem 'rspec', '2.0.0.beta.22'
|
39
|
+
gem 'rspec-rails', '2.0.0.beta.22'
|
40
|
+
gem 'capybara', '0.3.9'
|
41
|
+
gem 'cucumber', '0.9.2'
|
42
|
+
gem 'cucumber-rails', '0.3.2'
|
43
|
+
gem 'database_cleaner'
|
44
|
+
gem 'shoulda', '2.11.2', :require => nil
|
45
|
+
gem 'launchy'
|
46
|
+
end
|
data/LICENSE
CHANGED
@@ -18,3 +18,8 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
Iconic Icons are designed by P.J. Onori and are shared under
|
23
|
+
the Creative Commons Attribution-Share Alike 3.0 license:
|
24
|
+
http://creativecommons.org/licenses/by-sa/3.0/us
|
25
|
+
http://somerandomdude.com/projects/iconic/
|
data/README.rdoc
CHANGED
@@ -1,143 +1,238 @@
|
|
1
1
|
= Active Admin
|
2
2
|
|
3
|
-
Active Admin is a
|
4
|
-
|
3
|
+
Active Admin is a framework for creating administration style interfaces. It
|
4
|
+
abstracts common business application patterns to make it simple for developers
|
5
|
+
to implement beautiful and elegant interfaces with very little effort.
|
5
6
|
|
6
7
|
== Goals
|
7
8
|
|
8
|
-
|
9
|
+
1. Allow developers to quickly create gorgeous administration interfaces
|
10
|
+
<strong>(Not Just CRUD)</strong>
|
11
|
+
2. Build a DSL for developers and an interface for businesses.
|
12
|
+
3. Ensure that developers can easily customize every nook and cranny of the interface.
|
13
|
+
4. Build common interfaces as shareable gems so that the entire community benefits.
|
9
14
|
|
10
|
-
1. Build a toolset to quickly create template-able administration interfaces
|
11
|
-
2. Allow the toolset to be entirely customizable (ie: we use standard rails coding practices
|
12
|
-
which can be overridden at any point)
|
13
|
-
3. Design an interface which looks great!
|
14
|
-
4. Build administration interfaces for common rails plugins as gems and share with the
|
15
|
-
community (ie: devise admin)
|
16
15
|
|
17
|
-
==
|
16
|
+
== Getting Started
|
18
17
|
|
19
|
-
Active Admin is
|
20
|
-
|
21
|
-
we will begin numbered releases starting with a 0.1 release.
|
18
|
+
Active Admin is released as a Ruby Gem. The gem is to be installed within a Ruby
|
19
|
+
on Rails 3 application. To install, simply add the following to your Gemfile:
|
22
20
|
|
23
|
-
|
21
|
+
# Gemfile
|
22
|
+
gem 'activeadmin'
|
24
23
|
|
25
|
-
|
26
|
-
WillPaginate seems to have some Rails 3 issues still. For now:
|
24
|
+
After updating your bundle, run the installer
|
27
25
|
|
28
|
-
|
26
|
+
$> rails generate active_admin:install
|
29
27
|
|
30
|
-
|
31
|
-
|
28
|
+
The installer creates an initializer used for configuring defaults used by Active Admin as well
|
29
|
+
as a new folder at <tt>app/admin</tt> to put all your admin configurations.
|
30
|
+
|
31
|
+
Migrate your db and start the server:
|
32
|
+
|
33
|
+
$> rake db:migrate
|
34
|
+
$> rails server
|
35
|
+
|
36
|
+
Visit http://localhost:3000/admin and log in using:
|
37
|
+
|
38
|
+
* *User*: admin@example.com
|
39
|
+
* *Password*: password
|
40
|
+
|
41
|
+
Voila! You're on your brand new Active Admin dashboard.
|
42
|
+
|
43
|
+
To register your first model, run:
|
44
|
+
|
45
|
+
$> rails generate active_admin:resource [MyModelName]
|
46
|
+
|
47
|
+
This creates a file at <tt>app/admin/my_model_names.rb</tt> for configuring the resource.
|
48
|
+
Refresh your web browser to see the interface.
|
49
|
+
|
50
|
+
To learn how to further configure your admin section, keep on reading!
|
51
|
+
|
52
|
+
== General Configuration
|
53
|
+
|
54
|
+
=== Admin Users
|
55
|
+
|
56
|
+
By default Active Admin will include Devise and create a new model called
|
57
|
+
AdminUser. If you would like to use another name, you can pass it in to the
|
58
|
+
installer through the user option:
|
59
|
+
|
60
|
+
$> rails generate active_admin:install UserClassName
|
61
|
+
|
62
|
+
If you don't want the generator to create any user classes:
|
32
63
|
|
33
|
-
|
64
|
+
$> rails generate active_admin:install --skip-users
|
34
65
|
|
35
|
-
|
66
|
+
=== Authentication
|
36
67
|
|
37
|
-
|
38
|
-
|
39
|
-
|
68
|
+
Active Admin requires two settings to authenticate and use the current user
|
69
|
+
within your application. Both are set in
|
70
|
+
<tt>config/initializers/active_admin.rb</tt>. By default they are setup for use
|
71
|
+
with Devise and a model named AdminUser. If you chose a different model name,
|
72
|
+
you will need to update these settings.
|
40
73
|
|
41
|
-
|
74
|
+
Set the method that controllers should call to authenticate the current user
|
75
|
+
with:
|
42
76
|
|
43
|
-
|
77
|
+
# config/initializers/active_admin.rb
|
78
|
+
config.authentication_method = :authenticate_admin_user!
|
44
79
|
|
45
|
-
|
46
|
-
|
47
|
-
That's all you need to get a full CRUD, beautiful administration interface!
|
80
|
+
Set the method to call within the view to access the current admin user
|
48
81
|
|
49
|
-
|
50
|
-
|
82
|
+
# config/initializers/active_admin.rb
|
83
|
+
config.current_user_method = :current_admin_user
|
51
84
|
|
52
|
-
|
85
|
+
Both of these settings can be set to false to turn off authentication.
|
53
86
|
|
54
|
-
|
87
|
+
# Turn off authentication all together
|
88
|
+
config.authentication_method = false
|
89
|
+
config.current_user_method = false
|
90
|
+
|
91
|
+
=== Site Title
|
92
|
+
|
93
|
+
You can update the title used for the site in the initializer also. By default
|
94
|
+
it is set to the name of your Rails.application class name.
|
95
|
+
|
96
|
+
# config/initializers/active_admin.rb
|
97
|
+
config.site_title = "My Admin Site"
|
98
|
+
|
99
|
+
== Customizing the Index Page
|
100
|
+
|
101
|
+
Filtering and listing resources is one of the most important tasks for
|
102
|
+
administering a web application. Active Admin provides many different tools for
|
103
|
+
you to build a compelling interface into your data for the admin staff.
|
104
|
+
|
105
|
+
Built in, Active Admin has the following index renderers:
|
106
|
+
|
107
|
+
* *Table*: A table drawn with each row being a resource
|
108
|
+
* *Grid*: A set of rows and columns each cell being a resource
|
109
|
+
* *Blocks*: A set of rows (not tabular) each row being a resource
|
110
|
+
* *Blog*: A title and body content, similar to a blog index
|
111
|
+
|
112
|
+
All index pages also support scopes, filters, pagination, action items, and
|
113
|
+
sidebar sections.
|
114
|
+
|
115
|
+
=== Index as a Table
|
55
116
|
|
56
117
|
By default, the index page is a table with each of the models content columns and links to
|
57
|
-
show, edit and delete the object. There are many ways to customize what gets
|
118
|
+
show, edit and delete the object. There are many ways to customize what gets
|
119
|
+
displayed.
|
58
120
|
|
59
|
-
====
|
121
|
+
==== Defining Columns
|
60
122
|
|
61
|
-
|
62
|
-
|
123
|
+
To display an attribute or a method on a resource, simply pass a symbol into the
|
124
|
+
column method:
|
63
125
|
|
64
|
-
|
65
|
-
|
66
|
-
index do |display|
|
67
|
-
display.columns :title, :comments_count, :created_at
|
126
|
+
index do
|
127
|
+
column :title
|
68
128
|
end
|
69
129
|
|
70
|
-
|
130
|
+
If the default title does not work for you, pass it as the first argument:
|
131
|
+
|
132
|
+
index do
|
133
|
+
column "My Custom Title", :title
|
134
|
+
end
|
71
135
|
|
72
|
-
|
136
|
+
Sometimes calling methods just isn't enough and you need to write some view
|
137
|
+
specific code. For example, say we wanted a colum called Title which holds a
|
138
|
+
link to the posts admin screen.
|
73
139
|
|
74
|
-
|
75
|
-
|
76
|
-
|
140
|
+
The column method accepts a block as an argument which will then be rendered
|
141
|
+
within the context of the view for each of the objects in the collection.
|
142
|
+
|
143
|
+
index do
|
144
|
+
column "Title" do |post|
|
145
|
+
link_to post.title, admin_post_path(post)
|
146
|
+
end
|
147
|
+
end
|
77
148
|
|
78
|
-
|
79
|
-
|
149
|
+
The block gets called once for each resource in the collection. The resource gets passed into
|
150
|
+
the block as an argument.
|
80
151
|
|
81
|
-
# This will title the column 'How many comments?' and call the #comments_count method on each object
|
82
|
-
display.column 'How many comments?', :comments_count
|
83
152
|
|
84
|
-
|
85
|
-
|
153
|
+
==== Sorting
|
154
|
+
|
155
|
+
When a column is generated from an Active Record attribute, the table is
|
156
|
+
sortable by default. If you are creating a custom column, you may need to give
|
157
|
+
Active Admin a hint for how to sort the table.
|
86
158
|
|
159
|
+
If a column is defined using a block, you must pass the key to turn on sorting. The key
|
160
|
+
is the attribute which gets used to sort objects using Active Record.
|
161
|
+
|
162
|
+
index do
|
163
|
+
column "Title", :sortable => :title do |post|
|
164
|
+
link_to post.title, admin_post_path(post)
|
87
165
|
end
|
166
|
+
end
|
88
167
|
|
168
|
+
You can turn off sorting on any column by passing false:
|
169
|
+
|
170
|
+
index do
|
171
|
+
column :title, :sortable => false
|
89
172
|
end
|
90
|
-
|
91
|
-
==== Advanced Columns
|
92
173
|
|
93
|
-
|
94
|
-
example, say we wanted a colum called Title which holds a link to the posts admin screen.
|
174
|
+
==== Showing and Hiding Columns
|
95
175
|
|
96
|
-
|
97
|
-
|
176
|
+
The entire index block is rendered within the context of the view, so you can
|
177
|
+
easily do things that show or hide columns based on the current context.
|
98
178
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
179
|
+
For example, if you were using CanCan:
|
180
|
+
|
181
|
+
index do
|
182
|
+
column :title, :sortable => false
|
183
|
+
if can? :manage, Post
|
184
|
+
column :some_secret_data
|
104
185
|
end
|
186
|
+
end
|
187
|
+
|
188
|
+
=== Index as a Grid
|
189
|
+
|
190
|
+
Sometimes you want to display the index screen for a set of resources as a grid
|
191
|
+
(possibly a grid of thumbnail images). To do so, use the :grid option for the
|
192
|
+
index block.
|
105
193
|
|
194
|
+
index :as => :grid do |product|
|
195
|
+
link_to(image_tag(product.image_path), admin_products_path(product))
|
106
196
|
end
|
107
197
|
|
108
|
-
The block
|
109
|
-
the block
|
198
|
+
The block is rendered within a cell in the grid once for each resource in the
|
199
|
+
collection. The resource is passed into the block for you to use in the view.
|
110
200
|
|
111
|
-
|
201
|
+
You can customize the number of colums that are rendered using the columns
|
202
|
+
option:
|
112
203
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
index do |display|
|
204
|
+
index :as => :grid, :columns => 5 do |product|
|
205
|
+
link_to(image_tag(product.image_path), admin_products_path(product))
|
206
|
+
end
|
118
207
|
|
119
|
-
# A column created by a method call assumes its sortable
|
120
|
-
display.column :id
|
121
208
|
|
122
|
-
|
123
|
-
# is the attribute which gets used to sort objects using Active Record.
|
124
|
-
display.column("Title", :sortable => :title){|post| link_to post.title, admin_post_path(post) }
|
209
|
+
=== Index as a Block
|
125
210
|
|
126
|
-
|
127
|
-
|
211
|
+
If you want to fully customize the display of your resources on the index
|
212
|
+
screen, Index as a Block allows you to render a block of content for each
|
213
|
+
resource.
|
128
214
|
|
215
|
+
index :as => :block do |product|
|
216
|
+
div :for => product do
|
217
|
+
h2 auto_link(product.title)
|
218
|
+
div do
|
219
|
+
simple_format product.description
|
220
|
+
end
|
129
221
|
end
|
130
|
-
|
131
222
|
end
|
132
223
|
|
133
224
|
|
134
|
-
===
|
225
|
+
=== Index Filters
|
226
|
+
|
227
|
+
=== Index Scopes
|
228
|
+
|
229
|
+
== Customizing the Form
|
135
230
|
|
136
231
|
Active Admin gives complete control over the output of the form by creating a thin DSL on top of
|
137
232
|
the fabulous DSL created by Formtastic (http://github.com/justinfrench/formtastic).
|
138
|
-
|
233
|
+
|
139
234
|
ActiveAdmin.register Post do
|
140
|
-
|
235
|
+
|
141
236
|
form do |f|
|
142
237
|
f.inputs "Details" do
|
143
238
|
f.input :title
|
@@ -156,6 +251,21 @@ Please view the documentation for Formtastic to see all the wonderful things you
|
|
156
251
|
http://github.com/justinfrench/formtastic
|
157
252
|
|
158
253
|
|
254
|
+
== Customizing the Show Screen
|
255
|
+
|
256
|
+
== Action Items
|
257
|
+
|
258
|
+
== Sidebar Sections
|
259
|
+
|
260
|
+
== The Dashboard
|
261
|
+
|
262
|
+
== Custom Actions
|
263
|
+
|
264
|
+
=== Collection Actions
|
265
|
+
|
266
|
+
=== Member Actions
|
267
|
+
|
268
|
+
|
159
269
|
== Tools Being Used
|
160
270
|
|
161
271
|
We believe strongly in not writing code unless we have to, so Active Admin is built using many
|
@@ -168,8 +278,12 @@ InheritedViews::
|
|
168
278
|
Inherited Views is a thin addition to Inherited Resources which adds in html views to the mix
|
169
279
|
Formtastic::
|
170
280
|
A DSL for semantically building amazing forms.
|
281
|
+
Devise::
|
282
|
+
User authentication is done using Devise
|
171
283
|
WillPaginate::
|
172
284
|
Pagination for rails apps
|
285
|
+
Iconic Icons::
|
286
|
+
Excellent SVG icon set designed by P.J. Onori: http://somerandomdude.com/projects/iconic
|
173
287
|
|
174
288
|
|
175
289
|
== Contributors
|
@@ -179,23 +293,24 @@ WillPaginate::
|
|
179
293
|
* Sam Vincent http://github.com/samvincent
|
180
294
|
* Matt Vague http://github.com/mattvague
|
181
295
|
* Dan Kubb http://github.com/dkubb
|
296
|
+
* Sam Reh http://github.com/samuelreh
|
182
297
|
|
183
298
|
|
184
299
|
== Roadmap & Issue Tracking
|
185
300
|
|
186
|
-
We are using the awesome
|
187
|
-
http://activeadmin.lighthouseapp.com
|
301
|
+
We are using the awesome Github issues!
|
188
302
|
|
189
303
|
== Note on Patches/Pull Requests
|
190
304
|
|
191
305
|
* Fork the project.
|
192
|
-
* Make your feature addition or bug fix
|
193
|
-
* Add
|
306
|
+
* Make your feature addition or bug fix on a new topic branch
|
307
|
+
* Add specs and cukes for it. This is important so I don't break it in a
|
194
308
|
future version unintentionally.
|
195
309
|
* Commit, do not mess with rakefile, version, or history.
|
196
310
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
197
|
-
* Send me a pull request.
|
311
|
+
* Send me a pull request.
|
198
312
|
|
199
313
|
== Copyright
|
200
314
|
|
201
315
|
Copyright (c) 2010 Greg Bell, VersaPay Corporation. See LICENSE for details.
|
316
|
+
|