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
@@ -7,7 +7,7 @@ module ActiveAdmin
|
|
7
7
|
#
|
8
8
|
# dropdown_menu "Administration" do
|
9
9
|
# item "Edit Details", edit_details_path
|
10
|
-
# item "Edit My Account",
|
10
|
+
# item "Edit My Account", edit_my_account_path
|
11
11
|
# end
|
12
12
|
#
|
13
13
|
# This will create a button with the label "Administration" and
|
@@ -58,7 +58,7 @@ module ActiveAdmin
|
|
58
58
|
|
59
59
|
menu_list = nil
|
60
60
|
|
61
|
-
div :
|
61
|
+
div class: 'dropdown_menu_list_wrapper' do
|
62
62
|
menu_list = ul(options)
|
63
63
|
end
|
64
64
|
|
@@ -36,7 +36,10 @@ module ActiveAdmin
|
|
36
36
|
# @param [Class] index_class The class on which to build the link and html classes
|
37
37
|
def build_index_list(index_class)
|
38
38
|
li class: classes_for_index(index_class) do
|
39
|
-
|
39
|
+
params = request.query_parameters.except :page, :commit, :format
|
40
|
+
url_with_params = url_for(params.merge(as: index_class.index_name.to_sym))
|
41
|
+
|
42
|
+
a href: url_with_params, class: "table_tools_button" do
|
40
43
|
name = index_class.index_name
|
41
44
|
I18n.t("active_admin.index_list.#{name}", default: name.to_s.titleize)
|
42
45
|
end
|
@@ -31,7 +31,7 @@ module ActiveAdmin
|
|
31
31
|
|
32
32
|
def build_scope(scope, options)
|
33
33
|
li class: classes_for_scope(scope) do
|
34
|
-
scope_name = I18n.t "active_admin.scopes.#{scope.id}", default: scope
|
34
|
+
scope_name = I18n.t "active_admin.scopes.#{scope.id}", default: name_for_scope(scope)
|
35
35
|
params = request.query_parameters.except :page, :scope, :commit, :format
|
36
36
|
|
37
37
|
a href: url_for(scope: scope.id, params: params), class: 'table_tools_button' do
|
@@ -61,6 +61,13 @@ module ActiveAdmin
|
|
61
61
|
def get_scope_count(scope)
|
62
62
|
collection_size(scope_chain(scope, collection_before_scope))
|
63
63
|
end
|
64
|
+
|
65
|
+
def name_for_scope(scope)
|
66
|
+
case scope.name
|
67
|
+
when Proc then self.instance_exec(&scope.name).to_s
|
68
|
+
else scope.name.to_s
|
69
|
+
end
|
70
|
+
end
|
64
71
|
end
|
65
72
|
end
|
66
73
|
end
|
@@ -41,11 +41,11 @@ module ActiveAdmin
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def title_text
|
44
|
-
helpers.render_or_call_method_or_proc_on(
|
44
|
+
helpers.render_or_call_method_or_proc_on(helpers, @namespace.site_title)
|
45
45
|
end
|
46
46
|
|
47
47
|
def title_image
|
48
|
-
path = helpers.render_or_call_method_or_proc_on(
|
48
|
+
path = helpers.render_or_call_method_or_proc_on(helpers, @namespace.site_title_image)
|
49
49
|
helpers.image_tag(path, id: "site_title_image", alt: title_text)
|
50
50
|
end
|
51
51
|
|
@@ -85,7 +85,7 @@ module ActiveAdmin
|
|
85
85
|
@tbody = tbody do
|
86
86
|
# Build enough rows for our collection
|
87
87
|
@collection.each do |elem|
|
88
|
-
classes = [cycle('odd', 'even')]
|
88
|
+
classes = [helpers.cycle('odd', 'even')]
|
89
89
|
|
90
90
|
if @row_class
|
91
91
|
classes << @row_class.call(elem)
|
@@ -98,7 +98,7 @@ module ActiveAdmin
|
|
98
98
|
|
99
99
|
def build_table_cell(col, resource)
|
100
100
|
td class: col.html_class do
|
101
|
-
html = format_attribute(resource, col.data)
|
101
|
+
html = helpers.format_attribute(resource, col.data)
|
102
102
|
# Don't add the same Arbre twice, while still allowing format_attribute to call status_tag
|
103
103
|
current_arbre_element << html unless current_arbre_element.children.include? html
|
104
104
|
end
|
@@ -109,7 +109,7 @@ module ActiveAdmin
|
|
109
109
|
# current_sort[1] #=> asc | desc
|
110
110
|
def current_sort
|
111
111
|
@current_sort ||= begin
|
112
|
-
order_clause =
|
112
|
+
order_clause = active_admin_config.order_clause.new(active_admin_config, params[:order])
|
113
113
|
|
114
114
|
if order_clause.valid?
|
115
115
|
[order_clause.field, order_clause.order]
|
@@ -2,15 +2,29 @@ module ActiveAdmin
|
|
2
2
|
module Views
|
3
3
|
class Footer < Component
|
4
4
|
|
5
|
-
def build
|
5
|
+
def build(namespace)
|
6
6
|
super id: "footer"
|
7
|
-
|
7
|
+
@namespace = namespace
|
8
|
+
|
9
|
+
if footer?
|
10
|
+
para footer_text
|
11
|
+
else
|
12
|
+
para powered_by_message
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def footer?
|
17
|
+
@namespace.footer.present?
|
8
18
|
end
|
9
19
|
|
10
20
|
private
|
11
21
|
|
22
|
+
def footer_text
|
23
|
+
helpers.render_or_call_method_or_proc_on(self, @namespace.footer)
|
24
|
+
end
|
25
|
+
|
12
26
|
def powered_by_message
|
13
|
-
|
27
|
+
I18n.t('active_admin.powered_by',
|
14
28
|
active_admin: link_to("Active Admin", "http://www.activeadmin.info"),
|
15
29
|
version: ActiveAdmin::VERSION).html_safe
|
16
30
|
end
|
@@ -348,13 +348,13 @@ module ActiveAdmin
|
|
348
348
|
|
349
349
|
def defaults(resource, options = {})
|
350
350
|
if controller.action_methods.include?('show') && authorized?(ActiveAdmin::Auth::READ, resource)
|
351
|
-
item I18n.t('active_admin.view'), resource_path(resource), class: "view_link #{options[:css_class]}"
|
351
|
+
item I18n.t('active_admin.view'), resource_path(resource), class: "view_link #{options[:css_class]}", title: I18n.t('active_admin.view')
|
352
352
|
end
|
353
353
|
if controller.action_methods.include?('edit') && authorized?(ActiveAdmin::Auth::UPDATE, resource)
|
354
|
-
item I18n.t('active_admin.edit'), edit_resource_path(resource), class: "edit_link #{options[:css_class]}"
|
354
|
+
item I18n.t('active_admin.edit'), edit_resource_path(resource), class: "edit_link #{options[:css_class]}", title: I18n.t('active_admin.edit')
|
355
355
|
end
|
356
356
|
if controller.action_methods.include?('destroy') && authorized?(ActiveAdmin::Auth::DESTROY, resource)
|
357
|
-
item I18n.t('active_admin.delete'), resource_path(resource), class: "delete_link #{options[:css_class]}",
|
357
|
+
item I18n.t('active_admin.delete'), resource_path(resource), class: "delete_link #{options[:css_class]}", title: I18n.t('active_admin.delete'),
|
358
358
|
method: :delete, data: {confirm: I18n.t('active_admin.delete_confirmation')}
|
359
359
|
end
|
360
360
|
end
|
@@ -12,6 +12,8 @@ module ActiveAdmin
|
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
+
delegate :active_admin_config, :controller, :params, to: :helpers
|
16
|
+
|
15
17
|
def add_classes_to_body
|
16
18
|
@body.add_class(params[:action])
|
17
19
|
@body.add_class(params[:controller].tr('/', '_'))
|
@@ -56,7 +58,7 @@ module ActiveAdmin
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def build_unsupported_browser
|
59
|
-
if active_admin_namespace.unsupported_browser_matcher =~ request.user_agent
|
61
|
+
if active_admin_namespace.unsupported_browser_matcher =~ controller.request.user_agent
|
60
62
|
insert_tag view_factory.unsupported_browser
|
61
63
|
end
|
62
64
|
end
|
@@ -138,7 +140,7 @@ module ActiveAdmin
|
|
138
140
|
|
139
141
|
# Renders the content for the footer
|
140
142
|
def build_footer
|
141
|
-
insert_tag view_factory.footer
|
143
|
+
insert_tag view_factory.footer, active_admin_namespace
|
142
144
|
end
|
143
145
|
|
144
146
|
end
|
@@ -6,10 +6,9 @@ module ActiveAdmin
|
|
6
6
|
|
7
7
|
def title
|
8
8
|
if form_presenter[:title]
|
9
|
-
render_or_call_method_or_proc_on(resource, form_presenter[:title])
|
9
|
+
helpers.render_or_call_method_or_proc_on(resource, form_presenter[:title])
|
10
10
|
else
|
11
|
-
assigns[:page_title] ||
|
12
|
-
model: active_admin_config.resource_label)
|
11
|
+
assigns[:page_title] || ActiveAdmin::Localizers.resource(active_admin_config).t("#{normalized_action}_model")
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
@@ -25,7 +25,8 @@ module ActiveAdmin
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def attributes_table(*args, &block)
|
28
|
-
|
28
|
+
table_title = ActiveAdmin::Localizers.resource(active_admin_config).t(:details)
|
29
|
+
panel(table_title) do
|
29
30
|
attributes_table_for resource, *args, &block
|
30
31
|
end
|
31
32
|
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/inline'
|
3
|
+
rescue LoadError => e
|
4
|
+
STDERR.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
|
5
|
+
raise e
|
6
|
+
end
|
7
|
+
|
8
|
+
gemfile(true) do
|
9
|
+
source 'https://rubygems.org'
|
10
|
+
|
11
|
+
gem 'rails', require: false
|
12
|
+
gem 'sqlite3', platform: :mri
|
13
|
+
|
14
|
+
gem 'activerecord-jdbcsqlite3-adapter',
|
15
|
+
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
|
16
|
+
branch: 'rails-5',
|
17
|
+
platform: :jruby
|
18
|
+
|
19
|
+
if ENV['ACTIVE_ADMIN_PATH']
|
20
|
+
gem 'activeadmin', path: ENV['ACTIVE_ADMIN_PATH'], require: false
|
21
|
+
else
|
22
|
+
gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin', require: false
|
23
|
+
end
|
24
|
+
|
25
|
+
gem 'inherited_resources', '~> 1.7', require: false
|
26
|
+
end
|
27
|
+
|
28
|
+
# prepare active_record database
|
29
|
+
require 'active_record'
|
30
|
+
|
31
|
+
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
|
32
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
33
|
+
|
34
|
+
ActiveRecord::Schema.define do
|
35
|
+
create_table :active_admin_comments, force: true do |_t|
|
36
|
+
end
|
37
|
+
|
38
|
+
# Add your schema here
|
39
|
+
create_table :your_models, force: true do |t|
|
40
|
+
t.string :name
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# prepare rails app
|
45
|
+
require 'action_controller/railtie'
|
46
|
+
require 'action_view/railtie'
|
47
|
+
require 'active_admin'
|
48
|
+
|
49
|
+
class ApplicationController < ActionController::Base
|
50
|
+
end
|
51
|
+
|
52
|
+
class TestApp < Rails::Application
|
53
|
+
config.root = File.dirname(__FILE__)
|
54
|
+
config.logger = Logger.new(STDOUT)
|
55
|
+
|
56
|
+
secrets.secret_token = 'secret_token'
|
57
|
+
secrets.secret_key_base = 'secret_key_base'
|
58
|
+
|
59
|
+
config.eager_load = false
|
60
|
+
end
|
61
|
+
|
62
|
+
# create models
|
63
|
+
class YourModel < ActiveRecord::Base
|
64
|
+
end
|
65
|
+
|
66
|
+
# configure active_admin
|
67
|
+
ActiveAdmin.setup do |config|
|
68
|
+
# Authentication disabled by default. Override if necessary
|
69
|
+
config.authentication_method = false
|
70
|
+
config.current_user_method = false
|
71
|
+
end
|
72
|
+
|
73
|
+
# initialize app
|
74
|
+
Rails.application.initialize!
|
75
|
+
|
76
|
+
# register pages and resources
|
77
|
+
ActiveAdmin.register_page 'Dashboard' do
|
78
|
+
menu priority: 1, label: proc { I18n.t('active_admin.dashboard') }
|
79
|
+
|
80
|
+
content do
|
81
|
+
'Test Me'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
ActiveAdmin.register YourModel do
|
86
|
+
end
|
87
|
+
|
88
|
+
# draw active_admin routes
|
89
|
+
Rails.application.routes.draw do
|
90
|
+
ActiveAdmin.routes(self)
|
91
|
+
end
|
92
|
+
|
93
|
+
# prepare tests
|
94
|
+
require 'minitest/autorun'
|
95
|
+
require 'rack/test'
|
96
|
+
|
97
|
+
# Replace this with the code necessary to make your test fail.
|
98
|
+
class BugTest < Minitest::Test
|
99
|
+
include Rack::Test::Methods
|
100
|
+
|
101
|
+
def test_admin_root_success?
|
102
|
+
get '/admin'
|
103
|
+
assert last_response.ok?
|
104
|
+
assert_match 'Test Me', last_response.body # has content
|
105
|
+
assert_match 'Your Models', last_response.body # has 'Your Models' in menu
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_admin_your_models
|
109
|
+
YourModel.create! name: 'John Doe'
|
110
|
+
get '/admin/your_models'
|
111
|
+
assert last_response.ok?
|
112
|
+
assert_match 'John Doe', last_response.body # has created row
|
113
|
+
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def app
|
118
|
+
Rails.application
|
119
|
+
end
|
120
|
+
end
|
@@ -12,8 +12,8 @@ module ActiveAdmin
|
|
12
12
|
|
13
13
|
RESERVED_NAMES = [:active_admin_user]
|
14
14
|
|
15
|
-
class_option :default_user, :
|
16
|
-
:
|
15
|
+
class_option :default_user, type: :boolean, default: true,
|
16
|
+
desc: "Should a default user be created inside the migration?"
|
17
17
|
|
18
18
|
def install_devise
|
19
19
|
begin
|
@@ -24,7 +24,10 @@ module ActiveAdmin
|
|
24
24
|
|
25
25
|
require 'devise'
|
26
26
|
|
27
|
-
|
27
|
+
initializer_file =
|
28
|
+
File.join(destination_root, "config", "initializers", "devise.rb")
|
29
|
+
|
30
|
+
if File.exist?(initializer_file)
|
28
31
|
log :generate, "No need to install devise, already done."
|
29
32
|
else
|
30
33
|
log :generate, "devise:install"
|
@@ -38,7 +38,7 @@ module ActiveAdmin
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def create_migrations
|
41
|
-
migration_template 'migrations/create_active_admin_comments.rb', 'db/migrate/create_active_admin_comments.rb'
|
41
|
+
migration_template 'migrations/create_active_admin_comments.rb.erb', 'db/migrate/create_active_admin_comments.rb'
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -145,7 +145,7 @@ ActiveAdmin.setup do |config|
|
|
145
145
|
# You can add before, after and around filters to all of your
|
146
146
|
# Active Admin resources and pages from here.
|
147
147
|
#
|
148
|
-
# config.
|
148
|
+
# config.before_action :do_something_awesome
|
149
149
|
|
150
150
|
# == Localize Date/Time Format
|
151
151
|
#
|
@@ -269,4 +269,18 @@ ActiveAdmin.setup do |config|
|
|
269
269
|
# of those filters by default here.
|
270
270
|
#
|
271
271
|
# config.include_default_association_filters = true
|
272
|
+
|
273
|
+
# == Footer
|
274
|
+
#
|
275
|
+
# By default, the footer shows the current Active Admin version. You can
|
276
|
+
# override the content of the footer here.
|
277
|
+
#
|
278
|
+
# config.footer = 'my custom footer text'
|
279
|
+
|
280
|
+
# == Sorting
|
281
|
+
#
|
282
|
+
# By default ActiveAdmin::OrderClause is used for sorting logic
|
283
|
+
# You can inherit it with own class and inject it for all resources
|
284
|
+
#
|
285
|
+
# config.order_clause = MyOrderClause
|
272
286
|
end
|
@@ -1,4 +1,9 @@
|
|
1
|
-
|
1
|
+
<%
|
2
|
+
parent_class = ActiveRecord::Migration
|
3
|
+
parent_class = parent_class[5.0] if Rails::VERSION::MAJOR >= 5
|
4
|
+
%>
|
5
|
+
|
6
|
+
class CreateActiveAdminComments < <%= parent_class.to_s %>
|
2
7
|
def self.up
|
3
8
|
create_table :active_admin_comments do |t|
|
4
9
|
t.string :namespace
|
@@ -6,10 +11,18 @@ class CreateActiveAdminComments < ActiveRecord::Migration
|
|
6
11
|
t.string :resource_id, null: false
|
7
12
|
t.string :resource_type, null: false
|
8
13
|
t.references :author, polymorphic: true
|
14
|
+
<%- if Rails::VERSION::MAJOR >= 5 -%>
|
9
15
|
t.timestamps
|
16
|
+
<%- else -%>
|
17
|
+
t.timestamps null: false
|
18
|
+
<%- end -%>
|
10
19
|
end
|
11
20
|
add_index :active_admin_comments, [:namespace]
|
21
|
+
<%- unless Rails::VERSION::MAJOR >= 5 -%>
|
22
|
+
|
12
23
|
add_index :active_admin_comments, [:author_type, :author_id]
|
24
|
+
<%- end -%>
|
25
|
+
|
13
26
|
add_index :active_admin_comments, [:resource_type, :resource_id]
|
14
27
|
end
|
15
28
|
|
data/lib/ransack_ext.rb
CHANGED
@@ -10,11 +10,11 @@ Ransack.configure do |config|
|
|
10
10
|
config.add_predicate old, arel_predicate: current
|
11
11
|
end
|
12
12
|
|
13
|
-
config.add_predicate '
|
13
|
+
config.add_predicate 'gteq_datetime',
|
14
14
|
arel_predicate: 'gteq',
|
15
15
|
formatter: ->(v) { v.beginning_of_day }
|
16
16
|
|
17
|
-
config.add_predicate '
|
17
|
+
config.add_predicate 'lteq_datetime',
|
18
18
|
arel_predicate: 'lt',
|
19
19
|
formatter: ->(v) { v + 1.day }
|
20
20
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'bug_report_templates' do
|
4
|
+
subject do
|
5
|
+
Bundler.with_clean_env do
|
6
|
+
Dir.chdir(chdir_path) do
|
7
|
+
system({'ACTIVE_ADMIN_PATH' => active_admin_root},
|
8
|
+
Gem.ruby,
|
9
|
+
template_path,
|
10
|
+
out: File::NULL)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:active_admin_root) { File.expand_path('../..', __FILE__) }
|
16
|
+
let(:chdir_path) { File.join(active_admin_root, 'lib', 'bug_report_templates') }
|
17
|
+
|
18
|
+
context 'when runs rails_5_master.rb' do
|
19
|
+
let(:template_path) { 'rails_5_master.rb' }
|
20
|
+
|
21
|
+
it 'passes' do
|
22
|
+
expect(subject).to be_truthy
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|