activeadmin 0.4.4 → 0.5.0.pre
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.
- data/.gitignore +3 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +50 -0
- data/CONTRIBUTING.md +2 -4
- data/Gemfile +10 -4
- data/Guardfile +0 -1
- data/LICENSE +1 -1
- data/README.rdoc +19 -8
- data/Rakefile +10 -1
- data/activeadmin.gemspec +2 -1
- data/app/assets/javascripts/active_admin/application.js +3 -9
- data/app/assets/javascripts/active_admin/base.js +1 -0
- data/app/assets/javascripts/active_admin/components/jquery.aa.checkbox-toggler.js.coffee +64 -0
- data/app/assets/javascripts/active_admin/components/jquery.aa.dropdown-menu.js.coffee +107 -0
- data/app/assets/javascripts/active_admin/components/jquery.aa.popover.js.coffee +100 -0
- data/app/assets/javascripts/active_admin/components/jquery.aa.table-checkbox-toggler.js.coffee +27 -0
- data/app/assets/javascripts/active_admin/lib/namespace.js.coffee +3 -0
- data/app/assets/javascripts/active_admin/pages/application.js.coffee +13 -0
- data/app/assets/javascripts/active_admin/pages/batch_actions.js.coffee +26 -0
- data/app/assets/stylesheets/active_admin/_base.css.scss +32 -26
- data/app/assets/stylesheets/active_admin/_forms.css.scss +12 -5
- data/app/assets/stylesheets/active_admin/_header.css.scss +1 -2
- data/app/assets/stylesheets/active_admin/_typography.css.scss +1 -1
- data/app/assets/stylesheets/active_admin/components/_batch_actions.css.scss +11 -0
- data/app/assets/stylesheets/active_admin/components/_buttons.scss +1 -2
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +151 -0
- data/app/assets/stylesheets/active_admin/components/_flash_messages.css.scss +3 -3
- data/app/assets/stylesheets/active_admin/components/_popovers.css.scss +123 -0
- data/app/assets/stylesheets/active_admin/components/_status_tags.scss +1 -1
- data/app/assets/stylesheets/active_admin/components/_table_tools.css.scss +20 -27
- data/app/assets/stylesheets/active_admin/components/_tables.css.scss +1 -0
- data/app/assets/stylesheets/active_admin/mixins/_buttons.css.scss +38 -36
- data/app/assets/stylesheets/active_admin/mixins/_gradients.css.scss +5 -5
- data/app/assets/stylesheets/active_admin/mixins/_icons.css.scss +7 -3
- data/app/assets/stylesheets/active_admin/mixins/_variables.css.scss +19 -17
- data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +2 -2
- data/app/assets/stylesheets/active_admin/print.css.scss +290 -0
- data/app/views/active_admin/dashboard/index.html.arb +1 -1
- data/app/views/active_admin/devise/passwords/edit.html.erb +17 -14
- data/app/views/active_admin/devise/passwords/new.html.erb +4 -4
- data/app/views/active_admin/devise/sessions/new.html.erb +6 -6
- data/app/views/active_admin/devise/shared/_links.erb +6 -6
- data/app/views/active_admin/page/index.html.arb +1 -1
- data/app/views/active_admin/resource/edit.html.arb +1 -1
- data/app/views/active_admin/resource/index.csv.erb +1 -1
- data/app/views/active_admin/resource/index.html.arb +1 -1
- data/app/views/active_admin/resource/new.html.arb +1 -1
- data/app/views/active_admin/resource/show.html.arb +1 -1
- data/app/views/layouts/active_admin.html.arb +1 -1
- data/app/views/layouts/active_admin_logged_out.html.erb +2 -2
- data/cucumber.yml +1 -1
- data/docs/0-installation.md +10 -1
- data/docs/{9-custom-pages.md → 10-custom-pages.md} +0 -0
- data/docs/2-resource-customization.md +19 -1
- data/docs/3-index-pages.md +31 -0
- data/docs/4-csv-format.md +9 -0
- data/docs/6-show-screens.md +1 -1
- data/docs/9-batch-actions.md +161 -0
- data/features/dashboard.feature +31 -8
- data/features/development_reloading.feature +1 -1
- data/features/edit_page.feature +3 -3
- data/features/i18n.feature +35 -0
- data/features/index/batch_actions.feature +98 -0
- data/features/index/filters.feature +26 -0
- data/features/index/format_as_csv.feature +35 -0
- data/features/index/index_as_table.feature +30 -2
- data/features/index/index_blank_slate.feature +8 -3
- data/features/index/index_scopes.feature +130 -24
- data/features/index/page_title.feature +12 -0
- data/features/new_page.feature +3 -3
- data/features/registering_pages.feature +61 -0
- data/features/root_to.feature +17 -0
- data/features/show/default_content.feature +1 -1
- data/features/show/page_title.feature +14 -0
- data/features/sidebar_sections.feature +26 -0
- data/features/site_title.feature +1 -1
- data/features/specifying_actions.feature +7 -6
- data/features/step_definitions/action_link_steps.rb +1 -1
- data/features/step_definitions/additional_web_steps.rb +7 -1
- data/features/step_definitions/batch_action_steps.rb +94 -0
- data/features/step_definitions/configuration_steps.rb +30 -8
- data/features/step_definitions/factory_steps.rb +12 -0
- data/features/step_definitions/format_steps.rb +6 -2
- data/features/step_definitions/i18n_steps.rb +3 -0
- data/features/step_definitions/table_steps.rb +114 -0
- data/features/step_definitions/user_steps.rb +30 -4
- data/features/support/env.rb +54 -15
- data/features/support/paths.rb +2 -0
- data/features/users/logging_in.feature +1 -1
- data/features/users/logging_out.feature +2 -1
- data/features/users/resetting_password.feature +34 -0
- data/lib/active_admin.rb +46 -7
- data/lib/active_admin/application.rb +30 -15
- data/lib/active_admin/base_controller/menu.rb +3 -3
- data/lib/active_admin/batch_actions.rb +17 -0
- data/lib/active_admin/batch_actions/controller.rb +25 -0
- data/lib/active_admin/batch_actions/resource_extension.rb +126 -0
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +35 -0
- data/lib/active_admin/batch_actions/views/batch_action_popover.rb +28 -0
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +63 -0
- data/lib/active_admin/batch_actions/views/selection_cells.rb +37 -0
- data/lib/active_admin/comments.rb +5 -2
- data/lib/active_admin/comments/comment.rb +4 -3
- data/lib/active_admin/comments/views/active_admin_comments.rb +5 -5
- data/lib/active_admin/component.rb +1 -18
- data/lib/active_admin/csv_builder.rb +8 -3
- data/lib/active_admin/dashboards.rb +21 -4
- data/lib/active_admin/dashboards/dashboard_controller.rb +1 -5
- data/lib/active_admin/dependency_checker.rb +1 -1
- data/lib/active_admin/dsl.rb +61 -4
- data/lib/active_admin/engine.rb +1 -1
- data/lib/active_admin/filters.rb +8 -0
- data/lib/active_admin/filters/dsl.rb +12 -0
- data/lib/active_admin/filters/forms.rb +93 -0
- data/lib/active_admin/filters/resource_extension.rb +92 -0
- data/lib/active_admin/form_builder.rb +88 -33
- data/lib/active_admin/helpers/collection.rb +23 -0
- data/lib/active_admin/helpers/optional_display.rb +1 -1
- data/lib/active_admin/inputs/filter_select_input.rb +1 -1
- data/lib/active_admin/locales/bg.yml +37 -1
- data/lib/active_admin/locales/ca.yml +36 -0
- data/lib/active_admin/locales/cs.yml +36 -0
- data/lib/active_admin/locales/da.yml +36 -0
- data/lib/active_admin/locales/de.yml +42 -0
- data/lib/active_admin/locales/en.yml +27 -2
- data/lib/active_admin/locales/es.yml +45 -4
- data/lib/active_admin/locales/fr.yml +22 -0
- data/lib/active_admin/locales/{he_il.yml → he.yml} +37 -2
- data/lib/active_admin/locales/hr.yml +49 -5
- data/lib/active_admin/locales/hu.yml +21 -0
- data/lib/active_admin/locales/it.yml +36 -1
- data/lib/active_admin/locales/ja.yml +36 -0
- data/lib/active_admin/locales/ko.yml +36 -1
- data/lib/active_admin/locales/lv.yml +28 -2
- data/lib/active_admin/locales/nl.yml +42 -1
- data/lib/active_admin/locales/no-NB.yml +15 -0
- data/lib/active_admin/locales/pl.yml +45 -1
- data/lib/active_admin/locales/pt-BR.yml +36 -1
- data/lib/active_admin/locales/ro.yml +67 -0
- data/lib/active_admin/locales/ru.yml +43 -3
- data/lib/active_admin/locales/sv-SE.yml +41 -1
- data/lib/active_admin/locales/tr.yml +80 -0
- data/lib/active_admin/locales/vi.yml +80 -0
- data/lib/active_admin/locales/{zh_cn.yml → zh-CN.yml} +42 -2
- data/lib/active_admin/locales/zh-TW.yml +36 -1
- data/lib/active_admin/menu.rb +55 -30
- data/lib/active_admin/menu_builder.rb +65 -0
- data/lib/active_admin/menu_item.rb +55 -14
- data/lib/active_admin/namespace.rb +25 -55
- data/lib/active_admin/page.rb +15 -10
- data/lib/active_admin/resource.rb +9 -0
- data/lib/active_admin/resource/action_items.rb +4 -4
- data/lib/active_admin/resource/controllers.rb +1 -1
- data/lib/active_admin/resource/menu.rb +19 -21
- data/lib/active_admin/resource/naming.rb +55 -45
- data/lib/active_admin/resource/sidebars.rb +0 -13
- data/lib/active_admin/resource_collection.rb +10 -10
- data/lib/active_admin/resource_controller.rb +5 -5
- data/lib/active_admin/resource_controller/actions.rb +2 -0
- data/lib/active_admin/resource_controller/collection.rb +13 -4
- data/lib/active_admin/resource_dsl.rb +12 -6
- data/lib/active_admin/router.rb +27 -8
- data/lib/active_admin/scope.rb +1 -0
- data/lib/active_admin/sidebar_section.rb +2 -6
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_factory.rb +18 -13
- data/lib/active_admin/view_helpers.rb +0 -2
- data/lib/active_admin/view_helpers/auto_link_helper.rb +2 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +24 -25
- data/lib/active_admin/view_helpers/display_helper.rb +1 -1
- data/lib/active_admin/view_helpers/fields_for.rb +44 -0
- data/lib/active_admin/view_helpers/form_helper.rb +6 -0
- data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -1
- data/lib/active_admin/views/components/action_list_popover.rb +29 -0
- data/lib/active_admin/views/components/attributes_table.rb +6 -2
- data/lib/active_admin/views/components/dropdown_menu.rb +73 -0
- data/lib/active_admin/views/components/paginated_collection.rb +13 -14
- data/lib/active_admin/views/components/popover.rb +27 -0
- data/lib/active_admin/views/components/scopes.rb +8 -13
- data/lib/active_admin/views/components/sidebar_section.rb +1 -1
- data/lib/active_admin/views/components/site_title.rb +55 -0
- data/lib/active_admin/views/components/status_tag.rb +4 -4
- data/lib/active_admin/views/components/table_for.rb +18 -18
- data/lib/active_admin/views/dashboard_section_renderer.rb +1 -1
- data/lib/active_admin/views/footer.rb +18 -0
- data/lib/active_admin/views/header.rb +31 -0
- data/lib/active_admin/views/index_as_block.rb +3 -0
- data/lib/active_admin/views/index_as_blog.rb +4 -0
- data/lib/active_admin/views/index_as_grid.rb +2 -0
- data/lib/active_admin/views/index_as_table.rb +19 -6
- data/lib/active_admin/views/pages/base.rb +14 -48
- data/lib/active_admin/views/pages/form.rb +3 -3
- data/lib/active_admin/views/pages/index.rb +56 -24
- data/lib/active_admin/views/pages/layout.rb +2 -2
- data/lib/active_admin/views/pages/page.rb +10 -4
- data/lib/active_admin/views/pages/show.rb +11 -8
- data/lib/active_admin/views/tabbed_navigation.rb +3 -3
- data/lib/active_admin/views/title_bar.rb +50 -0
- data/lib/active_admin/views/utility_nav.rb +41 -0
- data/lib/generators/active_admin/assets/assets_generator.rb +1 -1
- data/lib/generators/active_admin/assets/templates/3.0/active_admin.js +1 -0
- data/lib/generators/active_admin/assets/templates/3.1/active_admin.css.scss +26 -3
- data/lib/generators/active_admin/devise/devise_generator.rb +2 -2
- data/lib/generators/active_admin/install/install_generator.rb +10 -10
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +21 -1
- data/lib/generators/active_admin/install/templates/admin_user.rb.erb +20 -0
- data/lib/generators/active_admin/install/templates/dashboard.rb +33 -0
- data/lib/generators/active_admin/resource/templates/admin.rb +1 -1
- data/spec/integration/memory_spec.rb +1 -11
- data/spec/javascripts/coffeescripts/jquery.aa.checkbox-toggler-spec.js.coffee +50 -0
- data/spec/javascripts/coffeescripts/jquery.aa.popover-spec.js.coffee +82 -0
- data/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee +34 -0
- data/spec/javascripts/compiled/jquery.aa.checkbox-toggler-spec.js +60 -0
- data/spec/javascripts/compiled/jquery.aa.popover-spec.js +106 -0
- data/spec/javascripts/compiled/jquery.aa.table-checkbox-toggler-spec.js +37 -0
- data/spec/javascripts/fixtures/checkboxes.html +9 -0
- data/spec/javascripts/fixtures/table_checkboxes.html +17 -0
- data/spec/javascripts/helpers/SpecHelper.js +3 -0
- data/spec/javascripts/helpers/vendor/jasmine-fixture-0.0.5.js +108 -0
- data/spec/javascripts/helpers/vendor/jasmine-jquery.js +288 -0
- data/spec/javascripts/helpers/vendor/sinon-1.2.0.js +2915 -0
- data/spec/javascripts/support/jasmine.yml +74 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/javascripts/support/jquery-ui-1.8.16.custom.min.js +34 -0
- data/spec/javascripts/support/jquery.min.js +4 -0
- data/spec/spec_helper.rb +13 -13
- data/spec/spec_helper_without_rails.rb +2 -3
- data/spec/support/detect_rails_version.rb +16 -10
- data/spec/support/rails_template.rb +13 -1
- data/spec/support/templates/admin/stores.rb +1 -0
- data/spec/support/templates/en.yml +6 -0
- data/spec/unit/action_builder_spec.rb +38 -0
- data/spec/unit/application_spec.rb +12 -16
- data/spec/unit/base_controller_shared_examples.rb +3 -6
- data/spec/unit/batch_actions/resource_spec.rb +91 -0
- data/spec/unit/batch_actions/settings_spec.rb +61 -0
- data/spec/unit/breadcrumbs_spec.rb +33 -0
- data/spec/unit/comments_spec.rb +6 -0
- data/spec/unit/config_shared_examples.rb +17 -64
- data/spec/unit/csv_builder_spec.rb +12 -2
- data/spec/unit/dashboard_controller_spec.rb +11 -5
- data/spec/unit/dsl_include_spec.rb +20 -0
- data/spec/unit/{filter_form_builder_spec.rb → filters/filter_form_builder_spec.rb} +10 -7
- data/spec/unit/filters/resource_spec.rb +60 -0
- data/spec/unit/form_builder_spec.rb +180 -28
- data/spec/unit/helpers/collection_spec.rb +65 -0
- data/spec/unit/menu_item_spec.rb +48 -53
- data/spec/unit/menu_spec.rb +46 -32
- data/spec/unit/namespace/register_page_spec.rb +0 -6
- data/spec/unit/namespace/register_resource_spec.rb +1 -8
- data/spec/unit/namespace_spec.rb +8 -2
- data/spec/unit/page_spec.rb +20 -8
- data/spec/unit/resource/naming_spec.rb +27 -26
- data/spec/unit/resource/sidebars_spec.rb +0 -7
- data/spec/unit/resource_collection_spec.rb +11 -11
- data/spec/unit/resource_controller/collection_spec.rb +23 -1
- data/spec/unit/resource_controller/sidebars_spec.rb +46 -0
- data/spec/unit/resource_controller_spec.rb +43 -0
- data/spec/unit/resource_registration_spec.rb +2 -13
- data/spec/unit/resource_spec.rb +0 -42
- data/spec/unit/routing_spec.rb +60 -14
- data/spec/unit/scope_spec.rb +7 -0
- data/spec/unit/view_factory_spec.rb +9 -6
- data/spec/unit/view_helpers/fields_for_spec.rb +41 -0
- data/spec/unit/view_helpers/form_helper_spec.rb +18 -0
- data/spec/unit/views/components/action_list_popover_spec.rb +30 -0
- data/spec/unit/views/components/attributes_table_spec.rb +32 -20
- data/spec/unit/views/components/batch_action_popover_spec.rb +33 -0
- data/spec/unit/views/components/blank_slate_spec.rb +5 -3
- data/spec/unit/views/components/columns_spec.rb +32 -22
- data/spec/unit/views/components/paginated_collection_spec.rb +54 -12
- data/spec/unit/views/components/panel_spec.rb +11 -6
- data/spec/unit/views/components/popover_spec.rb +33 -0
- data/spec/unit/views/components/sidebar_section_spec.rb +6 -6
- data/spec/unit/views/components/site_title_spec.rb +78 -0
- data/spec/unit/views/components/status_tag_spec.rb +17 -10
- data/spec/unit/views/components/table_for_spec.rb +37 -17
- data/spec/unit/views/pages/layout_spec.rb +51 -10
- data/spec/unit/views/tabbed_navigation_spec.rb +44 -23
- data/tasks/js.rake +32 -0
- data/tasks/test.rake +1 -1
- metadata +233 -200
- data/lib/active_admin/arbre.rb +0 -22
- data/lib/active_admin/arbre/builder.rb +0 -125
- data/lib/active_admin/arbre/context.rb +0 -45
- data/lib/active_admin/arbre/html/attributes.rb +0 -20
- data/lib/active_admin/arbre/html/class_list.rb +0 -24
- data/lib/active_admin/arbre/html/collection.rb +0 -27
- data/lib/active_admin/arbre/html/document.rb +0 -42
- data/lib/active_admin/arbre/html/element.rb +0 -161
- data/lib/active_admin/arbre/html/html5_elements.rb +0 -47
- data/lib/active_admin/arbre/html/tag.rb +0 -145
- data/lib/active_admin/arbre/html/text_node.rb +0 -35
- data/lib/active_admin/filter_form_builder.rb +0 -53
- data/lib/active_admin/renderer.rb +0 -87
- data/lib/active_admin/resource_controller/filters.rb +0 -58
- data/lib/active_admin/stylesheets/active_admin/mixins/_utilities.scss +0 -0
- data/lib/active_admin/view_helpers/filter_form_helper.rb +0 -36
- data/lib/active_admin/view_helpers/renderer_helper.rb +0 -29
- data/lib/active_admin/views/header_renderer.rb +0 -82
- data/lib/generators/active_admin/assets/templates/dashboards.rb +0 -36
- data/lib/generators/active_admin/install/templates/dashboards.rb +0 -44
- data/spec/unit/arbre/context_spec.rb +0 -35
- data/spec/unit/arbre/html/element_finder_methods_spec.rb +0 -110
- data/spec/unit/arbre/html/element_spec.rb +0 -236
- data/spec/unit/arbre/html/tag_attributes_spec.rb +0 -61
- data/spec/unit/arbre/html/tag_spec.rb +0 -63
- data/spec/unit/arbre/html_spec.rb +0 -228
- data/spec/unit/renderer_spec.rb +0 -126
@@ -24,28 +24,27 @@ module ActiveAdmin
|
|
24
24
|
form_buffers.last << content.html_safe
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
def cancel_link(url = nil, html_options = {}, li_attributes = {})
|
28
|
+
li_attributes[:class] ||= "cancel"
|
29
|
+
url ||= {:action => "index"}
|
30
|
+
form_buffers.last << template.content_tag(:li, (template.link_to I18n.t('active_admin.cancel'), url, html_options), li_attributes)
|
31
|
+
end
|
32
|
+
|
33
|
+
def actions(*args, &block)
|
29
34
|
content = with_new_form_buffer do
|
30
|
-
block_given? ? super : super {
|
35
|
+
block_given? ? super : super { commit_action_with_cancel_link }
|
31
36
|
end
|
32
37
|
form_buffers.last << content.html_safe
|
33
38
|
end
|
34
39
|
|
35
|
-
def
|
36
|
-
content = with_new_form_buffer{ super }
|
40
|
+
def action(*args)
|
41
|
+
content = with_new_form_buffer { super }
|
37
42
|
form_buffers.last << content.html_safe
|
38
43
|
end
|
39
44
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
template.content_tag(:li, (template.link_to I18n.t('active_admin.cancel'), url, html_options), li_attributes)
|
44
|
-
end
|
45
|
-
|
46
|
-
def commit_button_with_cancel_link
|
47
|
-
content = commit_button
|
48
|
-
content << cancel_link
|
45
|
+
def commit_action_with_cancel_link
|
46
|
+
action(:submit)
|
47
|
+
cancel_link
|
49
48
|
end
|
50
49
|
|
51
50
|
def has_many(association, options = {}, &block)
|
@@ -55,17 +54,26 @@ module ActiveAdmin
|
|
55
54
|
|
56
55
|
# Add Delete Links
|
57
56
|
form_block = proc do |has_many_form|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
# @see https://github.com/justinfrench/formtastic/blob/2.2.1/lib/formtastic/helpers/inputs_helper.rb#L373
|
58
|
+
contents = if block.arity == 1 # for backwards compatibility with REE & Ruby 1.8.x
|
59
|
+
block.call(has_many_form)
|
60
|
+
else
|
61
|
+
index = parent_child_index(options[:parent]) if options[:parent]
|
62
|
+
block.call(has_many_form, index)
|
63
|
+
end
|
64
|
+
|
65
|
+
if has_many_form.object.new_record?
|
66
|
+
contents += template.content_tag(:li) do
|
67
|
+
template.link_to I18n.t('active_admin.has_many_delete'), "#", :onclick => "$(this).closest('.has_many_fields').remove(); return false;", :class => "button"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
contents
|
64
72
|
end
|
65
73
|
|
66
74
|
content = with_new_form_buffer do
|
67
75
|
template.content_tag :div, :class => "has_many #{association}" do
|
68
|
-
form_buffers.last << template.content_tag(:h3, association.
|
76
|
+
form_buffers.last << template.content_tag(:h3, object.class.reflect_on_association(association).klass.model_name.human(:count => 1.1))
|
69
77
|
inputs options, &form_block
|
70
78
|
|
71
79
|
# Capture the ADD JS
|
@@ -78,7 +86,7 @@ module ActiveAdmin
|
|
78
86
|
end
|
79
87
|
|
80
88
|
js = template.escape_javascript(js)
|
81
|
-
js = template.link_to I18n.t('active_admin.has_many_new', :model => association.
|
89
|
+
js = template.link_to I18n.t('active_admin.has_many_new', :model => object.class.reflect_on_association(association).klass.model_name.human), "#", :onclick => "$(this).before('#{js}'.replace(/NEW_RECORD/g, new Date().getTime())); return false;", :class => "button"
|
82
90
|
|
83
91
|
form_buffers.last << js.html_safe
|
84
92
|
end
|
@@ -86,29 +94,76 @@ module ActiveAdmin
|
|
86
94
|
form_buffers.last << content.html_safe
|
87
95
|
end
|
88
96
|
|
97
|
+
# These methods are deprecated and removed from Formtastic, however are
|
98
|
+
# supported here to help with transition.
|
99
|
+
module DeprecatedMethods
|
100
|
+
|
101
|
+
# Formtastic has depreciated #commit_button in favor of #action(:submit)
|
102
|
+
def commit_button(*args)
|
103
|
+
::ActiveSupport::Deprecation.warn("f.commit_button is deprecated in favour of f.action(:submit)")
|
104
|
+
|
105
|
+
options = args.extract_options!
|
106
|
+
if String === args.first
|
107
|
+
options[:label] = args.first unless options.has_key?(:label)
|
108
|
+
end
|
109
|
+
|
110
|
+
action(:submit, options)
|
111
|
+
end
|
112
|
+
|
113
|
+
def commit_button_with_cancel_link
|
114
|
+
# Formtastic has depreciated #buttons in favor of #actions
|
115
|
+
::ActiveSupport::Deprecation.warn("f.commit_button_with_cancel_link is deprecated in favour of f.commit_action_with_cancel_link")
|
116
|
+
|
117
|
+
commit_action_with_cancel_link
|
118
|
+
end
|
119
|
+
|
120
|
+
# The buttons method always needs to be wrapped in a new buffer
|
121
|
+
def buttons(*args, &block)
|
122
|
+
# Formtastic has depreciated #buttons in favor of #actions
|
123
|
+
::ActiveSupport::Deprecation.warn("f.buttons is deprecated in favour of f.actions")
|
124
|
+
|
125
|
+
actions args, &block
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
include DeprecatedMethods
|
130
|
+
|
89
131
|
protected
|
90
132
|
|
91
133
|
def active_admin_input_class_name(as)
|
92
134
|
"ActiveAdmin::Inputs::#{as.to_s.camelize}Input"
|
93
135
|
end
|
94
136
|
|
95
|
-
|
96
|
-
|
97
|
-
|
137
|
+
# prevent exceptions in production environment for better performance
|
138
|
+
def input_class_with_const_defined(as)
|
139
|
+
input_class_name = custom_input_class_name(as)
|
140
|
+
|
141
|
+
if ::Object.const_defined?(input_class_name)
|
142
|
+
input_class_name.constantize
|
143
|
+
elsif ActiveAdmin::Inputs.const_defined?(input_class_name)
|
144
|
+
active_admin_input_class_name(as).constantize
|
145
|
+
elsif Formtastic::Inputs.const_defined?(input_class_name)
|
146
|
+
standard_input_class_name(as).constantize
|
147
|
+
else
|
148
|
+
raise Formtastic::UnknownInputError
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# use auto-loading in development environment
|
153
|
+
def input_class_by_trying(as)
|
154
|
+
begin
|
98
155
|
begin
|
156
|
+
custom_input_class_name(as).constantize
|
157
|
+
rescue NameError
|
99
158
|
begin
|
100
|
-
|
159
|
+
active_admin_input_class_name(as).constantize
|
101
160
|
rescue NameError
|
102
|
-
|
103
|
-
active_admin_input_class_name(as).constantize
|
104
|
-
rescue NameError
|
105
|
-
standard_input_class_name(as).constantize
|
106
|
-
end
|
161
|
+
standard_input_class_name(as).constantize
|
107
162
|
end
|
108
|
-
rescue NameError
|
109
|
-
raise Formtastic::UnknownInputError
|
110
163
|
end
|
111
164
|
end
|
165
|
+
rescue NameError
|
166
|
+
raise Formtastic::UnknownInputError
|
112
167
|
end
|
113
168
|
|
114
169
|
private
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ActiveAdmin
|
2
|
+
module Helpers
|
3
|
+
module Collection
|
4
|
+
# Works around this issue: https://github.com/rails/rails/issues/7121
|
5
|
+
#
|
6
|
+
# GROUP BY + COUNT drops SELECT statement. This leads to SQL error when
|
7
|
+
# the ORDER statement mentions a column defined in the SELECT statement.
|
8
|
+
#
|
9
|
+
# We remove the ORDER statement to work around this issue.
|
10
|
+
def collection_size(collection=collection)
|
11
|
+
size = collection.reorder("").count
|
12
|
+
# when GROUP BY is used, AR returns Hash instead of Fixnum for .size
|
13
|
+
size = size.size if size.kind_of?(Hash)
|
14
|
+
|
15
|
+
size
|
16
|
+
end
|
17
|
+
|
18
|
+
def collection_is_empty?(collection=collection)
|
19
|
+
collection_size(collection) == 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -21,7 +21,7 @@ module ActiveAdmin
|
|
21
21
|
symbol_or_proc = @options[:if]
|
22
22
|
return case symbol_or_proc
|
23
23
|
when Symbol, String
|
24
|
-
self.send(symbol_or_proc)
|
24
|
+
render_context ? render_context.send(symbol_or_proc) : self.send(symbol_or_proc)
|
25
25
|
when Proc
|
26
26
|
render_context ? render_context.instance_exec(&symbol_or_proc) : instance_exec(&symbol_or_proc)
|
27
27
|
else symbol_or_proc
|
@@ -37,4 +37,40 @@ bg:
|
|
37
37
|
any: "Всеки"
|
38
38
|
blank_slate:
|
39
39
|
content: "Няма %{resource_name} все още."
|
40
|
-
link: "Създай връзка"
|
40
|
+
link: "Създай връзка"
|
41
|
+
batch_actions:
|
42
|
+
button_label: "партиди Действия"
|
43
|
+
delete_confirmation: "Сигурни ли сте че искате да изтриете тези %{plural_model}? Вие няма да можете да отмените това."
|
44
|
+
succesfully_destroyed:
|
45
|
+
one: "Успешно унищожени 1 %{model}"
|
46
|
+
other: "Успешно унищожени %{count} %{plural_model}"
|
47
|
+
selection_toggle_explanation: "(Toggle Избор)"
|
48
|
+
link: "Създаване на една"
|
49
|
+
action_label: "%{title} Избрани"
|
50
|
+
labels:
|
51
|
+
destroy: "Изтриване"
|
52
|
+
comments:
|
53
|
+
body: "тяло"
|
54
|
+
author: "автор"
|
55
|
+
title: "коментар"
|
56
|
+
add: "Добавяне на коментар"
|
57
|
+
resource: "Resource"
|
58
|
+
no_comments_yet: "Все още няма коментари."
|
59
|
+
title_content: "Коментари (%{count})"
|
60
|
+
errors:
|
61
|
+
empty_text: "Коментар не е спасен, текст е празна."
|
62
|
+
devise:
|
63
|
+
login:
|
64
|
+
title: "Влез"
|
65
|
+
remember_me: "Запомни ме"
|
66
|
+
submit: "Влез"
|
67
|
+
reset_password:
|
68
|
+
title: "Забравена парола?"
|
69
|
+
submit: "Възстановите паролата си"
|
70
|
+
change_password:
|
71
|
+
title: "Промяна на паролата"
|
72
|
+
submit: "Промяна на паролата си"
|
73
|
+
links:
|
74
|
+
sign_in: "Влезте в профила си"
|
75
|
+
forgot_your_password: "Забравена парола?"
|
76
|
+
|
@@ -42,3 +42,39 @@ ca:
|
|
42
42
|
blank_slate:
|
43
43
|
content: "Encara no hi ha cap %{resource_name}."
|
44
44
|
link: "Crea'n un/a"
|
45
|
+
batch_actions:
|
46
|
+
button_label: "les accions per lots"
|
47
|
+
delete_confirmation: "¿Està segur que desitja eliminar aquests %{plural_model}? Vostè no serà capaç de desfer això."
|
48
|
+
succesfully_destroyed:
|
49
|
+
one: "Va destruir amb èxit 1 %{model}"
|
50
|
+
other: "Va destruir amb èxit %{count} %{plural_model}"
|
51
|
+
selection_toggle_explanation: "(Selecció de Canviar)"
|
52
|
+
link: "crear una"
|
53
|
+
action_label: "%{title} seleccionat"
|
54
|
+
labels:
|
55
|
+
destroy: "esborrar"
|
56
|
+
comments:
|
57
|
+
body: "Cos"
|
58
|
+
author: "autor"
|
59
|
+
title: "comentari"
|
60
|
+
add: "Afegeix comentari"
|
61
|
+
resource: "Recurs"
|
62
|
+
no_comments_yet: "No hi ha comentaris"
|
63
|
+
title_content: "comentaris (%{count})"
|
64
|
+
errors:
|
65
|
+
empty_text: "El comentari no es va salvar, el text estava buida."
|
66
|
+
devise:
|
67
|
+
login:
|
68
|
+
title: "iniciar sessió"
|
69
|
+
remember_me: "Recordar"
|
70
|
+
submit: "iniciar sessió"
|
71
|
+
reset_password:
|
72
|
+
title: "Heu perdut la contrasenya?"
|
73
|
+
submit: "Restablir la contrasenya"
|
74
|
+
change_password:
|
75
|
+
title: "Canvieu la contrasenya"
|
76
|
+
submit: "Canviar la contrasenya"
|
77
|
+
links:
|
78
|
+
sign_in: "Registrar"
|
79
|
+
forgot_your_password: "Heu perdut la contrasenya?"
|
80
|
+
|
@@ -36,3 +36,39 @@ cs:
|
|
36
36
|
blank_slate:
|
37
37
|
content: "Zatím zde není žádný obsah."
|
38
38
|
link: "Vytvořit"
|
39
|
+
batch_actions:
|
40
|
+
button_label: "dávkové Akce"
|
41
|
+
delete_confirmation: "Jste si jisti, že chcete odstranit tyto %{plural_model}? Nebudete moci vrátit zpět to."
|
42
|
+
succesfully_destroyed:
|
43
|
+
one: "úspěšně zničil 1 %{model}"
|
44
|
+
other: "úspěšně zničil %{count} %{plural_model}"
|
45
|
+
selection_toggle_explanation: "(Změnit výběr)"
|
46
|
+
link: "vytvořit jeden"
|
47
|
+
action_label: "%{title} vybraný"
|
48
|
+
labels:
|
49
|
+
destroy: "vymazat"
|
50
|
+
comments:
|
51
|
+
body: "tělo"
|
52
|
+
author: "autor"
|
53
|
+
title: "komentář"
|
54
|
+
add: "Přidat komentář"
|
55
|
+
resource: "zdroj"
|
56
|
+
no_comments_yet: "Žádný nový komentář"
|
57
|
+
title_content: "Komentáře (%{count})"
|
58
|
+
errors:
|
59
|
+
empty_text: "Komentář nebyl uložen, je prázdný."
|
60
|
+
devise:
|
61
|
+
login:
|
62
|
+
title: "přihlášení"
|
63
|
+
remember_me: "Zapamatuj si mě"
|
64
|
+
submit: "přihlášení"
|
65
|
+
reset_password:
|
66
|
+
title: "Zapomněli jste heslo?"
|
67
|
+
submit: "Obnovit heslo"
|
68
|
+
change_password:
|
69
|
+
title: "Změnit heslo"
|
70
|
+
submit: "Změnit své heslo"
|
71
|
+
links:
|
72
|
+
sign_in: "Přihlásit se"
|
73
|
+
forgot_your_password: "Zapomněli jste heslo?"
|
74
|
+
|
@@ -41,3 +41,39 @@ da:
|
|
41
41
|
blank_slate:
|
42
42
|
content: "Der er ingen %{resource_name} endnu."
|
43
43
|
link: "Opret"
|
44
|
+
batch_actions:
|
45
|
+
button_label: "Batch Handlinger"
|
46
|
+
delete_confirmation: "Er du sikker på du vil slette disse %{plural_model}? Du vil ikke være i stand til at fortryde dette."
|
47
|
+
succesfully_destroyed:
|
48
|
+
one: "Vellykket ødelagt 1 %{model}"
|
49
|
+
other: "Vellykket ødelagt %{count} %{plural_model}"
|
50
|
+
selection_toggle_explanation: "(Skift Selection)"
|
51
|
+
link: "Opret en"
|
52
|
+
action_label: "%{title} Valgte"
|
53
|
+
labels:
|
54
|
+
destroy: "Slet"
|
55
|
+
comments:
|
56
|
+
body: "krop"
|
57
|
+
author: "forfatter"
|
58
|
+
title: "Kommentar"
|
59
|
+
add: "Tilføj Kommentar"
|
60
|
+
resource: "Resource"
|
61
|
+
no_comments_yet: "Ingen kommentarer endnu."
|
62
|
+
title_content: "Kommentarer (%{count})"
|
63
|
+
errors:
|
64
|
+
empty_text: "Kommentar blev ikke gemt, tekst var tom."
|
65
|
+
devise:
|
66
|
+
login:
|
67
|
+
title: "Login"
|
68
|
+
remember_me: "Husk mig"
|
69
|
+
submit: "Login"
|
70
|
+
reset_password:
|
71
|
+
title: "Glemt din adgangskode?"
|
72
|
+
submit: "Nulstille min adgangskode"
|
73
|
+
change_password:
|
74
|
+
title: "Skift din adgangskode"
|
75
|
+
submit: "Skift min adgangskode"
|
76
|
+
links:
|
77
|
+
sign_in: "Log ind"
|
78
|
+
forgot_your_password: "Glemt din adgangskode?"
|
79
|
+
|
@@ -52,3 +52,45 @@ de:
|
|
52
52
|
title_content: "Kommentare (%{count})"
|
53
53
|
errors:
|
54
54
|
empty_text: "Der Kommentar wurde nicht gespeichert, da der Text fehlt."
|
55
|
+
devise:
|
56
|
+
login:
|
57
|
+
title: "Login"
|
58
|
+
remember_me: "erinnere dich an mich"
|
59
|
+
submit: "Login"
|
60
|
+
reset_password:
|
61
|
+
title: "Passwort vergessen?"
|
62
|
+
submit: "Mein Passwort zurücksetzen"
|
63
|
+
change_password:
|
64
|
+
title: "Ändern Sie Ihr Passwort"
|
65
|
+
submit: "Mein Passwort ändern"
|
66
|
+
links:
|
67
|
+
sign_in: "Anmeldung"
|
68
|
+
forgot_your_password: "Passwort vergessen?"
|
69
|
+
activerecord:
|
70
|
+
attributes:
|
71
|
+
admin_user:
|
72
|
+
id: ID
|
73
|
+
email: E-Mail
|
74
|
+
encrypted_Password: Verschlüsseltes Passwort
|
75
|
+
reset_password_token: Passwort Reset Token
|
76
|
+
reset_password_sent_at: Passwort Reset Anweisungen gesendet am
|
77
|
+
remember_created_at: Passwort merken seit
|
78
|
+
sign_in_count: Anzahl Logins
|
79
|
+
current_sign_in_at: Aktuell angemeldet seit
|
80
|
+
last_sign_in_at: Letzter Login am
|
81
|
+
current_sign_in_ip: Aktuelle IP-Adresse
|
82
|
+
last_sign_in_ip: Letzte IP-Adresse
|
83
|
+
created_at: Erstellt am
|
84
|
+
updated_at: Aktualisiert am
|
85
|
+
models:
|
86
|
+
admin_user:
|
87
|
+
one: Administrator
|
88
|
+
other: Administratoren
|
89
|
+
devise:
|
90
|
+
failure:
|
91
|
+
admin_user:
|
92
|
+
invalid: Benutzername oder Kennwort nicht korrekt.
|
93
|
+
unauthenticated: Bitte melden Sie sich als Administrator an.
|
94
|
+
sessions:
|
95
|
+
admin_user:
|
96
|
+
signed_in: Erfolgreich als Administrator angemeldet.
|
@@ -43,7 +43,18 @@ en:
|
|
43
43
|
blank_slate:
|
44
44
|
content: "There are no %{resource_name} yet."
|
45
45
|
link: "Create one"
|
46
|
-
|
46
|
+
batch_actions:
|
47
|
+
button_label: "Batch Actions"
|
48
|
+
delete_confirmation: "Are you sure you want to delete these %{plural_model}? You won't be able to undo this."
|
49
|
+
succesfully_destroyed:
|
50
|
+
one: "Successfully destroyed 1 %{model}"
|
51
|
+
other: "Successfully destroyed %{count} %{plural_model}"
|
52
|
+
selection_toggle_explanation: "(Toggle Selection)"
|
53
|
+
link: "Create one"
|
54
|
+
action_label: "%{title} Selected"
|
55
|
+
labels:
|
56
|
+
destroy: "Delete"
|
57
|
+
comments:
|
47
58
|
body: "Body"
|
48
59
|
author: "Author"
|
49
60
|
title: "Comment"
|
@@ -52,4 +63,18 @@ en:
|
|
52
63
|
no_comments_yet: "No comments yet."
|
53
64
|
title_content: "Comments (%{count})"
|
54
65
|
errors:
|
55
|
-
empty_text: "Comment wasn't saved, text was empty."
|
66
|
+
empty_text: "Comment wasn't saved, text was empty."
|
67
|
+
devise:
|
68
|
+
login:
|
69
|
+
title: "Login"
|
70
|
+
remember_me: "Remember me"
|
71
|
+
submit: "Login"
|
72
|
+
reset_password:
|
73
|
+
title: "Forgot your password?"
|
74
|
+
submit: "Reset My Password"
|
75
|
+
change_password:
|
76
|
+
title: "Change your password"
|
77
|
+
submit: "Change my password"
|
78
|
+
links:
|
79
|
+
sign_in: "Sign in"
|
80
|
+
forgot_your_password: "Forgot your password?"
|