activeadmin 1.0.0.pre5 → 1.0.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +27 -0
- data/.travis.yml +21 -23
- data/Appraisals +12 -74
- data/CHANGELOG.md +21 -5
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +8 -9
- data/README.md +19 -56
- data/Rakefile +1 -1
- data/activeadmin.gemspec +4 -4
- data/app/assets/stylesheets/active_admin/_forms.scss +10 -0
- data/config/locales/ca.yml +1 -1
- data/config/locales/da.yml +44 -12
- data/config/locales/el.yml +1 -1
- data/config/locales/en.yml +2 -0
- data/config/locales/fr.yml +16 -2
- data/config/locales/ja.yml +1 -0
- data/config/locales/zh-CN.yml +4 -0
- data/docs/12-arbre-components.md +23 -0
- data/docs/14-gotchas.md +1 -1
- data/docs/2-resource-customization.md +2 -5
- data/docs/5-forms.md +19 -0
- data/docs/6-show-pages.md +0 -28
- data/docs/9-batch-actions.md +0 -1
- data/docs/CNAME +1 -1
- data/docs/_includes/head.html +4 -4
- data/docs/_includes/toc.html +2 -1
- data/docs/documentation.md +2 -2
- data/docs/index.html +1 -6
- data/docs/stylesheets/main.css +172 -219
- data/features/belongs_to.feature +5 -5
- data/features/comments/commenting.feature +0 -13
- data/features/create_another.feature +55 -0
- data/features/development_reloading.feature +2 -4
- data/features/edit_page.feature +6 -7
- data/features/favicon.feature +2 -2
- data/features/i18n.feature +1 -0
- data/features/index/filters.feature +18 -0
- data/features/index/format_as_csv.feature +3 -3
- data/features/index/formats.feature +22 -0
- data/features/index/index_as_table.feature +6 -6
- data/features/index/page_title.feature +1 -2
- data/features/menu.feature +20 -1
- data/features/new_page.feature +6 -8
- data/features/registering_assets.feature +4 -4
- data/features/registering_pages.feature +18 -0
- data/features/renamed_resource.feature +2 -4
- data/features/show/page_title.feature +1 -2
- data/features/step_definitions/attribute_steps.rb +1 -1
- data/features/step_definitions/configuration_steps.rb +2 -2
- data/features/step_definitions/format_steps.rb +4 -0
- data/features/step_definitions/index_scope_steps.rb +1 -1
- data/features/step_definitions/menu_steps.rb +2 -2
- data/features/step_definitions/user_steps.rb +1 -1
- data/features/step_definitions/web_steps.rb +6 -5
- data/features/sti_resource.feature +2 -2
- data/features/strong_parameters.feature +0 -4
- data/features/support/env.rb +5 -19
- data/features/support/paths.rb +6 -9
- data/gemfiles/rails_42.gemfile +15 -23
- data/gemfiles/rails_50.gemfile +15 -16
- data/gemfiles/rails_51.gemfile +45 -0
- data/lib/active_admin/application.rb +4 -0
- data/lib/active_admin/base_controller.rb +2 -7
- data/lib/active_admin/base_controller/menu.rb +1 -5
- data/lib/active_admin/csv_builder.rb +2 -2
- data/lib/active_admin/dependency.rb +4 -8
- data/lib/active_admin/devise.rb +1 -1
- data/lib/active_admin/error.rb +1 -1
- data/lib/active_admin/filters/active.rb +2 -10
- data/lib/active_admin/filters/resource_extension.rb +1 -10
- data/lib/active_admin/inputs/filters/date_range_input.rb +1 -1
- data/lib/active_admin/inputs/filters/select_input.rb +1 -2
- data/lib/active_admin/inputs/filters/text_input.rb +2 -2
- data/lib/active_admin/menu.rb +1 -1
- data/lib/active_admin/namespace.rb +14 -7
- data/lib/active_admin/orm/active_record/comments.rb +2 -7
- data/lib/active_admin/orm/active_record/comments/comment.rb +2 -12
- data/lib/active_admin/page.rb +5 -0
- data/lib/active_admin/page_controller.rb +1 -5
- data/lib/active_admin/resource.rb +28 -5
- data/lib/active_admin/resource/attributes.rb +44 -0
- data/lib/active_admin/resource/menu.rb +4 -1
- data/lib/active_admin/resource/routes.rb +2 -3
- data/lib/active_admin/resource_controller.rb +13 -0
- data/lib/active_admin/resource_controller/data_access.rb +18 -9
- data/lib/active_admin/resource_dsl.rb +21 -18
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +1 -1
- data/lib/active_admin/view_helpers/display_helper.rb +10 -12
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +12 -0
- data/lib/active_admin/view_helpers/fields_for.rb +1 -2
- data/lib/active_admin/view_helpers/form_helper.rb +1 -1
- data/lib/active_admin/views/components/active_admin_form.rb +28 -2
- data/lib/active_admin/views/components/paginated_collection.rb +3 -8
- data/lib/active_admin/views/components/table_for.rb +1 -1
- data/lib/active_admin/views/index_as_table.rb +2 -2
- data/lib/active_admin/views/pages/layout.rb +1 -1
- data/lib/active_admin/views/pages/show.rb +1 -1
- data/lib/bug_report_templates/rails_5_master.rb +1 -3
- data/lib/generators/active_admin/devise/devise_generator.rb +1 -1
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +7 -0
- data/lib/generators/active_admin/install/templates/admin_user.rb.erb +0 -2
- data/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb +5 -7
- data/lib/generators/active_admin/resource/resource_generator.rb +1 -1
- data/lib/generators/active_admin/resource/templates/{admin.rb → admin.rb.erb} +0 -2
- data/lib/ransack_ext.rb +2 -2
- data/spec/rails_helper.rb +1 -19
- data/spec/requests/default_namespace_spec.rb +40 -8
- data/spec/support/active_admin_integration_spec_helper.rb +9 -2
- data/spec/support/rails_template.rb +17 -20
- data/spec/support/rails_template_with_data.rb +3 -9
- data/spec/support/templates/admin/stores.rb +1 -3
- data/spec/unit/application_spec.rb +19 -8
- data/spec/unit/belongs_to_spec.rb +6 -2
- data/spec/unit/comments_spec.rb +0 -19
- data/spec/unit/controller_filters_spec.rb +5 -5
- data/spec/unit/csv_builder_spec.rb +7 -4
- data/spec/unit/filters/active_spec.rb +1 -8
- data/spec/unit/filters/filter_form_builder_spec.rb +2 -3
- data/spec/unit/filters/resource_spec.rb +3 -4
- data/spec/unit/form_builder_spec.rb +39 -11
- data/spec/unit/namespace/register_page_spec.rb +1 -1
- data/spec/unit/pretty_format_spec.rb +39 -35
- data/spec/unit/resource/attributes_spec.rb +50 -0
- data/spec/unit/resource/includes_spec.rb +1 -1
- data/spec/unit/resource/ordering_spec.rb +1 -1
- data/spec/unit/resource/routes_spec.rb +2 -2
- data/spec/unit/resource_controller/data_access_spec.rb +51 -10
- data/spec/unit/resource_controller/decorators_spec.rb +2 -2
- data/spec/unit/resource_controller/sidebars_spec.rb +3 -3
- data/spec/unit/resource_controller_spec.rb +16 -5
- data/spec/unit/resource_spec.rb +12 -38
- data/spec/unit/routing_spec.rb +2 -2
- data/spec/unit/view_helpers/breadcrumbs_spec.rb +36 -1
- data/spec/unit/view_helpers/display_helper_spec.rb +17 -2
- data/spec/unit/view_helpers/fields_for_spec.rb +1 -1
- data/spec/unit/view_helpers/form_helper_spec.rb +3 -3
- data/spec/unit/view_helpers/method_or_proc_helper_spec.rb +2 -2
- data/spec/unit/views/components/attributes_table_spec.rb +2 -2
- data/spec/unit/views/components/index_list_spec.rb +1 -1
- data/spec/unit/views/components/paginated_collection_spec.rb +4 -4
- data/spec/unit/views/components/table_for_spec.rb +1 -1
- data/spec/unit/views/components/unsupported_browser_spec.rb +1 -1
- data/spec/unit/views/pages/form_spec.rb +4 -1
- data/spec/unit/views/pages/index_spec.rb +1 -1
- data/spec/unit/views/pages/show_spec.rb +2 -3
- data/tasks/lint.rake +8 -0
- metadata +22 -29
- data/features/step_definitions/symbol_leak_steps.rb +0 -3
- data/features/symbol_leak.feature +0 -35
- data/gemfiles/rails_32.gemfile +0 -54
- data/gemfiles/rails_40.gemfile +0 -53
- data/gemfiles/rails_41.gemfile +0 -53
- data/spec/support/deferred_garbage_collection.rb +0 -19
data/features/belongs_to.feature
CHANGED
@@ -16,8 +16,8 @@ Feature: Belongs To
|
|
16
16
|
end
|
17
17
|
"""
|
18
18
|
When I go to the last author's posts
|
19
|
-
Then the "
|
20
|
-
And I should not see a menu item for "
|
19
|
+
Then the "Users" tab should be selected
|
20
|
+
And I should not see a menu item for "Posts"
|
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
|
@@ -28,7 +28,7 @@ Feature: Belongs To
|
|
28
28
|
ActiveAdmin.register User
|
29
29
|
ActiveAdmin.register Post do
|
30
30
|
belongs_to :user
|
31
|
-
permit_params :title, :body, :published_date
|
31
|
+
permit_params :title, :body, :published_date
|
32
32
|
|
33
33
|
form do |f|
|
34
34
|
f.inputs "Your Post" do
|
@@ -56,7 +56,7 @@ Feature: Belongs To
|
|
56
56
|
ActiveAdmin.register User
|
57
57
|
ActiveAdmin.register Post do
|
58
58
|
belongs_to :user
|
59
|
-
permit_params :title, :body, :published_date
|
59
|
+
permit_params :title, :body, :published_date
|
60
60
|
|
61
61
|
form do |f|
|
62
62
|
f.inputs "Your Post" do
|
@@ -93,7 +93,7 @@ Feature: Belongs To
|
|
93
93
|
When I go to the last author's posts
|
94
94
|
And I follow "View"
|
95
95
|
Then I should be on the last author's last post page
|
96
|
-
And the "
|
96
|
+
And the "Users" tab should be selected
|
97
97
|
|
98
98
|
Scenario: When the belongs to is optional
|
99
99
|
Given a configuration of:
|
@@ -145,19 +145,6 @@ Feature: Commenting
|
|
145
145
|
And I should be in the resource section for publishers
|
146
146
|
And I should see "Hello World"
|
147
147
|
|
148
|
-
Scenario: Commenting on a class with string id
|
149
|
-
Given a tag with the name "coolness" exists
|
150
|
-
Given a configuration of:
|
151
|
-
"""
|
152
|
-
ActiveAdmin.register Tag
|
153
|
-
"""
|
154
|
-
Given I am logged in
|
155
|
-
When I am on the index page for tags
|
156
|
-
And I follow "View"
|
157
|
-
When I add a comment "Tag Comment"
|
158
|
-
Then I should see a flash with "Comment was successfully created"
|
159
|
-
And I should be in the resource section for tags
|
160
|
-
|
161
148
|
Scenario: Commenting on an aliased resource with an existing non-aliased config
|
162
149
|
Given a configuration of:
|
163
150
|
"""
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Feature: Create Another checkbox
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am logged in
|
5
|
+
|
6
|
+
Scenario: On a new page
|
7
|
+
Given a configuration of:
|
8
|
+
"""
|
9
|
+
ActiveAdmin.register Post do
|
10
|
+
config.create_another = true
|
11
|
+
|
12
|
+
permit_params :custom_category_id, :author_id, :title,
|
13
|
+
:body, :position, :published_date, :starred
|
14
|
+
end
|
15
|
+
"""
|
16
|
+
Then I am on the index page for posts
|
17
|
+
And I follow "New Post"
|
18
|
+
When I fill in "Title" with "Hello World"
|
19
|
+
And I fill in "Body" with "This is the body"
|
20
|
+
And the "Create another Post" checkbox should not be checked
|
21
|
+
And I check "Create another"
|
22
|
+
And I press "Create Post"
|
23
|
+
Then I should see "Post was successfully created."
|
24
|
+
And I should see "New Post"
|
25
|
+
And the "Create another" checkbox should be checked
|
26
|
+
When I fill in "Title" with "Another Hello World"
|
27
|
+
And I fill in "Body" with "This is the another body"
|
28
|
+
And I uncheck "Create another"
|
29
|
+
And I press "Create Post"
|
30
|
+
Then I should see "Post was successfully created."
|
31
|
+
And I should see the attribute "Title" with "Another Hello World"
|
32
|
+
And I should see the attribute "Body" with "This is the another body"
|
33
|
+
|
34
|
+
Scenario: Application config of false and a resource config of true
|
35
|
+
Given a configuration of:
|
36
|
+
"""
|
37
|
+
ActiveAdmin.application.create_another = false
|
38
|
+
ActiveAdmin.register Post do
|
39
|
+
config.create_another = true
|
40
|
+
end
|
41
|
+
"""
|
42
|
+
When I am on the new post page
|
43
|
+
Then I should see the element ".create_another"
|
44
|
+
Then the "Create another Post" checkbox should not be checked
|
45
|
+
|
46
|
+
Scenario: Application config of true and a resource config of false
|
47
|
+
Given a configuration of:
|
48
|
+
"""
|
49
|
+
ActiveAdmin.application.create_another = true
|
50
|
+
ActiveAdmin.register Post do
|
51
|
+
config.create_another = false
|
52
|
+
end
|
53
|
+
"""
|
54
|
+
When I am on the new post page
|
55
|
+
Then I should not see the element ".create_another"
|
@@ -12,10 +12,8 @@ Feature: Development Reloading
|
|
12
12
|
When "app/admin/posts.rb" contains:
|
13
13
|
"""
|
14
14
|
ActiveAdmin.register Post do
|
15
|
-
|
16
|
-
|
17
|
-
:body, :position, :published_date, :starred
|
18
|
-
end
|
15
|
+
permit_params :custom_category_id, :author_id, :title,
|
16
|
+
:body, :position, :published_date, :starred
|
19
17
|
end
|
20
18
|
"""
|
21
19
|
When I am logged in with capybara
|
data/features/edit_page.feature
CHANGED
@@ -10,10 +10,8 @@ Feature: Edit Page
|
|
10
10
|
Given a configuration of:
|
11
11
|
"""
|
12
12
|
ActiveAdmin.register Post do
|
13
|
-
|
14
|
-
|
15
|
-
:body, :position, :published_date, :starred
|
16
|
-
end
|
13
|
+
permit_params :custom_category_id, :author_id, :title,
|
14
|
+
:body, :position, :published_date, :starred
|
17
15
|
end
|
18
16
|
"""
|
19
17
|
When I am on the index page for posts
|
@@ -25,6 +23,7 @@ Feature: Edit Page
|
|
25
23
|
And the "Category" field should contain ""
|
26
24
|
And the "Author" field should contain the option "John Doe"
|
27
25
|
When I fill in "Title" with "Hello World from update"
|
26
|
+
And I should not see the element "Create another"
|
28
27
|
When I press "Update Post"
|
29
28
|
Then I should see "Post was successfully updated."
|
30
29
|
And I should see the attribute "Title" with "Hello World from update"
|
@@ -34,7 +33,7 @@ Feature: Edit Page
|
|
34
33
|
Given a configuration of:
|
35
34
|
"""
|
36
35
|
ActiveAdmin.register Post do
|
37
|
-
permit_params :category, :author, :title, :body, :published_date, :starred
|
36
|
+
permit_params :category, :author, :title, :body, :published_date, :starred
|
38
37
|
|
39
38
|
form do |f|
|
40
39
|
f.inputs "Your Post" do
|
@@ -63,7 +62,7 @@ Feature: Edit Page
|
|
63
62
|
Given a configuration of:
|
64
63
|
"""
|
65
64
|
ActiveAdmin.register Post do
|
66
|
-
permit_params :category, :author, :title, :body, :published_date, :starred
|
65
|
+
permit_params :category, :author, :title, :body, :published_date, :starred
|
67
66
|
|
68
67
|
form html: {} do |f|
|
69
68
|
f.inputs "Your Post" do
|
@@ -102,7 +101,7 @@ Feature: Edit Page
|
|
102
101
|
Given a configuration of:
|
103
102
|
"""
|
104
103
|
ActiveAdmin.register Post do
|
105
|
-
permit_params :category, :author, :title, :body, :published_date, :starred
|
104
|
+
permit_params :category, :author, :title, :body, :published_date, :starred
|
106
105
|
|
107
106
|
form partial: "form"
|
108
107
|
end
|
data/features/favicon.feature
CHANGED
@@ -12,9 +12,9 @@ Feature: Favicon
|
|
12
12
|
Scenario: Logged out views show Favicon
|
13
13
|
Given I am logged out
|
14
14
|
When I am on the login page
|
15
|
-
Then I should see the favicon "
|
15
|
+
Then I should see the favicon "favicon"
|
16
16
|
|
17
17
|
Scenario: Logged in views show Favicon
|
18
18
|
Given I am logged in
|
19
19
|
When I am on the dashboard
|
20
|
-
Then I should see the favicon "
|
20
|
+
Then I should see the favicon "favicon"
|
data/features/i18n.feature
CHANGED
@@ -38,6 +38,24 @@ Feature: Index Filtering
|
|
38
38
|
And I should not see pagination
|
39
39
|
And I should see "No Posts found"
|
40
40
|
|
41
|
+
Scenario: Filtering posts with pagination
|
42
|
+
Given 7 posts with the title "Hello World 3" exist
|
43
|
+
And 1 post with the title "Hello World 4" exist
|
44
|
+
And an index configuration of:
|
45
|
+
"""
|
46
|
+
ActiveAdmin.register Post do
|
47
|
+
config.per_page = 2
|
48
|
+
end
|
49
|
+
"""
|
50
|
+
When I fill in "Title" with "Hello World 3"
|
51
|
+
And I press "Filter"
|
52
|
+
|
53
|
+
Then I follow "2"
|
54
|
+
Then I should see "Displaying Posts 3 - 4 of 7 in total"
|
55
|
+
|
56
|
+
Then I follow "3"
|
57
|
+
Then I should see "Displaying Posts 5 - 6 of 7 in total"
|
58
|
+
|
41
59
|
Scenario: Filtering posts while not on the first page
|
42
60
|
Given 9 posts exist
|
43
61
|
And an index configuration of:
|
@@ -12,8 +12,8 @@ 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 date | Position | Starred | Created at | Updated at |
|
16
|
-
| \d+ | Hello World | |
|
15
|
+
| Id | Title | Body | Published date | Position | Starred | Foo |Created at | Updated at |
|
16
|
+
| \d+ | Hello World | | | | | |(.*) | (.*) |
|
17
17
|
|
18
18
|
Scenario: Default with alias
|
19
19
|
Given a configuration of:
|
@@ -24,7 +24,7 @@ Feature: Format as CSV
|
|
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 date | Position | Starred | Created at | Updated at |
|
27
|
+
| Id | Title | Body | Published date | Position | Starred | Foo | Created at | Updated at |
|
28
28
|
|
29
29
|
Scenario: With CSV format customization
|
30
30
|
Given a configuration of:
|
@@ -51,6 +51,15 @@ Feature: Index Formats
|
|
51
51
|
And I should not see a link to download "XML"
|
52
52
|
And I should not see a link to download "JSON"
|
53
53
|
|
54
|
+
When I go to the csv index page for posts
|
55
|
+
Then access denied
|
56
|
+
|
57
|
+
When I go to the xml index page for posts
|
58
|
+
Then access denied
|
59
|
+
|
60
|
+
When I go to the json index page for posts
|
61
|
+
Then access denied
|
62
|
+
|
54
63
|
Scenario: View index with download_links block which returns [:csv]
|
55
64
|
Given an index configuration of:
|
56
65
|
"""
|
@@ -64,3 +73,16 @@ Feature: Index Formats
|
|
64
73
|
And I should not see a link to download "XML"
|
65
74
|
And I should not see a link to download "JSON"
|
66
75
|
And I should not see a link to download "PDF"
|
76
|
+
|
77
|
+
Scenario: View index with restricted formats
|
78
|
+
Given an index configuration of:
|
79
|
+
"""
|
80
|
+
ActiveAdmin.register Post do
|
81
|
+
index download_links: -> { [:json] }
|
82
|
+
end
|
83
|
+
"""
|
84
|
+
When I go to the csv index page for posts
|
85
|
+
Then access denied
|
86
|
+
|
87
|
+
When I go to the xml index page for posts
|
88
|
+
Then access denied
|
@@ -250,14 +250,14 @@ Feature: Index as Table
|
|
250
250
|
"""
|
251
251
|
When I am on the index page for posts
|
252
252
|
Then I should see the "index_table_posts" table:
|
253
|
-
| [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
|
254
|
-
| [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
|
255
|
-
| [ ] | 1 | Hello World | From the body | | | No | /.*/ | /.*/ | ViewEditDelete |
|
253
|
+
| [ ] | Id | Title | Body | Published Date | Author | Position | Category | Starred | Foo | Created At | Updated At | |
|
254
|
+
| [ ] | 2 | Bye bye world | Move your... | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
|
255
|
+
| [ ] | 1 | Hello World | From the body | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
|
256
256
|
When I follow "Id"
|
257
257
|
Then I should see the "index_table_posts" table:
|
258
|
-
| [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
|
259
|
-
| [ ] | 1 | Hello World | From the body | | | No | /.*/ | /.*/ | ViewEditDelete |
|
260
|
-
| [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
|
258
|
+
| [ ] | Id | Title | Body | Published Date | Author | Position | Category | Starred | Foo | Created At | Updated At | |
|
259
|
+
| [ ] | 1 | Hello World | From the body | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
|
260
|
+
| [ ] | 2 | Bye bye world | Move your... | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
|
261
261
|
|
262
262
|
Scenario: Sorting by a virtual column
|
263
263
|
Given a post with the title "Hello World" exists
|
@@ -34,8 +34,7 @@ Feature: Index - Page Title
|
|
34
34
|
"""
|
35
35
|
ActiveAdmin.register Post do
|
36
36
|
controller do
|
37
|
-
|
38
|
-
send(callback) { @page_title = "List of #{resource_class.model_name.plural}" }
|
37
|
+
before_action { @page_title = "List of #{resource_class.model_name.plural}" }
|
39
38
|
end
|
40
39
|
end
|
41
40
|
"""
|
data/features/menu.feature
CHANGED
@@ -43,11 +43,30 @@ Feature: Menu
|
|
43
43
|
"""
|
44
44
|
ActiveAdmin.register User
|
45
45
|
ActiveAdmin.register Post do
|
46
|
-
menu parent: '
|
46
|
+
menu parent: 'Users'
|
47
47
|
end
|
48
48
|
"""
|
49
49
|
When I am on the dashboard
|
50
50
|
Then I should see a menu item for "Users"
|
51
|
+
And I should not see a menu item for "Posts"
|
51
52
|
When I follow "Users"
|
52
53
|
Then the "Users" tab should be selected
|
53
54
|
And I should see a nested menu item for "Posts"
|
55
|
+
|
56
|
+
Scenario: Adding a resources as a sub menu items
|
57
|
+
Given a configuration of:
|
58
|
+
"""
|
59
|
+
ActiveAdmin.register Category do
|
60
|
+
menu parent: 'Anything'
|
61
|
+
end
|
62
|
+
ActiveAdmin.register Post do
|
63
|
+
menu parent: 'Anything'
|
64
|
+
end
|
65
|
+
"""
|
66
|
+
When I am on the dashboard
|
67
|
+
Then I should see a menu item for "Anything"
|
68
|
+
And I should not see a menu item for "Categories"
|
69
|
+
And I should not see a menu item for "Posts"
|
70
|
+
And I should see a nested menu item for "Categories"
|
71
|
+
And I should see a nested menu item for "Posts"
|
72
|
+
|
data/features/new_page.feature
CHANGED
@@ -9,10 +9,8 @@ Feature: New Page
|
|
9
9
|
Given a configuration of:
|
10
10
|
"""
|
11
11
|
ActiveAdmin.register Post do
|
12
|
-
|
13
|
-
|
14
|
-
:body, :position, :published_date, :starred
|
15
|
-
end
|
12
|
+
permit_params :custom_category_id, :author_id, :title,
|
13
|
+
:body, :position, :published_date, :starred
|
16
14
|
end
|
17
15
|
"""
|
18
16
|
When I am on the index page for posts
|
@@ -27,14 +25,14 @@ Feature: New Page
|
|
27
25
|
Then I should see "Post was successfully created."
|
28
26
|
And I should see the attribute "Title" with "Hello World"
|
29
27
|
And I should see the attribute "Body" with "This is the body"
|
30
|
-
|
28
|
+
And I should see the attribute "Category" with "Music"
|
31
29
|
And I should see the attribute "Author" with "John Doe"
|
32
30
|
|
33
31
|
Scenario: Generating a custom form
|
34
32
|
Given a configuration of:
|
35
33
|
"""
|
36
34
|
ActiveAdmin.register Post do
|
37
|
-
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
|
35
|
+
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
|
38
36
|
|
39
37
|
form do |f|
|
40
38
|
f.inputs "Your Post" do
|
@@ -70,7 +68,7 @@ Feature: New Page
|
|
70
68
|
Given a configuration of:
|
71
69
|
"""
|
72
70
|
ActiveAdmin.register Post do
|
73
|
-
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
|
71
|
+
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
|
74
72
|
|
75
73
|
form partial: "form"
|
76
74
|
end
|
@@ -87,7 +85,7 @@ Feature: New Page
|
|
87
85
|
Given a configuration of:
|
88
86
|
"""
|
89
87
|
ActiveAdmin.register Post do
|
90
|
-
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
|
88
|
+
permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
|
91
89
|
|
92
90
|
form do |f|
|
93
91
|
f.inputs "Your Post" do
|
@@ -12,8 +12,8 @@ Feature: Registering Assets
|
|
12
12
|
|
13
13
|
Scenario: Viewing default asset files
|
14
14
|
When I am on the index page for posts
|
15
|
-
Then I should see the css file "active_admin
|
16
|
-
Then I should see the js file "active_admin
|
15
|
+
Then I should see the css file "active_admin"
|
16
|
+
Then I should see the js file "active_admin"
|
17
17
|
|
18
18
|
Scenario: Registering a CSS file
|
19
19
|
Given a configuration of:
|
@@ -22,7 +22,7 @@ Feature: Registering Assets
|
|
22
22
|
ActiveAdmin.register Post
|
23
23
|
"""
|
24
24
|
When I am on the index page for posts
|
25
|
-
Then I should see the css file "some-random-css
|
25
|
+
Then I should see the css file "some-random-css" of media "print"
|
26
26
|
|
27
27
|
Scenario: Registering a JS file
|
28
28
|
Given a configuration of:
|
@@ -31,4 +31,4 @@ Feature: Registering Assets
|
|
31
31
|
ActiveAdmin.register Post
|
32
32
|
"""
|
33
33
|
When I am on the index page for posts
|
34
|
-
Then I should see the js file "some-random-js
|
34
|
+
Then I should see the js file "some-random-js"
|
@@ -217,3 +217,21 @@ Feature: Registering Pages
|
|
217
217
|
Then I should see the content "Status page for Post 1"
|
218
218
|
And I should see a link to "Post 1" in the breadcrumb
|
219
219
|
|
220
|
+
Scenario: Rendering sortable table_for within page
|
221
|
+
Given a configuration of:
|
222
|
+
"""
|
223
|
+
ActiveAdmin.register Post
|
224
|
+
ActiveAdmin.register_page "Last Posts" do
|
225
|
+
content do
|
226
|
+
table_for Post.last(2), sortable: true, class: "index_table" do
|
227
|
+
column :id
|
228
|
+
column :title
|
229
|
+
column :author
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
"""
|
234
|
+
And a post with the title "Hello World" written by "Jane Doe" exists
|
235
|
+
When I go to the last posts page
|
236
|
+
Then I should see the page title "Last Posts"
|
237
|
+
And I should see 1 post in the table
|
@@ -9,10 +9,8 @@ Feature: Renamed Resource
|
|
9
9
|
Given a configuration of:
|
10
10
|
"""
|
11
11
|
ActiveAdmin.register Blog::Post, as: 'Post' do
|
12
|
-
|
13
|
-
|
14
|
-
:body, :position, :published_date, :starred
|
15
|
-
end
|
12
|
+
permit_params :custom_category_id, :author_id, :title,
|
13
|
+
:body, :position, :published_date, :starred
|
16
14
|
end
|
17
15
|
"""
|
18
16
|
When I am on the index page for posts
|
@@ -51,8 +51,7 @@ Feature: Show - Page Title
|
|
51
51
|
"""
|
52
52
|
ActiveAdmin.register Post do
|
53
53
|
controller do
|
54
|
-
|
55
|
-
send(callback) { @page_title = "List of #{resource_class.model_name.plural}" }
|
54
|
+
before_action { @page_title = "List of #{resource_class.model_name.plural}" }
|
56
55
|
end
|
57
56
|
end
|
58
57
|
"""
|