activeadmin 1.0.0.pre4 → 1.0.0.pre5
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.
- checksums.yaml +4 -4
- data/.gitignore +3 -3
- data/.travis.yml +48 -26
- data/Appraisals +103 -0
- data/CHANGELOG.md +12 -1
- data/CONTRIBUTING.md +85 -32
- data/Gemfile +13 -38
- data/README.md +10 -26
- data/Rakefile +41 -9
- data/activeadmin.gemspec +7 -4
- data/app/assets/javascripts/active_admin/initializers/filters.js.coffee +10 -3
- data/app/assets/javascripts/active_admin/jquery_ui.js.erb +11 -4
- data/app/assets/javascripts/active_admin/lib/checkbox-toggler.js.coffee +8 -0
- data/app/assets/javascripts/active_admin/lib/modal_dialog.js.coffee +1 -1
- data/app/assets/javascripts/active_admin/lib/per_page.js.coffee +14 -3
- data/app/assets/stylesheets/active_admin/_forms.scss +1 -0
- data/app/views/active_admin/devise/registrations/new.html.erb +1 -1
- data/codecov.yml +23 -0
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es.yml +1 -1
- data/config/locales/ru.yml +1 -0
- data/config/locales/sk.yml +110 -0
- data/docs/0-installation.md +3 -0
- data/docs/1-general-configuration.md +11 -0
- data/docs/10-custom-pages.md +25 -0
- data/docs/11-decorators.md +3 -0
- data/docs/12-arbre-components.md +3 -0
- data/docs/13-authorization-adapter.md +3 -0
- data/docs/14-gotchas.md +19 -0
- data/docs/2-resource-customization.md +21 -2
- data/docs/3-index-pages.md +21 -0
- data/docs/3-index-pages/custom-index.md +3 -0
- data/docs/3-index-pages/index-as-block.md +3 -0
- data/docs/3-index-pages/index-as-blog.md +3 -0
- data/docs/3-index-pages/index-as-grid.md +3 -0
- data/docs/3-index-pages/index-as-table.md +22 -0
- data/docs/4-csv-format.md +15 -0
- data/docs/5-forms.md +7 -3
- data/docs/6-show-pages.md +3 -0
- data/docs/7-sidebars.md +3 -0
- data/docs/8-custom-actions.md +3 -0
- data/docs/9-batch-actions.md +4 -1
- data/docs/CNAME +1 -0
- data/docs/Gemfile +2 -0
- data/docs/_config.yml +2 -0
- data/docs/_includes/footer.html +8 -0
- data/docs/_includes/google-analytics.html +16 -0
- data/docs/_includes/head.html +7 -0
- data/docs/_includes/toc.html +97 -0
- data/docs/_includes/top-menu.html +9 -0
- data/docs/_layouts/default.html +21 -0
- data/docs/documentation.md +62 -0
- data/docs/images/activeadmin.png +0 -0
- data/docs/images/code-header.png +0 -0
- data/docs/images/divider.png +0 -0
- data/docs/images/features.png +0 -0
- data/docs/index.html +130 -0
- data/docs/stylesheets/main.css +1199 -0
- data/features/action_item.feature +2 -2
- data/features/authorization_cancan.feature +3 -3
- data/features/belongs_to.feature +60 -2
- data/features/comments/commenting.feature +7 -7
- data/features/development_reloading.feature +1 -1
- data/features/edit_page.feature +9 -9
- data/features/footer.feature +28 -0
- data/features/i18n.feature +11 -0
- data/features/index/batch_actions.feature +28 -6
- data/features/index/filters.feature +31 -11
- data/features/index/format_as_csv.feature +13 -13
- data/features/index/formats.feature +4 -4
- data/features/index/index_as_block.feature +1 -1
- data/features/index/index_as_blog.feature +6 -6
- data/features/index/index_as_grid.feature +3 -3
- data/features/index/index_as_table.feature +11 -11
- data/features/index/index_blank_slate.feature +4 -4
- data/features/index/index_parameters.feature +10 -10
- data/features/index/index_scope_to.feature +3 -3
- data/features/index/index_scopes.feature +37 -18
- data/features/index/page_title.feature +3 -3
- data/features/index/pagination.feature +1 -1
- data/features/index/switch_index_view.feature +8 -8
- data/features/menu.feature +3 -3
- data/features/new_page.feature +8 -8
- data/features/registering_assets.feature +1 -1
- data/features/registering_pages.feature +73 -2
- data/features/registering_resources.feature +1 -1
- data/features/renamed_resource.feature +1 -1
- data/features/show/page_title.feature +3 -3
- data/features/sidebar_sections.feature +6 -6
- data/features/specifying_actions.feature +29 -4
- data/features/step_definitions/factory_steps.rb +1 -1
- data/features/step_definitions/footer_steps.rb +11 -0
- data/features/step_definitions/i18n_steps.rb +8 -0
- data/features/step_definitions/index_scope_steps.rb +4 -0
- data/features/step_definitions/sidebar_steps.rb +1 -3
- data/features/step_definitions/table_steps.rb +1 -5
- data/features/step_definitions/user_steps.rb +7 -0
- data/features/support/env.rb +6 -33
- data/features/support/paths.rb +5 -0
- data/features/users/logging_in.feature +2 -0
- data/gemfiles/rails_32.gemfile +54 -0
- data/gemfiles/rails_40.gemfile +53 -0
- data/gemfiles/rails_41.gemfile +53 -0
- data/gemfiles/rails_42.gemfile +53 -0
- data/gemfiles/rails_50.gemfile +46 -0
- data/lib/active_admin.rb +1 -0
- data/lib/active_admin/application.rb +11 -0
- data/lib/active_admin/batch_actions/resource_extension.rb +0 -8
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +1 -1
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +1 -1
- data/lib/active_admin/dsl.rb +0 -6
- data/lib/active_admin/filters/active.rb +9 -1
- data/lib/active_admin/filters/formtastic_addons.rb +1 -1
- data/lib/active_admin/filters/humanized.rb +1 -1
- data/lib/active_admin/filters/resource_extension.rb +2 -4
- data/lib/active_admin/form_builder.rb +12 -6
- data/lib/active_admin/helpers/collection.rb +2 -0
- data/lib/active_admin/inputs.rb +1 -0
- data/lib/active_admin/inputs/filters/date_range_input.rb +9 -4
- data/lib/active_admin/inputs/filters/text_input.rb +26 -0
- data/lib/active_admin/localizers.rb +11 -0
- data/lib/active_admin/localizers/resource_localizer.rb +35 -0
- data/lib/active_admin/namespace.rb +1 -1
- data/lib/active_admin/order_clause.rb +29 -7
- data/lib/active_admin/page.rb +18 -4
- data/lib/active_admin/page_dsl.rb +4 -0
- data/lib/active_admin/resource.rb +16 -1
- data/lib/active_admin/resource/action_items.rb +7 -4
- data/lib/active_admin/resource/belongs_to.rb +4 -0
- data/lib/active_admin/resource/menu.rb +1 -1
- data/lib/active_admin/resource/ordering.rb +11 -0
- data/lib/active_admin/resource/routes.rb +34 -13
- data/lib/active_admin/resource/scopes.rb +1 -0
- data/lib/active_admin/resource_controller/data_access.rb +3 -10
- data/lib/active_admin/resource_dsl.rb +28 -1
- data/lib/active_admin/router.rb +5 -3
- data/lib/active_admin/scope.rb +3 -3
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers/auto_link_helper.rb +2 -2
- data/lib/active_admin/view_helpers/display_helper.rb +8 -3
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +5 -1
- data/lib/active_admin/views/components/active_admin_form.rb +11 -10
- data/lib/active_admin/views/components/attributes_table.rb +1 -1
- data/lib/active_admin/views/components/columns.rb +3 -3
- data/lib/active_admin/views/components/dropdown_menu.rb +2 -2
- data/lib/active_admin/views/components/index_list.rb +4 -1
- data/lib/active_admin/views/components/paginated_collection.rb +1 -0
- data/lib/active_admin/views/components/scopes.rb +8 -1
- data/lib/active_admin/views/components/site_title.rb +2 -2
- data/lib/active_admin/views/components/table_for.rb +3 -3
- data/lib/active_admin/views/footer.rb +17 -3
- data/lib/active_admin/views/index_as_table.rb +3 -3
- data/lib/active_admin/views/pages/base.rb +4 -2
- data/lib/active_admin/views/pages/form.rb +2 -3
- data/lib/active_admin/views/pages/show.rb +2 -1
- data/lib/bug_report_templates/rails_5_master.rb +120 -0
- data/lib/generators/active_admin/devise/devise_generator.rb +6 -3
- data/lib/generators/active_admin/install/install_generator.rb +1 -1
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +15 -1
- data/lib/generators/active_admin/install/templates/migrations/{create_active_admin_comments.rb → create_active_admin_comments.rb.erb} +14 -1
- data/lib/ransack_ext.rb +2 -2
- data/spec/bug_report_templates_spec.rb +27 -0
- data/spec/javascripts/support/jasmine_runner.rb +4 -17
- data/spec/rails_helper.rb +20 -109
- data/spec/requests/default_namespace_spec.rb +16 -28
- data/spec/requests/javascript_spec.rb +1 -1
- data/spec/requests/memory_spec.rb +5 -1
- data/spec/requests/stylesheets_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -10
- data/spec/support/active_admin_integration_spec_helper.rb +66 -0
- data/spec/support/active_admin_request_helpers.rb +12 -0
- data/spec/support/rails_template.rb +42 -15
- data/spec/support/rails_template_with_data.rb +24 -5
- data/spec/support/templates/manifest.js +3 -0
- data/spec/support/templates/policies/application_policy.rb +1 -1
- data/spec/unit/abstract_view_factory_spec.rb +1 -1
- data/spec/unit/action_builder_spec.rb +3 -12
- data/spec/unit/active_admin_spec.rb +1 -1
- data/spec/unit/application_spec.rb +5 -1
- data/spec/unit/asset_registration_spec.rb +1 -1
- data/spec/unit/authorization/authorization_adapter_spec.rb +1 -1
- data/spec/unit/authorization/controller_authorization_spec.rb +13 -9
- data/spec/unit/authorization/index_overriding_spec.rb +6 -6
- data/spec/unit/auto_link_spec.rb +48 -24
- data/spec/unit/batch_actions/resource_spec.rb +1 -14
- data/spec/unit/batch_actions/settings_spec.rb +1 -1
- data/spec/unit/belongs_to_spec.rb +9 -1
- data/spec/unit/cancan_adapter_spec.rb +1 -1
- data/spec/unit/comments_spec.rb +26 -19
- data/spec/unit/component_spec.rb +1 -1
- data/spec/unit/config_shared_examples.rb +1 -1
- data/spec/unit/controller_filters_spec.rb +1 -1
- data/spec/unit/csv_builder_spec.rb +5 -5
- data/spec/unit/dependency_spec.rb +1 -1
- data/spec/unit/devise_spec.rb +17 -3
- data/spec/unit/dsl_spec.rb +2 -2
- data/spec/unit/filters/active_spec.rb +21 -0
- data/spec/unit/filters/filter_form_builder_spec.rb +98 -31
- data/spec/unit/filters/humanized_spec.rb +9 -1
- data/spec/unit/filters/resource_spec.rb +5 -4
- data/spec/unit/form_builder_spec.rb +180 -33
- data/spec/unit/generators/install_spec.rb +12 -5
- data/spec/unit/helpers/collection_spec.rb +10 -7
- data/spec/unit/helpers/scope_chain_spec.rb +1 -1
- data/spec/unit/helpers/settings_spec.rb +1 -1
- data/spec/unit/i18n_spec.rb +1 -1
- data/spec/unit/localizers/resource_localizer_spec.rb +36 -0
- data/spec/unit/menu_collection_spec.rb +1 -1
- data/spec/unit/menu_item_spec.rb +1 -1
- data/spec/unit/menu_spec.rb +1 -1
- data/spec/unit/namespace/authorization_spec.rb +1 -1
- data/spec/unit/namespace/register_page_spec.rb +28 -2
- data/spec/unit/namespace/register_resource_spec.rb +3 -1
- data/spec/unit/namespace_spec.rb +23 -1
- data/spec/unit/order_clause_spec.rb +7 -7
- data/spec/unit/page_controller_spec.rb +1 -1
- data/spec/unit/page_spec.rb +55 -2
- data/spec/unit/pretty_format_spec.rb +8 -7
- data/spec/unit/pundit_adapter_spec.rb +1 -1
- data/spec/unit/resource/action_items_spec.rb +1 -1
- data/spec/unit/resource/includes_spec.rb +1 -1
- data/spec/unit/resource/menu_spec.rb +1 -1
- data/spec/unit/resource/naming_spec.rb +1 -1
- data/spec/unit/resource/ordering_spec.rb +38 -0
- data/spec/unit/resource/page_presenters_spec.rb +1 -1
- data/spec/unit/resource/pagination_spec.rb +1 -1
- data/spec/unit/resource/routes_spec.rb +101 -53
- data/spec/unit/resource/scopes_spec.rb +1 -1
- data/spec/unit/resource/sidebars_spec.rb +1 -1
- data/spec/unit/resource_collection_spec.rb +1 -1
- data/spec/unit/resource_controller/data_access_spec.rb +50 -1
- data/spec/unit/resource_controller/decorators_spec.rb +2 -2
- data/spec/unit/resource_controller/sidebars_spec.rb +16 -17
- data/spec/unit/resource_controller_spec.rb +50 -56
- data/spec/unit/resource_registration_spec.rb +9 -4
- data/spec/unit/resource_spec.rb +9 -1
- data/spec/unit/routing_spec.rb +30 -2
- data/spec/unit/scope_spec.rb +26 -2
- data/spec/unit/settings_spec.rb +2 -2
- data/spec/unit/view_factory_spec.rb +1 -1
- data/spec/unit/view_helpers/breadcrumbs_spec.rb +1 -1
- data/spec/unit/view_helpers/display_helper_spec.rb +18 -3
- data/spec/unit/view_helpers/download_format_links_helper_spec.rb +1 -1
- data/spec/unit/view_helpers/fields_for_spec.rb +1 -1
- data/spec/unit/view_helpers/flash_helper_spec.rb +1 -1
- data/spec/unit/view_helpers/form_helper_spec.rb +1 -1
- data/spec/unit/view_helpers/method_or_proc_helper_spec.rb +1 -1
- data/spec/unit/views/components/attributes_table_spec.rb +1 -1
- data/spec/unit/views/components/batch_action_selector_spec.rb +1 -1
- data/spec/unit/views/components/blank_slate_spec.rb +1 -1
- data/spec/unit/views/components/columns_spec.rb +1 -1
- data/spec/unit/views/components/index_list_spec.rb +18 -4
- data/spec/unit/views/components/index_table_for_spec.rb +1 -1
- data/spec/unit/views/components/paginated_collection_spec.rb +1 -1
- data/spec/unit/views/components/panel_spec.rb +1 -1
- data/spec/unit/views/components/sidebar_section_spec.rb +1 -1
- data/spec/unit/views/components/site_title_spec.rb +1 -1
- data/spec/unit/views/components/status_tag_spec.rb +1 -1
- data/spec/unit/views/components/table_for_spec.rb +9 -7
- data/spec/unit/views/components/tabs_spec.rb +1 -1
- data/spec/unit/views/components/unsupported_browser_spec.rb +3 -3
- data/spec/unit/views/index_as_blog_spec.rb +1 -1
- data/spec/unit/views/pages/form_spec.rb +1 -1
- data/spec/unit/views/pages/index_spec.rb +1 -1
- data/spec/unit/views/pages/layout_spec.rb +1 -1
- data/spec/unit/views/pages/show_spec.rb +1 -1
- data/spec/unit/views/tabbed_navigation_spec.rb +2 -2
- data/tasks/local.rake +25 -0
- data/tasks/parallel_tests.rake +4 -4
- data/tasks/test.rake +8 -53
- metadata +61 -18
- data/Guardfile +0 -8
- data/script/local +0 -53
- data/script/travis_cache +0 -107
- data/script/use_rails +0 -53
- data/spec/javascripts/support/jasmine_config.rb +0 -23
- data/spec/support/detect_rails_version.rb +0 -34
@@ -6,7 +6,7 @@ Feature: Index - Page Title
|
|
6
6
|
Given an index configuration of:
|
7
7
|
"""
|
8
8
|
ActiveAdmin.register Post do
|
9
|
-
index :
|
9
|
+
index title: "Awesome Title"
|
10
10
|
end
|
11
11
|
"""
|
12
12
|
Then I should see the page title "Awesome Title"
|
@@ -15,7 +15,7 @@ Feature: Index - Page Title
|
|
15
15
|
Given an index configuration of:
|
16
16
|
"""
|
17
17
|
ActiveAdmin.register Post do
|
18
|
-
index :
|
18
|
+
index title: proc{ 'Custom title from proc' }
|
19
19
|
end
|
20
20
|
"""
|
21
21
|
Then I should see the page title "Custom title from proc"
|
@@ -24,7 +24,7 @@ Feature: Index - Page Title
|
|
24
24
|
Given an index configuration of:
|
25
25
|
"""
|
26
26
|
ActiveAdmin.register Post do
|
27
|
-
index :
|
27
|
+
index title: proc{ "List of #{resource_class.model_name.plural}" }
|
28
28
|
end
|
29
29
|
"""
|
30
30
|
Then I should see the page title "List of posts"
|
@@ -9,10 +9,10 @@ Feature: Switch Index View
|
|
9
9
|
And an index configuration of:
|
10
10
|
"""
|
11
11
|
ActiveAdmin.register Post do
|
12
|
-
index :
|
12
|
+
index as: :table do
|
13
13
|
column :title
|
14
14
|
end
|
15
|
-
index :
|
15
|
+
index as: :block do |post|
|
16
16
|
span(link_to(post.title, admin_post_path(post)))
|
17
17
|
end
|
18
18
|
end
|
@@ -24,10 +24,10 @@ Feature: Switch Index View
|
|
24
24
|
And an index configuration of:
|
25
25
|
"""
|
26
26
|
ActiveAdmin.register Post do
|
27
|
-
index :
|
27
|
+
index as: :block do |post|
|
28
28
|
span(link_to(post.title, admin_post_path(post)))
|
29
29
|
end
|
30
|
-
index :
|
30
|
+
index as: :table, default: true do
|
31
31
|
column :title
|
32
32
|
end
|
33
33
|
end
|
@@ -39,10 +39,10 @@ Feature: Switch Index View
|
|
39
39
|
And an index configuration of:
|
40
40
|
"""
|
41
41
|
ActiveAdmin.register Post do
|
42
|
-
index :
|
42
|
+
index as: :block do |post|
|
43
43
|
span(link_to(post.title, admin_post_path(post)))
|
44
44
|
end
|
45
|
-
index :
|
45
|
+
index as: :table, default: true do
|
46
46
|
column :title
|
47
47
|
end
|
48
48
|
end
|
@@ -56,10 +56,10 @@ Feature: Switch Index View
|
|
56
56
|
And an index configuration of:
|
57
57
|
"""
|
58
58
|
ActiveAdmin.register Post do
|
59
|
-
index :
|
59
|
+
index as: :block do |post|
|
60
60
|
span(link_to(post.title, admin_post_path(post)))
|
61
61
|
end
|
62
|
-
index :
|
62
|
+
index as: :table, default: true do
|
63
63
|
column :title
|
64
64
|
column :body
|
65
65
|
end
|
data/features/menu.feature
CHANGED
@@ -17,7 +17,7 @@ Feature: Menu
|
|
17
17
|
Given a configuration of:
|
18
18
|
"""
|
19
19
|
ActiveAdmin.register Post do
|
20
|
-
menu :
|
20
|
+
menu label: "Articles"
|
21
21
|
end
|
22
22
|
"""
|
23
23
|
When I am on the dashboard
|
@@ -29,7 +29,7 @@ Feature: Menu
|
|
29
29
|
"""
|
30
30
|
ActiveAdmin.application.namespace :admin do |admin|
|
31
31
|
admin.build_menu do |menu|
|
32
|
-
menu.add :
|
32
|
+
menu.add label: "Custom Menu", url: :admin_dashboard_path
|
33
33
|
end
|
34
34
|
end
|
35
35
|
"""
|
@@ -43,7 +43,7 @@ Feature: Menu
|
|
43
43
|
"""
|
44
44
|
ActiveAdmin.register User
|
45
45
|
ActiveAdmin.register Post do
|
46
|
-
menu :
|
46
|
+
menu parent: 'User'
|
47
47
|
end
|
48
48
|
"""
|
49
49
|
When I am on the dashboard
|
data/features/new_page.feature
CHANGED
@@ -11,7 +11,7 @@ Feature: New Page
|
|
11
11
|
ActiveAdmin.register Post do
|
12
12
|
if Rails::VERSION::MAJOR >= 4
|
13
13
|
permit_params :custom_category_id, :author_id, :title,
|
14
|
-
:body, :position, :
|
14
|
+
:body, :position, :published_date, :starred
|
15
15
|
end
|
16
16
|
end
|
17
17
|
"""
|
@@ -34,7 +34,7 @@ Feature: New Page
|
|
34
34
|
Given a configuration of:
|
35
35
|
"""
|
36
36
|
ActiveAdmin.register Post do
|
37
|
-
permit_params :custom_category_id, :author_id, :title, :body, :
|
37
|
+
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
|
38
38
|
|
39
39
|
form do |f|
|
40
40
|
f.inputs "Your Post" do
|
@@ -42,7 +42,7 @@ Feature: New Page
|
|
42
42
|
f.input :body
|
43
43
|
end
|
44
44
|
f.inputs "Publishing" do
|
45
|
-
f.input :
|
45
|
+
f.input :published_date
|
46
46
|
end
|
47
47
|
f.actions
|
48
48
|
end
|
@@ -62,7 +62,7 @@ Feature: New Page
|
|
62
62
|
Given "app/views/admin/posts/_form.html.erb" contains:
|
63
63
|
"""
|
64
64
|
<% url = @post.new_record? ? admin_posts_path : admin_post_path(@post) %>
|
65
|
-
<%= active_admin_form_for @post, :
|
65
|
+
<%= active_admin_form_for @post, url: url do |f|
|
66
66
|
f.inputs :title, :body
|
67
67
|
f.actions
|
68
68
|
end %>
|
@@ -70,9 +70,9 @@ Feature: New Page
|
|
70
70
|
Given a configuration of:
|
71
71
|
"""
|
72
72
|
ActiveAdmin.register Post do
|
73
|
-
permit_params :custom_category_id, :author_id, :title, :body, :
|
73
|
+
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
|
74
74
|
|
75
|
-
form :
|
75
|
+
form partial: "form"
|
76
76
|
end
|
77
77
|
"""
|
78
78
|
Given I follow "New Post"
|
@@ -87,7 +87,7 @@ Feature: New Page
|
|
87
87
|
Given a configuration of:
|
88
88
|
"""
|
89
89
|
ActiveAdmin.register Post do
|
90
|
-
permit_params :custom_category_id, :author_id, :title, :body, :
|
90
|
+
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
|
91
91
|
|
92
92
|
form do |f|
|
93
93
|
f.inputs "Your Post" do
|
@@ -98,7 +98,7 @@ Feature: New Page
|
|
98
98
|
f.input :body
|
99
99
|
end
|
100
100
|
f.inputs "Publishing" do
|
101
|
-
f.input :
|
101
|
+
f.input :published_date
|
102
102
|
end
|
103
103
|
f.actions
|
104
104
|
end
|
@@ -18,7 +18,7 @@ Feature: Registering Assets
|
|
18
18
|
Scenario: Registering a CSS file
|
19
19
|
Given a configuration of:
|
20
20
|
"""
|
21
|
-
ActiveAdmin.application.register_stylesheet "some-random-css.css", :
|
21
|
+
ActiveAdmin.application.register_stylesheet "some-random-css.css", media: :print
|
22
22
|
ActiveAdmin.register Post
|
23
23
|
"""
|
24
24
|
When I am on the index page for posts
|
@@ -49,7 +49,7 @@ Feature: Registering Pages
|
|
49
49
|
Given a configuration of:
|
50
50
|
"""
|
51
51
|
ActiveAdmin.register_page "Status" do
|
52
|
-
content :
|
52
|
+
content title: "Custom Page Title" do
|
53
53
|
"I love chocolate."
|
54
54
|
end
|
55
55
|
end
|
@@ -62,7 +62,7 @@ Feature: Registering Pages
|
|
62
62
|
Given a configuration of:
|
63
63
|
"""
|
64
64
|
ActiveAdmin.register_page "Status" do
|
65
|
-
content :
|
65
|
+
content title: proc{ "Custom Page Title from Proc" } do
|
66
66
|
"I love chocolate."
|
67
67
|
end
|
68
68
|
end
|
@@ -106,6 +106,36 @@ Feature: Registering Pages
|
|
106
106
|
And I follow "Status"
|
107
107
|
Then I should see an action item link to "Visit"
|
108
108
|
|
109
|
+
Scenario: Adding a page action to a page with multiple http methods
|
110
|
+
Given a configuration of:
|
111
|
+
"""
|
112
|
+
ActiveAdmin.register_page "Status" do
|
113
|
+
page_action :check, method: [:get, :post] do
|
114
|
+
redirect_to admin_status_path, notice: "Checked via #{request.method}"
|
115
|
+
end
|
116
|
+
|
117
|
+
action_item :post_check do
|
118
|
+
link_to "Post Check", admin_status_check_path, method: :post
|
119
|
+
end
|
120
|
+
|
121
|
+
action_item :get_check do
|
122
|
+
link_to "Get Check", admin_status_check_path
|
123
|
+
end
|
124
|
+
|
125
|
+
content do
|
126
|
+
"I love chocolate."
|
127
|
+
end
|
128
|
+
end
|
129
|
+
"""
|
130
|
+
When I go to the dashboard
|
131
|
+
And I follow "Status"
|
132
|
+
And I follow "Post Check"
|
133
|
+
Then I should see "Checked via POST"
|
134
|
+
And I should see the Active Admin layout
|
135
|
+
When I follow "Get Check"
|
136
|
+
Then I should see "Checked via GET"
|
137
|
+
And I should see the Active Admin layout
|
138
|
+
|
109
139
|
Scenario: Adding a page action to a page
|
110
140
|
Given a configuration of:
|
111
141
|
"""
|
@@ -146,3 +176,44 @@ Feature: Registering Pages
|
|
146
176
|
And I follow "Check"
|
147
177
|
Then I should see the content "Chocolate lØves You Too!"
|
148
178
|
And I should see the Active Admin layout
|
179
|
+
|
180
|
+
Scenario: Registering a page with paginated index table for a collection Array
|
181
|
+
Given a user named "John Doe" exists
|
182
|
+
Given a configuration of:
|
183
|
+
"""
|
184
|
+
ActiveAdmin.register_page "Special users" do
|
185
|
+
content do
|
186
|
+
collection = Kaminari.paginate_array(User.all).page(params.fetch(:page, 1))
|
187
|
+
|
188
|
+
table_for(collection, class: "index_table") do
|
189
|
+
column :first_name
|
190
|
+
column :last_name
|
191
|
+
end
|
192
|
+
|
193
|
+
paginated_collection(collection, entry_name: "Special users")
|
194
|
+
end
|
195
|
+
end
|
196
|
+
"""
|
197
|
+
When I go to the dashboard
|
198
|
+
And I follow "Special users"
|
199
|
+
Then I should see the page title "Special users"
|
200
|
+
And I should see the Active Admin layout
|
201
|
+
And I should see 1 user in the table
|
202
|
+
|
203
|
+
Scenario: Displaying parent information from a belongs_to page
|
204
|
+
Given a configuration of:
|
205
|
+
"""
|
206
|
+
ActiveAdmin.register Post
|
207
|
+
ActiveAdmin.register_page "Status" do
|
208
|
+
belongs_to :post
|
209
|
+
|
210
|
+
content do
|
211
|
+
"Status page for #{helpers.parent.title}"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
"""
|
215
|
+
And 1 post with the title "Post 1" exists
|
216
|
+
When I go to the first post custom status page
|
217
|
+
Then I should see the content "Status page for Post 1"
|
218
|
+
And I should see a link to "Post 1" in the breadcrumb
|
219
|
+
|
@@ -22,7 +22,7 @@ Feature: Registering Resources
|
|
22
22
|
Scenario: Registering a resource with another name
|
23
23
|
Given a configuration of:
|
24
24
|
"""
|
25
|
-
ActiveAdmin.register Post, :
|
25
|
+
ActiveAdmin.register Post, as: "My Post"
|
26
26
|
"""
|
27
27
|
When I go to the dashboard
|
28
28
|
Then I should see "My Posts"
|
@@ -11,7 +11,7 @@ Feature: Renamed Resource
|
|
11
11
|
ActiveAdmin.register Blog::Post, as: 'Post' do
|
12
12
|
if Rails::VERSION::MAJOR >= 4
|
13
13
|
permit_params :custom_category_id, :author_id, :title,
|
14
|
-
:body, :position, :
|
14
|
+
:body, :position, :published_date, :starred
|
15
15
|
end
|
16
16
|
end
|
17
17
|
"""
|
@@ -9,7 +9,7 @@ Feature: Show - Page Title
|
|
9
9
|
Given a show configuration of:
|
10
10
|
"""
|
11
11
|
ActiveAdmin.register Post do
|
12
|
-
show :
|
12
|
+
show title: :title
|
13
13
|
end
|
14
14
|
"""
|
15
15
|
Then I should see the page title "Hello World"
|
@@ -18,7 +18,7 @@ Feature: Show - Page Title
|
|
18
18
|
Given a show configuration of:
|
19
19
|
"""
|
20
20
|
ActiveAdmin.register Post do
|
21
|
-
show :
|
21
|
+
show title: "Title From String"
|
22
22
|
end
|
23
23
|
"""
|
24
24
|
Then I should see the page title "Title From String"
|
@@ -27,7 +27,7 @@ Feature: Show - Page Title
|
|
27
27
|
Given a show configuration of:
|
28
28
|
"""
|
29
29
|
ActiveAdmin.register Post do
|
30
|
-
show :
|
30
|
+
show title: proc{|post| "Title: " + post.title }
|
31
31
|
end
|
32
32
|
"""
|
33
33
|
Then I should see the page title "Title: Hello World"
|
@@ -34,7 +34,7 @@ Feature: Sidebar Sections
|
|
34
34
|
Given a configuration of:
|
35
35
|
"""
|
36
36
|
ActiveAdmin.register Post do
|
37
|
-
sidebar :help, :
|
37
|
+
sidebar :help, only: :index do
|
38
38
|
"Need help? Email us at help@example.com"
|
39
39
|
end
|
40
40
|
end
|
@@ -58,7 +58,7 @@ Feature: Sidebar Sections
|
|
58
58
|
Given a configuration of:
|
59
59
|
"""
|
60
60
|
ActiveAdmin.register Post do
|
61
|
-
sidebar :help, :
|
61
|
+
sidebar :help, except: :index do
|
62
62
|
"Need help? Email us at help@example.com"
|
63
63
|
end
|
64
64
|
end
|
@@ -80,7 +80,7 @@ Feature: Sidebar Sections
|
|
80
80
|
Given a configuration of:
|
81
81
|
"""
|
82
82
|
ActiveAdmin.register Post do
|
83
|
-
sidebar :help, :
|
83
|
+
sidebar :help, only: :index, if: proc{ current_active_admin_user.nil? } do
|
84
84
|
"Need help? Email us at help@example.com"
|
85
85
|
end
|
86
86
|
end
|
@@ -106,7 +106,7 @@ Feature: Sidebar Sections
|
|
106
106
|
end
|
107
107
|
ActiveAdmin.register Post do
|
108
108
|
controller { helper SidebarHelper }
|
109
|
-
sidebar :help, :
|
109
|
+
sidebar :help, only: :index, if: :can_sidebar? do
|
110
110
|
"Need help? Email us at help@example.com"
|
111
111
|
end
|
112
112
|
end
|
@@ -128,7 +128,7 @@ Feature: Sidebar Sections
|
|
128
128
|
Given a configuration of:
|
129
129
|
"""
|
130
130
|
ActiveAdmin.register Post do
|
131
|
-
sidebar :help, :
|
131
|
+
sidebar :help, only: :show, if: proc{ !current_active_admin_user.nil? } do
|
132
132
|
"Need help? Email us at help@example.com"
|
133
133
|
end
|
134
134
|
end
|
@@ -190,7 +190,7 @@ Feature: Sidebar Sections
|
|
190
190
|
Given a configuration of:
|
191
191
|
"""
|
192
192
|
ActiveAdmin.register Post do
|
193
|
-
sidebar :help, :
|
193
|
+
sidebar :help, partial: "custom_help_partial"
|
194
194
|
end
|
195
195
|
"""
|
196
196
|
When I am on the index page for posts
|
@@ -23,7 +23,7 @@ Feature: Specifying Actions
|
|
23
23
|
Given a configuration of:
|
24
24
|
"""
|
25
25
|
ActiveAdmin.register Post do
|
26
|
-
action_item(:import, :
|
26
|
+
action_item(:import, only: :index) do
|
27
27
|
link_to('Import Posts', import_admin_posts_path)
|
28
28
|
end
|
29
29
|
|
@@ -43,7 +43,7 @@ Feature: Specifying Actions
|
|
43
43
|
Given a configuration of:
|
44
44
|
"""
|
45
45
|
ActiveAdmin.register Post do
|
46
|
-
action_item(:review, :
|
46
|
+
action_item(:review, only: :show) do
|
47
47
|
link_to('Review', review_admin_post_path)
|
48
48
|
end
|
49
49
|
|
@@ -69,7 +69,7 @@ Feature: Specifying Actions
|
|
69
69
|
Given a configuration of:
|
70
70
|
"""
|
71
71
|
ActiveAdmin.register Post do
|
72
|
-
action_item(:review, :
|
72
|
+
action_item(:review, only: :show) do
|
73
73
|
link_to('Review', review_admin_post_path)
|
74
74
|
end
|
75
75
|
|
@@ -80,7 +80,7 @@ Feature: Specifying Actions
|
|
80
80
|
"""
|
81
81
|
Given "app/views/admin/posts/review.html.arb" contains:
|
82
82
|
"""
|
83
|
-
h1 "Review: #{
|
83
|
+
h1 "Review: #{post.title}"
|
84
84
|
"""
|
85
85
|
And I am logged in
|
86
86
|
And a post with the title "Hello World" exists
|
@@ -91,3 +91,28 @@ Feature: Specifying Actions
|
|
91
91
|
And I should see the page title "Review"
|
92
92
|
And I should see the Active Admin layout
|
93
93
|
|
94
|
+
Scenario: Specify a custom member action with multiple http methods
|
95
|
+
Given a configuration of:
|
96
|
+
"""
|
97
|
+
ActiveAdmin.register Post do
|
98
|
+
action_item(:get_check, only: :show) do
|
99
|
+
link_to('Get Check', check_admin_post_path)
|
100
|
+
end
|
101
|
+
|
102
|
+
action_item(:post_check, only: :show) do
|
103
|
+
link_to('Post Check', check_admin_post_path, method: :post)
|
104
|
+
end
|
105
|
+
|
106
|
+
member_action :check, method: [:get, :post] do
|
107
|
+
redirect_to admin_post_path(resource), notice: "Checked via #{request.method}"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
"""
|
111
|
+
And I am logged in
|
112
|
+
And a post with the title "Hello World" exists
|
113
|
+
When I am on the index page for posts
|
114
|
+
And I follow "View"
|
115
|
+
And I follow "Get Check"
|
116
|
+
Then I should see "Checked via GET"
|
117
|
+
When I follow "Post Check"
|
118
|
+
Then I should see "Checked via POST"
|