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
@@ -15,7 +15,7 @@ Feature: Index Formats
|
|
15
15
|
Given an index configuration of:
|
16
16
|
"""
|
17
17
|
ActiveAdmin.register Post do
|
18
|
-
index :
|
18
|
+
index download_links: false
|
19
19
|
end
|
20
20
|
"""
|
21
21
|
And 1 post exists
|
@@ -28,7 +28,7 @@ Feature: Index Formats
|
|
28
28
|
Given an index configuration of:
|
29
29
|
"""
|
30
30
|
ActiveAdmin.register Post do
|
31
|
-
index :
|
31
|
+
index download_links: [:pdf]
|
32
32
|
end
|
33
33
|
"""
|
34
34
|
And 1 post exists
|
@@ -42,7 +42,7 @@ Feature: Index Formats
|
|
42
42
|
Given an index configuration of:
|
43
43
|
"""
|
44
44
|
ActiveAdmin.register Post do
|
45
|
-
index :
|
45
|
+
index download_links: proc { false }
|
46
46
|
end
|
47
47
|
"""
|
48
48
|
And 1 post exists
|
@@ -55,7 +55,7 @@ Feature: Index Formats
|
|
55
55
|
Given an index configuration of:
|
56
56
|
"""
|
57
57
|
ActiveAdmin.register Post do
|
58
|
-
index :
|
58
|
+
index download_links: -> { [:csv] }
|
59
59
|
end
|
60
60
|
"""
|
61
61
|
And 1 post exists
|
@@ -7,7 +7,7 @@ Feature: Index as Blog
|
|
7
7
|
And an index configuration of:
|
8
8
|
"""
|
9
9
|
ActiveAdmin.register Post do
|
10
|
-
index :
|
10
|
+
index as: :blog
|
11
11
|
end
|
12
12
|
"""
|
13
13
|
And I am logged in
|
@@ -20,7 +20,7 @@ Feature: Index as Blog
|
|
20
20
|
And an index configuration of:
|
21
21
|
"""
|
22
22
|
ActiveAdmin.register Post do
|
23
|
-
index :
|
23
|
+
index as: :blog do
|
24
24
|
title :title
|
25
25
|
body :body
|
26
26
|
end
|
@@ -35,7 +35,7 @@ Feature: Index as Blog
|
|
35
35
|
And an index configuration of:
|
36
36
|
"""
|
37
37
|
ActiveAdmin.register Post do
|
38
|
-
index :
|
38
|
+
index as: :blog do
|
39
39
|
title do |post|
|
40
40
|
post.title + " From Block"
|
41
41
|
end
|
@@ -54,12 +54,12 @@ Feature: Index as Blog
|
|
54
54
|
And an index configuration of:
|
55
55
|
"""
|
56
56
|
ActiveAdmin.register Post do
|
57
|
-
index :
|
57
|
+
index as: :blog do
|
58
58
|
title do |post|
|
59
|
-
span(:
|
59
|
+
span(class: :title_span) { post.title + " From Block " }
|
60
60
|
end
|
61
61
|
body do |post|
|
62
|
-
span(:
|
62
|
+
span(class: :body_span) { post.body + " From Block" }
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -7,7 +7,7 @@ Feature: Index as Grid
|
|
7
7
|
And an index configuration of:
|
8
8
|
"""
|
9
9
|
ActiveAdmin.register Post do
|
10
|
-
index :
|
10
|
+
index as: :grid do |post|
|
11
11
|
h2 auto_link(post)
|
12
12
|
end
|
13
13
|
end
|
@@ -21,7 +21,7 @@ Feature: Index as Grid
|
|
21
21
|
And an index configuration of:
|
22
22
|
"""
|
23
23
|
ActiveAdmin.register Post do
|
24
|
-
index :
|
24
|
+
index as: :grid, columns: 1 do |post|
|
25
25
|
h2 auto_link(post)
|
26
26
|
end
|
27
27
|
end
|
@@ -35,7 +35,7 @@ Feature: Index as Grid
|
|
35
35
|
And an index configuration of:
|
36
36
|
"""
|
37
37
|
ActiveAdmin.register Post do
|
38
|
-
index :
|
38
|
+
index as: :grid, columns: 2 do |post|
|
39
39
|
h2 auto_link(post)
|
40
40
|
end
|
41
41
|
end
|
@@ -116,7 +116,7 @@ Feature: Index as Table
|
|
116
116
|
index do
|
117
117
|
column :category
|
118
118
|
actions do |resource|
|
119
|
-
link_to 'Custom Action', edit_admin_post_path(resource), :
|
119
|
+
link_to 'Custom Action', edit_admin_post_path(resource), class: 'member_link'
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
@@ -135,8 +135,8 @@ Feature: Index as Table
|
|
135
135
|
|
136
136
|
index do
|
137
137
|
column :category
|
138
|
-
actions :
|
139
|
-
link_to 'Custom Action', edit_admin_post_path(resource), :
|
138
|
+
actions defaults: false do |resource|
|
139
|
+
link_to 'Custom Action', edit_admin_post_path(resource), class: 'member_link'
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
@@ -175,7 +175,7 @@ Feature: Index as Table
|
|
175
175
|
|
176
176
|
index do
|
177
177
|
column :category
|
178
|
-
actions :
|
178
|
+
actions defaults: false, dropdown: true do |resource|
|
179
179
|
item 'Custom Action', edit_admin_post_path(resource)
|
180
180
|
end
|
181
181
|
end
|
@@ -218,13 +218,13 @@ Feature: Index as Table
|
|
218
218
|
ActiveAdmin.register Post do
|
219
219
|
index do
|
220
220
|
column :author_id do end
|
221
|
-
column '
|
221
|
+
column 'published_date' do end
|
222
222
|
column :category do end
|
223
223
|
end
|
224
224
|
end
|
225
225
|
"""
|
226
226
|
Then I should see a sortable table header with "Author"
|
227
|
-
Then I should see a sortable table header with "
|
227
|
+
Then I should see a sortable table header with "published_date"
|
228
228
|
Then I should not see a sortable table header with "Category"
|
229
229
|
|
230
230
|
Scenario: Columns with block are not sortable by when sortable option equals to false
|
@@ -234,12 +234,12 @@ Feature: Index as Table
|
|
234
234
|
ActiveAdmin.register Post do
|
235
235
|
index do
|
236
236
|
column :author_id, sortable: false do end
|
237
|
-
column '
|
237
|
+
column 'published_date', sortable: false do end
|
238
238
|
end
|
239
239
|
end
|
240
240
|
"""
|
241
241
|
Then I should not see a sortable table header with "Author"
|
242
|
-
Then I should not see a sortable table header with "
|
242
|
+
Then I should not see a sortable table header with "published_date"
|
243
243
|
|
244
244
|
Scenario: Sorting
|
245
245
|
Given a post with the title "Hello World" and body "From the body" exists
|
@@ -250,12 +250,12 @@ 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
|
253
|
+
| [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
|
254
254
|
| [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
|
255
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
|
258
|
+
| [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
|
259
259
|
| [ ] | 1 | Hello World | From the body | | | No | /.*/ | /.*/ | ViewEditDelete |
|
260
260
|
| [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
|
261
261
|
|
@@ -274,7 +274,7 @@ Feature: Index as Table
|
|
274
274
|
index do
|
275
275
|
column :id
|
276
276
|
column :title
|
277
|
-
column("Title Length", :
|
277
|
+
column("Title Length", sortable: :title_length) { |post| post.title_length }
|
278
278
|
end
|
279
279
|
end
|
280
280
|
"""
|
@@ -9,7 +9,7 @@ Feature: Index Blank Slate
|
|
9
9
|
batch_action :favourite do
|
10
10
|
# nothing
|
11
11
|
end
|
12
|
-
scope :all, :
|
12
|
+
scope :all, default: true
|
13
13
|
end
|
14
14
|
"""
|
15
15
|
Then I should not see a sortable table header
|
@@ -33,7 +33,7 @@ Feature: Index Blank Slate
|
|
33
33
|
Given an index configuration of:
|
34
34
|
"""
|
35
35
|
ActiveAdmin.register Post do
|
36
|
-
index :
|
36
|
+
index as: :grid do |post|
|
37
37
|
h2 auto_link(post)
|
38
38
|
end
|
39
39
|
end
|
@@ -44,7 +44,7 @@ Feature: Index Blank Slate
|
|
44
44
|
Given an index configuration of:
|
45
45
|
"""
|
46
46
|
ActiveAdmin.register Post do
|
47
|
-
index :
|
47
|
+
index as: :block do |post|
|
48
48
|
span(link_to(post.title, admin_post_path(post)))
|
49
49
|
end
|
50
50
|
end
|
@@ -55,7 +55,7 @@ Feature: Index Blank Slate
|
|
55
55
|
Given an index configuration of:
|
56
56
|
"""
|
57
57
|
ActiveAdmin.register Post do
|
58
|
-
index :
|
58
|
+
index as: :blog
|
59
59
|
end
|
60
60
|
"""
|
61
61
|
And I should see "There are no Posts yet. Create one"
|
@@ -4,7 +4,7 @@ Feature: Index Parameters
|
|
4
4
|
Given an index configuration of:
|
5
5
|
"""
|
6
6
|
ActiveAdmin.register Post do
|
7
|
-
index :
|
7
|
+
index as: :table, download_links: false
|
8
8
|
end
|
9
9
|
"""
|
10
10
|
Given 31 posts exist
|
@@ -19,7 +19,7 @@ Feature: Index Parameters
|
|
19
19
|
Given an index configuration of:
|
20
20
|
"""
|
21
21
|
ActiveAdmin.register Post do
|
22
|
-
index :
|
22
|
+
index as: :table
|
23
23
|
end
|
24
24
|
"""
|
25
25
|
Given 1 posts exist
|
@@ -35,15 +35,15 @@ Feature: Index Parameters
|
|
35
35
|
Given a configuration of:
|
36
36
|
"""
|
37
37
|
ActiveAdmin.application.namespace(:superadmin).download_links = false
|
38
|
-
ActiveAdmin.register AdminUser, :
|
38
|
+
ActiveAdmin.register AdminUser, namespace: :superadmin
|
39
39
|
"""
|
40
40
|
Given an index configuration of:
|
41
41
|
"""
|
42
42
|
ActiveAdmin.register Post do
|
43
|
-
index :
|
43
|
+
index as: :table
|
44
44
|
end
|
45
|
-
ActiveAdmin.register Post, :
|
46
|
-
index :
|
45
|
+
ActiveAdmin.register Post, namespace: :superadmin do
|
46
|
+
index as: :table
|
47
47
|
end
|
48
48
|
"""
|
49
49
|
Given 1 posts exist
|
@@ -58,15 +58,15 @@ Feature: Index Parameters
|
|
58
58
|
Given a configuration of:
|
59
59
|
"""
|
60
60
|
ActiveAdmin.application.namespace(:superadmin).download_links = false
|
61
|
-
ActiveAdmin.register AdminUser, :
|
61
|
+
ActiveAdmin.register AdminUser, namespace: :superadmin
|
62
62
|
"""
|
63
63
|
Given an index configuration of:
|
64
64
|
"""
|
65
65
|
ActiveAdmin.register Post do
|
66
|
-
index :
|
66
|
+
index as: :table
|
67
67
|
end
|
68
|
-
ActiveAdmin.register Post, :
|
69
|
-
index :
|
68
|
+
ActiveAdmin.register Post, namespace: :superadmin do
|
69
|
+
index as: :table, download_links: true
|
70
70
|
end
|
71
71
|
"""
|
72
72
|
Given 1 posts exist
|
@@ -17,7 +17,7 @@ Feature: Index Scope To
|
|
17
17
|
# Set up some scopes
|
18
18
|
scope :all, default: true
|
19
19
|
scope :published do |posts|
|
20
|
-
posts.where "
|
20
|
+
posts.where "published_date IS NOT NULL"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
"""
|
@@ -35,7 +35,7 @@ Feature: Index Scope To
|
|
35
35
|
Given an index configuration of:
|
36
36
|
"""
|
37
37
|
ActiveAdmin.register Post do
|
38
|
-
scope_to :
|
38
|
+
scope_to if: proc{ false } do
|
39
39
|
User.find_by_first_name_and_last_name("John", "Doe")
|
40
40
|
end
|
41
41
|
end
|
@@ -47,7 +47,7 @@ Feature: Index Scope To
|
|
47
47
|
Given an index configuration of:
|
48
48
|
"""
|
49
49
|
ActiveAdmin.register Post do
|
50
|
-
scope_to :
|
50
|
+
scope_to unless: proc{ true } do
|
51
51
|
User.find_by_first_name_and_last_name("John", "Doe")
|
52
52
|
end
|
53
53
|
end
|
@@ -14,12 +14,31 @@ Feature: Index Scoping
|
|
14
14
|
And I should see the scope "All" with the count 3
|
15
15
|
And I should see 3 posts in the table
|
16
16
|
|
17
|
+
Scenario: Viewing resources with one scope with dynamic name
|
18
|
+
Given 3 posts exist
|
19
|
+
And an index configuration of:
|
20
|
+
"""
|
21
|
+
ActiveAdmin.register Post do
|
22
|
+
scope -> { scope_title }, :all
|
23
|
+
|
24
|
+
controller do
|
25
|
+
def scope_title
|
26
|
+
'Neat scope'
|
27
|
+
end
|
28
|
+
|
29
|
+
helper_method :scope_title
|
30
|
+
end
|
31
|
+
end
|
32
|
+
"""
|
33
|
+
Then I should see the scope with label "Neat scope"
|
34
|
+
And I should see 3 posts in the table
|
35
|
+
|
17
36
|
Scenario: Viewing resources with one scope as the default
|
18
37
|
Given 3 posts exist
|
19
38
|
And an index configuration of:
|
20
39
|
"""
|
21
40
|
ActiveAdmin.register Post do
|
22
|
-
scope :all, :
|
41
|
+
scope :all, default: true
|
23
42
|
end
|
24
43
|
"""
|
25
44
|
Then I should see the scope "All" selected
|
@@ -31,7 +50,7 @@ Feature: Index Scoping
|
|
31
50
|
And an index configuration of:
|
32
51
|
"""
|
33
52
|
ActiveAdmin.register Post do
|
34
|
-
scope :all, :
|
53
|
+
scope :all, default: proc{ false }
|
35
54
|
end
|
36
55
|
"""
|
37
56
|
Then I should see the scope "All" not selected
|
@@ -43,7 +62,7 @@ Feature: Index Scoping
|
|
43
62
|
And an index configuration of:
|
44
63
|
"""
|
45
64
|
ActiveAdmin.register Post do
|
46
|
-
scope :all, :
|
65
|
+
scope :all, default: true
|
47
66
|
filter :title
|
48
67
|
end
|
49
68
|
"""
|
@@ -56,8 +75,8 @@ Feature: Index Scoping
|
|
56
75
|
And an index configuration of:
|
57
76
|
"""
|
58
77
|
ActiveAdmin.register Post do
|
59
|
-
scope :all, :
|
60
|
-
index :
|
78
|
+
scope :all, default: true
|
79
|
+
index as: :table, scope_count: false
|
61
80
|
end
|
62
81
|
"""
|
63
82
|
Then I should see the scope "All" selected
|
@@ -70,7 +89,7 @@ Feature: Index Scoping
|
|
70
89
|
And an index configuration of:
|
71
90
|
"""
|
72
91
|
ActiveAdmin.register Post do
|
73
|
-
scope :all, :
|
92
|
+
scope :all, default: true, show_count: false
|
74
93
|
end
|
75
94
|
"""
|
76
95
|
Then I should see the scope "All" selected
|
@@ -83,9 +102,9 @@ Feature: Index Scoping
|
|
83
102
|
And an index configuration of:
|
84
103
|
"""
|
85
104
|
ActiveAdmin.register Post do
|
86
|
-
scope :all, :
|
105
|
+
scope :all, default: true
|
87
106
|
scope :published do |posts|
|
88
|
-
posts.where("
|
107
|
+
posts.where("published_date IS NOT NULL")
|
89
108
|
end
|
90
109
|
end
|
91
110
|
"""
|
@@ -106,9 +125,9 @@ Feature: Index Scoping
|
|
106
125
|
And an index configuration of:
|
107
126
|
"""
|
108
127
|
ActiveAdmin.register Post do
|
109
|
-
scope :all, :
|
128
|
+
scope :all, default: true
|
110
129
|
scope :published do |posts|
|
111
|
-
posts.where("
|
130
|
+
posts.where("published_date IS NOT NULL")
|
112
131
|
end
|
113
132
|
end
|
114
133
|
"""
|
@@ -135,14 +154,14 @@ Feature: Index Scoping
|
|
135
154
|
And an index configuration of:
|
136
155
|
"""
|
137
156
|
ActiveAdmin.register Post do
|
138
|
-
scope :all, :
|
139
|
-
scope "Shown", :
|
157
|
+
scope :all, if: proc { false }
|
158
|
+
scope "Shown", if: proc { true } do |posts|
|
140
159
|
posts
|
141
160
|
end
|
142
|
-
scope "Default", :
|
161
|
+
scope "Default", default: true do |posts|
|
143
162
|
posts
|
144
163
|
end
|
145
|
-
scope 'Today', :
|
164
|
+
scope 'Today', if: proc { false } do |posts|
|
146
165
|
posts.where(["created_at > ? AND created_at < ?", ::Time.zone.now.beginning_of_day, ::Time.zone.now.end_of_day])
|
147
166
|
end
|
148
167
|
end
|
@@ -158,7 +177,7 @@ Feature: Index Scoping
|
|
158
177
|
And an index configuration of:
|
159
178
|
"""
|
160
179
|
ActiveAdmin.register Post do
|
161
|
-
scope 'Today', :
|
180
|
+
scope 'Today', default: true do |posts|
|
162
181
|
posts.where(["created_at > ? AND created_at < ?", ::Time.zone.now.beginning_of_day, ::Time.zone.now.end_of_day])
|
163
182
|
end
|
164
183
|
scope 'Tomorrow' do |posts|
|
@@ -186,7 +205,7 @@ Feature: Index Scoping
|
|
186
205
|
"""
|
187
206
|
ActiveAdmin.register Post do
|
188
207
|
scope_to :current_user
|
189
|
-
scope :all, :
|
208
|
+
scope :all, default: true
|
190
209
|
|
191
210
|
filter :title
|
192
211
|
|
@@ -213,9 +232,9 @@ Feature: Index Scoping
|
|
213
232
|
And an index configuration of:
|
214
233
|
"""
|
215
234
|
ActiveAdmin.register Post do
|
216
|
-
scope :all, :
|
235
|
+
scope :all, default: true
|
217
236
|
scope :published do |posts|
|
218
|
-
posts.where("
|
237
|
+
posts.where("published_date IS NOT NULL")
|
219
238
|
end
|
220
239
|
|
221
240
|
index do
|