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
@@ -32,7 +32,7 @@ Feature: Action Item
|
|
32
32
|
Given a configuration of:
|
33
33
|
"""
|
34
34
|
ActiveAdmin.register Post do
|
35
|
-
action_item :embiggen, :
|
35
|
+
action_item :embiggen, if: proc{ !current_active_admin_user.nil? } do
|
36
36
|
link_to "Embiggen", '/'
|
37
37
|
end
|
38
38
|
end
|
@@ -54,7 +54,7 @@ Feature: Action Item
|
|
54
54
|
Given a configuration of:
|
55
55
|
"""
|
56
56
|
ActiveAdmin.register Post do
|
57
|
-
action_item :embiggen, :
|
57
|
+
action_item :embiggen, if: proc{ current_active_admin_user.nil? } do
|
58
58
|
link_to "Embiggen", '/'
|
59
59
|
end
|
60
60
|
end
|
@@ -12,12 +12,12 @@ Feature: Authorizing Access using CanCan
|
|
12
12
|
|
13
13
|
def initialize(user)
|
14
14
|
# Manage Posts
|
15
|
-
can [:edit, :destroy], Post, :
|
15
|
+
can [:edit, :destroy], Post, author_id: user.id
|
16
16
|
can :read, Post
|
17
17
|
|
18
18
|
# View Pages
|
19
|
-
can :read, ActiveAdmin::Page, :
|
20
|
-
cannot :read, ActiveAdmin::Page, :
|
19
|
+
can :read, ActiveAdmin::Page, name: "Dashboard"
|
20
|
+
cannot :read, ActiveAdmin::Page, name: "No Access"
|
21
21
|
end
|
22
22
|
|
23
23
|
end
|
data/features/belongs_to.feature
CHANGED
@@ -21,9 +21,67 @@ Feature: Belongs To
|
|
21
21
|
And I should see "Displaying 1 Post"
|
22
22
|
And I should see a link to "Users" in the breadcrumb
|
23
23
|
And I should see a link to "Jane Doe" in the breadcrumb
|
24
|
-
|
24
|
+
|
25
|
+
Scenario: Updating a child resource page
|
26
|
+
Given a configuration of:
|
27
|
+
"""
|
28
|
+
ActiveAdmin.register User
|
29
|
+
ActiveAdmin.register Post do
|
30
|
+
belongs_to :user
|
31
|
+
permit_params :title, :body, :published_date if Rails::VERSION::MAJOR >= 4
|
32
|
+
|
33
|
+
form do |f|
|
34
|
+
f.inputs "Your Post" do
|
35
|
+
f.input :title
|
36
|
+
f.input :body
|
37
|
+
end
|
38
|
+
f.inputs "Publishing" do
|
39
|
+
f.input :published_date
|
40
|
+
end
|
41
|
+
f.actions
|
42
|
+
end
|
43
|
+
end
|
44
|
+
"""
|
45
|
+
When I go to the last author's last post page
|
46
|
+
Then I follow "Edit Post"
|
47
|
+
Then I should see the element "form[action='/admin/users/2/posts/2']"
|
25
48
|
Then I should see a link to "Hello World" in the breadcrumb
|
26
49
|
|
50
|
+
When I press "Update Post"
|
51
|
+
Then I should see "Post was successfully updated."
|
52
|
+
|
53
|
+
Scenario: Creating a child resource page
|
54
|
+
Given a configuration of:
|
55
|
+
"""
|
56
|
+
ActiveAdmin.register User
|
57
|
+
ActiveAdmin.register Post do
|
58
|
+
belongs_to :user
|
59
|
+
permit_params :title, :body, :published_date if Rails::VERSION::MAJOR >= 4
|
60
|
+
|
61
|
+
form do |f|
|
62
|
+
f.inputs "Your Post" do
|
63
|
+
f.input :title
|
64
|
+
f.input :body
|
65
|
+
end
|
66
|
+
f.inputs "Publishing" do
|
67
|
+
f.input :published_date
|
68
|
+
end
|
69
|
+
f.actions
|
70
|
+
end
|
71
|
+
end
|
72
|
+
"""
|
73
|
+
When I go to the last author's posts
|
74
|
+
Then I follow "New Post"
|
75
|
+
Then I should see the element "form[action='/admin/users/2/posts']"
|
76
|
+
Then I fill in "Title" with "Hello World"
|
77
|
+
Then I fill in "Body" with "This is the body"
|
78
|
+
|
79
|
+
When I press "Create Post"
|
80
|
+
Then I should see "Post was successfully created."
|
81
|
+
And I should see the attribute "Title" with "Hello World"
|
82
|
+
And I should see the attribute "Body" with "This is the body"
|
83
|
+
And I should see the attribute "Author" with "Jane Doe"
|
84
|
+
|
27
85
|
Scenario: Viewing a child resource page
|
28
86
|
Given a configuration of:
|
29
87
|
"""
|
@@ -42,7 +100,7 @@ Feature: Belongs To
|
|
42
100
|
"""
|
43
101
|
ActiveAdmin.register User
|
44
102
|
ActiveAdmin.register Post do
|
45
|
-
belongs_to :user, :
|
103
|
+
belongs_to :user, optional: true
|
46
104
|
end
|
47
105
|
"""
|
48
106
|
When I go to the last author's posts
|
@@ -40,8 +40,8 @@ Feature: Commenting
|
|
40
40
|
Given a configuration of:
|
41
41
|
"""
|
42
42
|
ActiveAdmin.application.namespace(:new_namespace).comments = false
|
43
|
-
ActiveAdmin.register Post, :
|
44
|
-
ActiveAdmin.register AdminUser, :
|
43
|
+
ActiveAdmin.register Post, namespace: :new_namespace
|
44
|
+
ActiveAdmin.register AdminUser, namespace: :new_namespace
|
45
45
|
"""
|
46
46
|
Given I am logged in
|
47
47
|
When I am on the index page for posts in the new_namespace namespace
|
@@ -52,10 +52,10 @@ Feature: Commenting
|
|
52
52
|
Given a configuration of:
|
53
53
|
"""
|
54
54
|
ActiveAdmin.application.namespace(:new_namespace).comments = false
|
55
|
-
ActiveAdmin.register Post, :
|
55
|
+
ActiveAdmin.register Post, namespace: :new_namespace do
|
56
56
|
config.comments = true
|
57
57
|
end
|
58
|
-
ActiveAdmin.register AdminUser, :
|
58
|
+
ActiveAdmin.register AdminUser, namespace: :new_namespace
|
59
59
|
"""
|
60
60
|
Given I am logged in
|
61
61
|
When I am on the index page for posts in the new_namespace namespace
|
@@ -66,8 +66,8 @@ Feature: Commenting
|
|
66
66
|
Given a show configuration of:
|
67
67
|
"""
|
68
68
|
ActiveAdmin.register Post
|
69
|
-
ActiveAdmin.register Post, :
|
70
|
-
ActiveAdmin.register AdminUser, :
|
69
|
+
ActiveAdmin.register Post, namespace: :public
|
70
|
+
ActiveAdmin.register AdminUser, namespace: :public
|
71
71
|
"""
|
72
72
|
When I add a comment "Hello world in admin namespace"
|
73
73
|
Then I should see "Hello world in admin namespace"
|
@@ -87,7 +87,7 @@ Feature: Commenting
|
|
87
87
|
Scenario: Creating a comment on an aliased resource
|
88
88
|
Given a configuration of:
|
89
89
|
"""
|
90
|
-
ActiveAdmin.register Post, :
|
90
|
+
ActiveAdmin.register Post, as: "Article"
|
91
91
|
"""
|
92
92
|
Given I am logged in
|
93
93
|
When I am on the index page for articles
|
@@ -14,7 +14,7 @@ Feature: Development Reloading
|
|
14
14
|
ActiveAdmin.register Post do
|
15
15
|
if Rails::VERSION::MAJOR >= 4
|
16
16
|
permit_params :custom_category_id, :author_id, :title,
|
17
|
-
:body, :position, :
|
17
|
+
:body, :position, :published_date, :starred
|
18
18
|
end
|
19
19
|
end
|
20
20
|
"""
|
data/features/edit_page.feature
CHANGED
@@ -12,7 +12,7 @@ Feature: Edit Page
|
|
12
12
|
ActiveAdmin.register Post do
|
13
13
|
if Rails::VERSION::MAJOR >= 4
|
14
14
|
permit_params :custom_category_id, :author_id, :title,
|
15
|
-
:body, :position, :
|
15
|
+
:body, :position, :published_date, :starred
|
16
16
|
end
|
17
17
|
end
|
18
18
|
"""
|
@@ -34,7 +34,7 @@ Feature: Edit Page
|
|
34
34
|
Given a configuration of:
|
35
35
|
"""
|
36
36
|
ActiveAdmin.register Post do
|
37
|
-
permit_params :category, :author, :title, :body, :
|
37
|
+
permit_params :category, :author, :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: Edit 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
|
@@ -63,15 +63,15 @@ Feature: Edit Page
|
|
63
63
|
Given a configuration of:
|
64
64
|
"""
|
65
65
|
ActiveAdmin.register Post do
|
66
|
-
permit_params :category, :author, :title, :body, :
|
66
|
+
permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
|
67
67
|
|
68
|
-
form :
|
68
|
+
form html: {} do |f|
|
69
69
|
f.inputs "Your Post" do
|
70
70
|
f.input :title
|
71
71
|
f.input :body
|
72
72
|
end
|
73
73
|
f.inputs "Publishing" do
|
74
|
-
f.input :
|
74
|
+
f.input :published_date
|
75
75
|
end
|
76
76
|
f.actions
|
77
77
|
end
|
@@ -94,7 +94,7 @@ Feature: Edit Page
|
|
94
94
|
Given "app/views/admin/posts/_form.html.erb" contains:
|
95
95
|
"""
|
96
96
|
<% url = @post.new_record? ? admin_posts_path : admin_post_path(@post) %>
|
97
|
-
<%= active_admin_form_for @post, :
|
97
|
+
<%= active_admin_form_for @post, url: url do |f|
|
98
98
|
f.inputs :title, :body
|
99
99
|
f.actions
|
100
100
|
end %>
|
@@ -102,9 +102,9 @@ Feature: Edit Page
|
|
102
102
|
Given a configuration of:
|
103
103
|
"""
|
104
104
|
ActiveAdmin.register Post do
|
105
|
-
permit_params :category, :author, :title, :body, :
|
105
|
+
permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
|
106
106
|
|
107
|
-
form :
|
107
|
+
form partial: "form"
|
108
108
|
end
|
109
109
|
"""
|
110
110
|
Given I follow "Edit"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Feature: Site title
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
In order to customize the site footer
|
5
|
+
I want to set it in the configuration
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I am logged in
|
9
|
+
|
10
|
+
Scenario: No footer is set in the configuration (default)
|
11
|
+
When I am on the dashboard
|
12
|
+
And I should see the default footer
|
13
|
+
|
14
|
+
Scenario: Set the footer in the configuration
|
15
|
+
Given a configuration of:
|
16
|
+
"""
|
17
|
+
ActiveAdmin.application.footer = "MyApp Revision 123"
|
18
|
+
"""
|
19
|
+
When I am on the dashboard
|
20
|
+
And I should see the footer "MyApp Revision 123"
|
21
|
+
|
22
|
+
Scenario: Set the footer to a proc
|
23
|
+
Given a configuration of:
|
24
|
+
"""
|
25
|
+
ActiveAdmin.application.footer = proc { "Enjoy MyApp Revision 123, #{controller.current_admin_user.try(:email)}!" }
|
26
|
+
"""
|
27
|
+
When I am on the dashboard
|
28
|
+
And I should see the footer "Enjoy MyApp Revision 123, admin@example.com!"
|
data/features/i18n.feature
CHANGED
@@ -41,3 +41,14 @@ Feature: Internationalization
|
|
41
41
|
When I go to the dashboard
|
42
42
|
When I follow "Bookstores"
|
43
43
|
Then I should see "Download this:"
|
44
|
+
|
45
|
+
Scenario: Overriding resource details table title
|
46
|
+
Given a configuration of:
|
47
|
+
"""
|
48
|
+
ActiveAdmin.register Post
|
49
|
+
"""
|
50
|
+
And String "Post detailed information" corresponds to "resources.post.details"
|
51
|
+
And I am logged in
|
52
|
+
And a post exists
|
53
|
+
When I go to the last post's show page
|
54
|
+
Then I should see "Post detailed information"
|
@@ -21,6 +21,28 @@ Feature: Batch Actions
|
|
21
21
|
Then I should see a flash with "Successfully destroyed 2 posts"
|
22
22
|
And I should see 8 posts in the table
|
23
23
|
|
24
|
+
Scenario: Use default (destroy) batch action when default_url_options present
|
25
|
+
Given 3 posts exist
|
26
|
+
And an index configuration of:
|
27
|
+
"""
|
28
|
+
ActiveAdmin.register Post do
|
29
|
+
controller do
|
30
|
+
protected
|
31
|
+
|
32
|
+
def default_url_options
|
33
|
+
{ locale: I18n.locale }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
"""
|
38
|
+
When I check the 1st record
|
39
|
+
And I follow "Batch Actions"
|
40
|
+
Then I should see the batch action :destroy "Delete Selected"
|
41
|
+
|
42
|
+
Given I submit the batch action form with "destroy"
|
43
|
+
Then I should see a flash with "Successfully destroyed 1 post"
|
44
|
+
And I should see 2 posts in the table
|
45
|
+
|
24
46
|
Scenario: Use default (destroy) batch action on a decorated resource
|
25
47
|
Given 5 posts exist
|
26
48
|
And an index configuration of:
|
@@ -83,7 +105,7 @@ Feature: Batch Actions
|
|
83
105
|
"""
|
84
106
|
ActiveAdmin.register Post do
|
85
107
|
batch_action(:flag) do
|
86
|
-
redirect_to collection_path, :
|
108
|
+
redirect_to collection_path, notice: "Successfully flagged 10 posts"
|
87
109
|
end
|
88
110
|
end
|
89
111
|
"""
|
@@ -119,8 +141,8 @@ Feature: Batch Actions
|
|
119
141
|
And an index configuration of:
|
120
142
|
"""
|
121
143
|
ActiveAdmin.register Post do
|
122
|
-
batch_action(:flag, :
|
123
|
-
batch_action(:unflag, :
|
144
|
+
batch_action(:flag, if: proc { true }) {}
|
145
|
+
batch_action(:unflag, if: proc { false }) {}
|
124
146
|
end
|
125
147
|
"""
|
126
148
|
Then I should see the batch action :flag "Flag Selected"
|
@@ -131,9 +153,9 @@ Feature: Batch Actions
|
|
131
153
|
And an index configuration of:
|
132
154
|
"""
|
133
155
|
ActiveAdmin.register Post do
|
134
|
-
batch_action(:test, :
|
135
|
-
batch_action(:flag, :
|
136
|
-
batch_action(:unflag, :
|
156
|
+
batch_action(:test, priority: 3) {}
|
157
|
+
batch_action(:flag, priority: 2) {}
|
158
|
+
batch_action(:unflag, priority: 1) {}
|
137
159
|
end
|
138
160
|
"""
|
139
161
|
Then the 4th batch action should be "Delete Selected"
|
@@ -9,13 +9,13 @@ Feature: Index Filtering
|
|
9
9
|
When I am on the index page for posts
|
10
10
|
Then I should see "Displaying all 3 Posts"
|
11
11
|
And I should see the following filters:
|
12
|
-
| Author
|
13
|
-
| Category
|
14
|
-
| Title
|
15
|
-
| Body
|
16
|
-
| Published
|
17
|
-
| Created at
|
18
|
-
| Updated at
|
12
|
+
| Author | select |
|
13
|
+
| Category | select |
|
14
|
+
| Title | string |
|
15
|
+
| Body | string |
|
16
|
+
| Published date | date range |
|
17
|
+
| Created at | date range |
|
18
|
+
| Updated at | date range |
|
19
19
|
|
20
20
|
When I fill in "Title" with "Hello World 2"
|
21
21
|
And I press "Filter"
|
@@ -60,7 +60,7 @@ Feature: Index Filtering
|
|
60
60
|
And an index configuration of:
|
61
61
|
"""
|
62
62
|
ActiveAdmin.register Post do
|
63
|
-
filter :author, :
|
63
|
+
filter :author, as: :check_boxes
|
64
64
|
end
|
65
65
|
"""
|
66
66
|
When I press "Filter"
|
@@ -74,7 +74,7 @@ Feature: Index Filtering
|
|
74
74
|
And an index configuration of:
|
75
75
|
"""
|
76
76
|
ActiveAdmin.register Post do
|
77
|
-
filter :author, :
|
77
|
+
filter :author, as: :check_boxes
|
78
78
|
end
|
79
79
|
"""
|
80
80
|
When I check "Jane Doe"
|
@@ -134,7 +134,7 @@ Feature: Index Filtering
|
|
134
134
|
And an index configuration of:
|
135
135
|
"""
|
136
136
|
ActiveAdmin.register Category do
|
137
|
-
filter :authors, :
|
137
|
+
filter :authors, as: :check_boxes
|
138
138
|
end
|
139
139
|
"""
|
140
140
|
When I press "Filter"
|
@@ -149,7 +149,7 @@ Feature: Index Filtering
|
|
149
149
|
And an index configuration of:
|
150
150
|
"""
|
151
151
|
ActiveAdmin.register Category do
|
152
|
-
filter :authors, :
|
152
|
+
filter :authors, as: :check_boxes
|
153
153
|
end
|
154
154
|
"""
|
155
155
|
When I check "Jane Doe"
|
@@ -158,4 +158,24 @@ Feature: Index Filtering
|
|
158
158
|
And I should see "Non-Fiction" within ".index_table"
|
159
159
|
And the "Jane Doe" checkbox should be checked
|
160
160
|
|
161
|
+
Scenario: Enabling filters status sidebar
|
162
|
+
Given an index configuration of:
|
163
|
+
"""
|
164
|
+
ActiveAdmin.application.current_filters = false
|
165
|
+
ActiveAdmin.register Post do
|
166
|
+
config.current_filters = true
|
167
|
+
end
|
168
|
+
"""
|
169
|
+
And I press "Filter"
|
170
|
+
Then I should see a sidebar titled "Search Status:"
|
161
171
|
|
172
|
+
Scenario: Disabling filters status sidebar
|
173
|
+
Given an index configuration of:
|
174
|
+
"""
|
175
|
+
ActiveAdmin.application.current_filters = true
|
176
|
+
ActiveAdmin.register Post do
|
177
|
+
config.current_filters = false
|
178
|
+
end
|
179
|
+
"""
|
180
|
+
And I press "Filter"
|
181
|
+
Then I should not see a sidebar titled "Search Status:"
|
@@ -12,19 +12,19 @@ Feature: Format as CSV
|
|
12
12
|
When I am on the index page for posts
|
13
13
|
And I follow "CSV"
|
14
14
|
And I should download a CSV file for "posts" containing:
|
15
|
-
| Id | Title | Body | Published
|
15
|
+
| Id | Title | Body | Published date | Position | Starred | Created at | Updated at |
|
16
16
|
| \d+ | Hello World | | | | | (.*) | (.*) |
|
17
17
|
|
18
18
|
Scenario: Default with alias
|
19
19
|
Given a configuration of:
|
20
20
|
"""
|
21
|
-
ActiveAdmin.register Post, :
|
21
|
+
ActiveAdmin.register Post, as: "MyArticle"
|
22
22
|
"""
|
23
23
|
And 1 post exists
|
24
24
|
When I am on the index page for my_articles
|
25
25
|
And I follow "CSV"
|
26
26
|
And I should download a CSV file for "my-articles" containing:
|
27
|
-
| Id | Title | Body | Published
|
27
|
+
| Id | Title | Body | Published date | Position | Starred | Created at | Updated at |
|
28
28
|
|
29
29
|
Scenario: With CSV format customization
|
30
30
|
Given a configuration of:
|
@@ -48,7 +48,7 @@ Feature: Format as CSV
|
|
48
48
|
Given a configuration of:
|
49
49
|
"""
|
50
50
|
ActiveAdmin.register Post do
|
51
|
-
csv :
|
51
|
+
csv col_sep: ';' do
|
52
52
|
column :title
|
53
53
|
column :body
|
54
54
|
end
|
@@ -65,7 +65,7 @@ Feature: Format as CSV
|
|
65
65
|
Given a configuration of:
|
66
66
|
"""
|
67
67
|
ActiveAdmin.register Post do
|
68
|
-
csv :
|
68
|
+
csv force_quotes: true, byte_order_mark: "" do
|
69
69
|
column :title
|
70
70
|
column :body
|
71
71
|
end
|
@@ -82,7 +82,7 @@ Feature: Format as CSV
|
|
82
82
|
Scenario: With default CSV separator option
|
83
83
|
Given a configuration of:
|
84
84
|
"""
|
85
|
-
ActiveAdmin.application.csv_options = { :
|
85
|
+
ActiveAdmin.application.csv_options = { col_sep: ';' }
|
86
86
|
ActiveAdmin.register Post do
|
87
87
|
csv do
|
88
88
|
column :title
|
@@ -100,7 +100,7 @@ Feature: Format as CSV
|
|
100
100
|
Scenario: With default CSV options
|
101
101
|
Given a configuration of:
|
102
102
|
"""
|
103
|
-
ActiveAdmin.application.csv_options = {:
|
103
|
+
ActiveAdmin.application.csv_options = {col_sep: ',', force_quotes: true}
|
104
104
|
ActiveAdmin.register Post do
|
105
105
|
csv do
|
106
106
|
column :title
|
@@ -119,9 +119,9 @@ Feature: Format as CSV
|
|
119
119
|
Scenario: Without CVS column names explicitely specified
|
120
120
|
Given a configuration of:
|
121
121
|
"""
|
122
|
-
ActiveAdmin.application.csv_options = {:
|
122
|
+
ActiveAdmin.application.csv_options = {col_sep: ',', force_quotes: true}
|
123
123
|
ActiveAdmin.register Post do
|
124
|
-
csv :
|
124
|
+
csv column_names: true do
|
125
125
|
column :title
|
126
126
|
column :body
|
127
127
|
end
|
@@ -137,9 +137,9 @@ Feature: Format as CSV
|
|
137
137
|
Scenario: Without CVS column names
|
138
138
|
Given a configuration of:
|
139
139
|
"""
|
140
|
-
ActiveAdmin.application.csv_options = {:
|
140
|
+
ActiveAdmin.application.csv_options = {col_sep: ',', force_quotes: true}
|
141
141
|
ActiveAdmin.register Post do
|
142
|
-
csv :
|
142
|
+
csv column_names: false do
|
143
143
|
column :title
|
144
144
|
column :body
|
145
145
|
end
|
@@ -155,7 +155,7 @@ Feature: Format as CSV
|
|
155
155
|
Given a configuration of:
|
156
156
|
"""
|
157
157
|
ActiveAdmin.register Post do
|
158
|
-
csv :
|
158
|
+
csv encoding: 'SJIS' do
|
159
159
|
column :title
|
160
160
|
column :body
|
161
161
|
end
|
@@ -169,7 +169,7 @@ Feature: Format as CSV
|
|
169
169
|
Scenario: With default encoding CSV options
|
170
170
|
Given a configuration of:
|
171
171
|
"""
|
172
|
-
ActiveAdmin.application.csv_options = { :
|
172
|
+
ActiveAdmin.application.csv_options = { encoding: 'SJIS' }
|
173
173
|
ActiveAdmin.register Post do
|
174
174
|
csv do
|
175
175
|
column :title
|