drewda_rails_admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +53 -0
- data/LICENSE.md +20 -0
- data/README.md +160 -0
- data/Rakefile +19 -0
- data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/rails_admin/bullet_black.png +0 -0
- data/app/assets/images/rails_admin/bullet_white.png +0 -0
- data/app/assets/images/rails_admin/calendar.png +0 -0
- data/app/assets/images/rails_admin/clock.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/select.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/select2.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/app/assets/images/rails_admin/logo.png +0 -0
- data/app/assets/images/rails_admin/magnifier.png +0 -0
- data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
- data/app/assets/javascripts/rails_admin/custom/ui.js +12 -0
- data/app/assets/javascripts/rails_admin/jquery.colorpicker.js +484 -0
- data/app/assets/javascripts/rails_admin/jquery.pjax.js +431 -0
- data/app/assets/javascripts/rails_admin/jquery.ui.timepicker.js +1371 -0
- data/app/assets/javascripts/rails_admin/ra.datetimepicker.js +67 -0
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +129 -0
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +280 -0
- data/app/assets/javascripts/rails_admin/ra.filtering-select.js +181 -0
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.coffee +40 -0
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +150 -0
- data/app/assets/javascripts/rails_admin/rails_admin.js.erb +25 -0
- data/app/assets/javascripts/rails_admin/themes/default/ui.js +12 -0
- data/app/assets/javascripts/rails_admin/ui.js.coffee +61 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.css.scss +733 -0
- data/app/assets/stylesheets/rails_admin/base/README +2 -0
- data/app/assets/stylesheets/rails_admin/base/mixins.css.scss +1 -0
- data/app/assets/stylesheets/rails_admin/base/theming.css.scss +263 -0
- data/app/assets/stylesheets/rails_admin/base/variables.css.scss +1 -0
- data/app/assets/stylesheets/rails_admin/custom/mixins.css.scss +12 -0
- data/app/assets/stylesheets/rails_admin/custom/theming.css.scss +13 -0
- data/app/assets/stylesheets/rails_admin/custom/variables.css.scss +15 -0
- data/app/assets/stylesheets/rails_admin/imports.css.scss.erb +76 -0
- data/app/assets/stylesheets/rails_admin/jquery.colorpicker.css.scss +180 -0
- data/app/assets/stylesheets/rails_admin/jquery.ui.timepicker.css.scss +69 -0
- data/app/assets/stylesheets/rails_admin/ra.calendar-additions.css.scss +25 -0
- data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.css.scss +85 -0
- data/app/assets/stylesheets/rails_admin/rails_admin.css +4 -0
- data/app/assets/stylesheets/rails_admin/themes/default/mixins.css.scss +8 -0
- data/app/assets/stylesheets/rails_admin/themes/default/theming.css.scss +11 -0
- data/app/assets/stylesheets/rails_admin/themes/default/variables.css.scss +12 -0
- data/app/controllers/rails_admin/application_controller.rb +82 -0
- data/app/controllers/rails_admin/main_controller.rb +151 -0
- data/app/helpers/rails_admin/application_helper.rb +123 -0
- data/app/helpers/rails_admin/form_builder.rb +104 -0
- data/app/helpers/rails_admin/main_helper.rb +36 -0
- data/app/views/kaminari/twitter-bootstrap/_gap.html.haml +2 -0
- data/app/views/kaminari/twitter-bootstrap/_next_page.html.haml +4 -0
- data/app/views/kaminari/twitter-bootstrap/_page.html.haml +4 -0
- data/app/views/kaminari/twitter-bootstrap/_paginator.html.haml +10 -0
- data/app/views/kaminari/twitter-bootstrap/_prev_page.html.haml +4 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +12 -0
- data/app/views/layouts/rails_admin/application.html.haml +39 -0
- data/app/views/rails_admin/main/_dashboard_history.html.haml +10 -0
- data/app/views/rails_admin/main/_delete_notice.html.haml +18 -0
- data/app/views/rails_admin/main/_form_colorpicker.html.haml +24 -0
- data/app/views/rails_admin/main/_form_datetime.html.haml +4 -0
- data/app/views/rails_admin/main/_form_enumeration.html.haml +4 -0
- data/app/views/rails_admin/main/_form_field.html.haml +1 -0
- data/app/views/rails_admin/main/_form_file_upload.html.haml +18 -0
- data/app/views/rails_admin/main/_form_filtering_multiselect.html.haml +59 -0
- data/app/views/rails_admin/main/_form_filtering_select.html.haml +47 -0
- data/app/views/rails_admin/main/_form_nested_many.html.haml +41 -0
- data/app/views/rails_admin/main/_form_nested_one.html.haml +35 -0
- data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +34 -0
- data/app/views/rails_admin/main/_form_text.html.haml +9 -0
- data/app/views/rails_admin/main/_submit_buttons.html.haml +15 -0
- data/app/views/rails_admin/main/bulk_delete.html.haml +11 -0
- data/app/views/rails_admin/main/dashboard.html.haml +31 -0
- data/app/views/rails_admin/main/delete.html.haml +18 -0
- data/app/views/rails_admin/main/edit.html.haml +2 -0
- data/app/views/rails_admin/main/export.html.haml +75 -0
- data/app/views/rails_admin/main/history.html.haml +42 -0
- data/app/views/rails_admin/main/index.html.haml +140 -0
- data/app/views/rails_admin/main/new.html.haml +2 -0
- data/app/views/rails_admin/main/show.html.haml +14 -0
- data/config/initializers/active_record_extensions.rb +19 -0
- data/config/initializers/devise_patch.rb +9 -0
- data/config/initializers/haml.rb +2 -0
- data/config/initializers/mongoid_extensions.rb +4 -0
- data/config/locales/fr.yml +24 -0
- data/config/locales/rails_admin.en.yml +130 -0
- data/config/routes.rb +12 -0
- data/lib/generators/rails_admin/install_generator.rb +84 -0
- data/lib/generators/rails_admin/templates/drop.rb +18 -0
- data/lib/generators/rails_admin/templates/initializer.erb +101 -0
- data/lib/generators/rails_admin/templates/migration.rb +18 -0
- data/lib/generators/rails_admin/uninstall_generator.rb +22 -0
- data/lib/generators/rails_admin/utils.rb +30 -0
- data/lib/rails_admin.rb +34 -0
- data/lib/rails_admin/abstract_model.rb +110 -0
- data/lib/rails_admin/adapters/active_record.rb +247 -0
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +32 -0
- data/lib/rails_admin/adapters/mongoid.rb +333 -0
- data/lib/rails_admin/adapters/mongoid/abstract_object.rb +32 -0
- data/lib/rails_admin/adapters/mongoid/extension.rb +27 -0
- data/lib/rails_admin/config.rb +322 -0
- data/lib/rails_admin/config/actions.rb +121 -0
- data/lib/rails_admin/config/actions/base.rb +117 -0
- data/lib/rails_admin/config/actions/bulk_delete.rb +55 -0
- data/lib/rails_admin/config/actions/dashboard.rb +44 -0
- data/lib/rails_admin/config/actions/delete.rb +53 -0
- data/lib/rails_admin/config/actions/edit.rb +60 -0
- data/lib/rails_admin/config/actions/export.rb +40 -0
- data/lib/rails_admin/config/actions/history_index.rb +38 -0
- data/lib/rails_admin/config/actions/history_show.rb +38 -0
- data/lib/rails_admin/config/actions/index.rb +85 -0
- data/lib/rails_admin/config/actions/new.rb +64 -0
- data/lib/rails_admin/config/actions/show.rb +32 -0
- data/lib/rails_admin/config/actions/show_in_app.rb +28 -0
- data/lib/rails_admin/config/configurable.rb +92 -0
- data/lib/rails_admin/config/fields.rb +88 -0
- data/lib/rails_admin/config/fields/association.rb +108 -0
- data/lib/rails_admin/config/fields/base.rb +281 -0
- data/lib/rails_admin/config/fields/factories/belongs_to_association.rb +29 -0
- data/lib/rails_admin/config/fields/factories/carrierwave.rb +31 -0
- data/lib/rails_admin/config/fields/factories/devise.rb +27 -0
- data/lib/rails_admin/config/fields/factories/dragonfly.rb +27 -0
- data/lib/rails_admin/config/fields/factories/enum.rb +11 -0
- data/lib/rails_admin/config/fields/factories/paperclip.rb +26 -0
- data/lib/rails_admin/config/fields/factories/password.rb +17 -0
- data/lib/rails_admin/config/fields/factories/serialized.rb +17 -0
- data/lib/rails_admin/config/fields/group.rb +78 -0
- data/lib/rails_admin/config/fields/types.rb +27 -0
- data/lib/rails_admin/config/fields/types/all.rb +26 -0
- data/lib/rails_admin/config/fields/types/belongs_to_association.rb +41 -0
- data/lib/rails_admin/config/fields/types/boolean.rb +31 -0
- data/lib/rails_admin/config/fields/types/bson_object_id.rb +42 -0
- data/lib/rails_admin/config/fields/types/carrierwave.rb +31 -0
- data/lib/rails_admin/config/fields/types/color.rb +37 -0
- data/lib/rails_admin/config/fields/types/date.rb +24 -0
- data/lib/rails_admin/config/fields/types/datetime.rb +165 -0
- data/lib/rails_admin/config/fields/types/decimal.rb +14 -0
- data/lib/rails_admin/config/fields/types/dragonfly.rb +41 -0
- data/lib/rails_admin/config/fields/types/enum.rb +35 -0
- data/lib/rails_admin/config/fields/types/file_upload.rb +61 -0
- data/lib/rails_admin/config/fields/types/float.rb +14 -0
- data/lib/rails_admin/config/fields/types/has_and_belongs_to_many_association.rb +14 -0
- data/lib/rails_admin/config/fields/types/has_many_association.rb +32 -0
- data/lib/rails_admin/config/fields/types/has_one_association.rb +39 -0
- data/lib/rails_admin/config/fields/types/hidden.rb +21 -0
- data/lib/rails_admin/config/fields/types/integer.rb +22 -0
- data/lib/rails_admin/config/fields/types/mongoid_type.rb +25 -0
- data/lib/rails_admin/config/fields/types/paperclip.rb +28 -0
- data/lib/rails_admin/config/fields/types/password.rb +39 -0
- data/lib/rails_admin/config/fields/types/polymorphic_association.rb +76 -0
- data/lib/rails_admin/config/fields/types/serialized.rb +22 -0
- data/lib/rails_admin/config/fields/types/string.rb +41 -0
- data/lib/rails_admin/config/fields/types/text.rb +36 -0
- data/lib/rails_admin/config/fields/types/time.rb +36 -0
- data/lib/rails_admin/config/fields/types/timestamp.rb +18 -0
- data/lib/rails_admin/config/groupable.rb +18 -0
- data/lib/rails_admin/config/has_fields.rb +135 -0
- data/lib/rails_admin/config/has_groups.rb +23 -0
- data/lib/rails_admin/config/hideable.rb +28 -0
- data/lib/rails_admin/config/model.rb +88 -0
- data/lib/rails_admin/config/proxyable.rb +12 -0
- data/lib/rails_admin/config/proxyable/proxy.rb +43 -0
- data/lib/rails_admin/config/sections.rb +38 -0
- data/lib/rails_admin/config/sections/base.rb +29 -0
- data/lib/rails_admin/config/sections/create.rb +11 -0
- data/lib/rails_admin/config/sections/edit.rb +11 -0
- data/lib/rails_admin/config/sections/export.rb +11 -0
- data/lib/rails_admin/config/sections/list.rb +27 -0
- data/lib/rails_admin/config/sections/nested.rb +10 -0
- data/lib/rails_admin/config/sections/show.rb +10 -0
- data/lib/rails_admin/config/sections/update.rb +10 -0
- data/lib/rails_admin/engine.rb +22 -0
- data/lib/rails_admin/extension.rb +29 -0
- data/lib/rails_admin/extensions/cancan.rb +5 -0
- data/lib/rails_admin/extensions/cancan/authorization_adapter.rb +59 -0
- data/lib/rails_admin/extensions/history.rb +5 -0
- data/lib/rails_admin/extensions/history/auditing_adapter.rb +37 -0
- data/lib/rails_admin/extensions/history/history.rb +69 -0
- data/lib/rails_admin/extensions/paper_trail.rb +5 -0
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +92 -0
- data/lib/rails_admin/i18n_support.rb +43 -0
- data/lib/rails_admin/support/core_extensions.rb +44 -0
- data/lib/rails_admin/support/csv_converter.rb +109 -0
- data/lib/rails_admin/version.rb +6 -0
- data/lib/tasks/prepare_ci_env.rake +27 -0
- data/lib/tasks/rails_admin.rake +18 -0
- data/spec/ci.sh +2 -0
- data/spec/controllers/application_controller_spec.rb +30 -0
- data/spec/controllers/main_controller_spec.rb +180 -0
- data/spec/database_helpers.rb +15 -0
- data/spec/dummy_app/Gemfile +58 -0
- data/spec/dummy_app/Rakefile +7 -0
- data/spec/dummy_app/app/assets/images/rails.png +0 -0
- data/spec/dummy_app/app/assets/javascripts/application.js +15 -0
- data/spec/dummy_app/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy_app/app/controllers/application_controller.rb +3 -0
- data/spec/dummy_app/app/controllers/players_controller.rb +5 -0
- data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_app/app/locales/models.en.yml +16 -0
- data/spec/dummy_app/app/models/abstract.rb +5 -0
- data/spec/dummy_app/app/models/article.rb +9 -0
- data/spec/dummy_app/app/models/author.rb +6 -0
- data/spec/dummy_app/app/models/ball.rb +8 -0
- data/spec/dummy_app/app/models/category.rb +3 -0
- data/spec/dummy_app/app/models/cms.rb +5 -0
- data/spec/dummy_app/app/models/cms/basic_page.rb +7 -0
- data/spec/dummy_app/app/models/cms/unscoped_page.rb +3 -0
- data/spec/dummy_app/app/models/comment.rb +3 -0
- data/spec/dummy_app/app/models/division.rb +12 -0
- data/spec/dummy_app/app/models/draft.rb +11 -0
- data/spec/dummy_app/app/models/fan.rb +5 -0
- data/spec/dummy_app/app/models/field_test.rb +20 -0
- data/spec/dummy_app/app/models/hardball.rb +2 -0
- data/spec/dummy_app/app/models/league.rb +10 -0
- data/spec/dummy_app/app/models/mongoid_field_test.rb +22 -0
- data/spec/dummy_app/app/models/nested_field_test.rb +6 -0
- data/spec/dummy_app/app/models/player.rb +23 -0
- data/spec/dummy_app/app/models/rel_test.rb +6 -0
- data/spec/dummy_app/app/models/tag.rb +7 -0
- data/spec/dummy_app/app/models/team.rb +25 -0
- data/spec/dummy_app/app/models/user.rb +21 -0
- data/spec/dummy_app/app/uploaders/carrierwave_uploader.rb +53 -0
- data/spec/dummy_app/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy_app/app/views/players/show.html.haml +1 -0
- data/spec/dummy_app/config.ru +4 -0
- data/spec/dummy_app/config/application.rb +62 -0
- data/spec/dummy_app/config/boot.rb +6 -0
- data/spec/dummy_app/config/database.yml +25 -0
- data/spec/dummy_app/config/environment.rb +5 -0
- data/spec/dummy_app/config/environments/development.rb +37 -0
- data/spec/dummy_app/config/environments/production.rb +67 -0
- data/spec/dummy_app/config/environments/test.rb +37 -0
- data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_app/config/initializers/devise.rb +148 -0
- data/spec/dummy_app/config/initializers/inflections.rb +15 -0
- data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_app/config/initializers/rails_admin.rb +11 -0
- data/spec/dummy_app/config/initializers/secret_token.rb +7 -0
- data/spec/dummy_app/config/initializers/session_store.rb +8 -0
- data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_app/config/mongoid.yml +17 -0
- data/spec/dummy_app/config/routes.rb +10 -0
- data/spec/dummy_app/db/migrate/00000000000001_create_divisions_migration.rb +13 -0
- data/spec/dummy_app/db/migrate/00000000000002_create_drafts_migration.rb +19 -0
- data/spec/dummy_app/db/migrate/00000000000003_create_leagues_migration.rb +12 -0
- data/spec/dummy_app/db/migrate/00000000000004_create_players_migration.rb +20 -0
- data/spec/dummy_app/db/migrate/00000000000005_create_teams_migration.rb +22 -0
- data/spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb +49 -0
- data/spec/dummy_app/db/migrate/00000000000007_create_histories_table.rb +16 -0
- data/spec/dummy_app/db/migrate/00000000000008_create_fans_migration.rb +12 -0
- data/spec/dummy_app/db/migrate/00000000000009_create_fans_teams_migration.rb +11 -0
- data/spec/dummy_app/db/migrate/00000000000010_add_revenue_to_team_migration.rb +9 -0
- data/spec/dummy_app/db/migrate/00000000000011_add_suspended_to_player_migration.rb +9 -0
- data/spec/dummy_app/db/migrate/00000000000012_add_avatar_columns_to_user.rb +16 -0
- data/spec/dummy_app/db/migrate/00000000000013_add_roles_to_user.rb +9 -0
- data/spec/dummy_app/db/migrate/00000000000014_add_color_to_team_migration.rb +9 -0
- data/spec/dummy_app/db/migrate/20101223222233_create_rel_tests.rb +15 -0
- data/spec/dummy_app/db/migrate/20110103205808_create_comments.rb +15 -0
- data/spec/dummy_app/db/migrate/20110123042530_rename_histories_to_rails_admin_histories.rb +9 -0
- data/spec/dummy_app/db/migrate/20110224184303_create_field_tests.rb +22 -0
- data/spec/dummy_app/db/migrate/20110328193014_create_cms_basic_pages.rb +14 -0
- data/spec/dummy_app/db/migrate/20110329183136_remove_league_id_from_teams.rb +9 -0
- data/spec/dummy_app/db/migrate/20110607152842_add_format_to_field_test.rb +9 -0
- data/spec/dummy_app/db/migrate/20110714095433_create_balls.rb +12 -0
- data/spec/dummy_app/db/migrate/20110831090841_add_protected_field_and_restricted_field_to_field_tests.rb +6 -0
- data/spec/dummy_app/db/migrate/20110901131551_change_division_primary_key.rb +19 -0
- data/spec/dummy_app/db/migrate/20110901142530_rename_league_id_foreign_key_on_divisions.rb +5 -0
- data/spec/dummy_app/db/migrate/20110901150912_set_primary_key_not_null_for_divisions.rb +21 -0
- data/spec/dummy_app/db/migrate/20110901154834_change_length_for_rails_admin_histories.rb +9 -0
- data/spec/dummy_app/db/migrate/20111103174459_create_unscoped_pages.rb +9 -0
- data/spec/dummy_app/db/migrate/20111108143642_add_dragonfly_and_carrierwave_to_field_tests.rb +7 -0
- data/spec/dummy_app/db/migrate/20111115041025_add_type_to_balls.rb +5 -0
- data/spec/dummy_app/db/migrate/20111123092549_create_nested_field_tests.rb +10 -0
- data/spec/dummy_app/db/migrate/20111130075338_add_dragonfly_asset_name_to_field_tests.rb +5 -0
- data/spec/dummy_app/db/migrate/20111215083258_create_foo_bars.rb +8 -0
- data/spec/dummy_app/db/migrate/20120117151733_add_custom_field_to_teams.rb +5 -0
- data/spec/dummy_app/db/migrate/20120118122004_add_categories.rb +7 -0
- data/spec/dummy_app/db/seeds.rb +18 -0
- data/spec/dummy_app/doc/README_FOR_APP +2 -0
- data/spec/dummy_app/public/404.html +26 -0
- data/spec/dummy_app/public/422.html +26 -0
- data/spec/dummy_app/public/500.html +25 -0
- data/spec/dummy_app/public/favicon.ico +0 -0
- data/spec/dummy_app/public/robots.txt +5 -0
- data/spec/dummy_app/public/system/dragonfly/development/2011/11/24/10_36_27_888_Pensive_Parakeet.jpg +0 -0
- data/spec/dummy_app/public/system/dragonfly/development/2011/11/24/10_36_27_888_Pensive_Parakeet.jpg.meta +1 -0
- data/spec/dummy_app/public/system/dragonfly/development/2011/11/30/08_54_39_906_Costa_Rican_Frog.jpg +0 -0
- data/spec/dummy_app/public/system/dragonfly/development/2011/11/30/08_54_39_906_Costa_Rican_Frog.jpg.meta +1 -0
- data/spec/dummy_app/public/system/paperclip_assets/1/original/Boston City Flow.jpg +0 -0
- data/spec/dummy_app/public/system/paperclip_assets/1/thumb/Boston City Flow.jpg +0 -0
- data/spec/dummy_app/public/system/paperclip_assets/3/original/Costa Rican Frog.jpg +0 -0
- data/spec/dummy_app/public/system/paperclip_assets/3/thumb/Costa Rican Frog.jpg +0 -0
- data/spec/dummy_app/public/system/paperclip_assets/6/original/liste-electorale.pdf +0 -0
- data/spec/dummy_app/public/system/paperclip_assets/6/thumb/liste-electorale.pdf +148 -0
- data/spec/dummy_app/public/uploads/field_test/carrierwave_asset/3/Boston_City_Flow.jpg +0 -0
- data/spec/dummy_app/public/uploads/field_test/carrierwave_asset/3/thumb_Boston_City_Flow.jpg +0 -0
- data/spec/dummy_app/public/uploads/field_test/carrierwave_asset/4/Costa_Rican_Frog.jpg +0 -0
- data/spec/dummy_app/public/uploads/field_test/carrierwave_asset/4/thumb_Costa_Rican_Frog.jpg +0 -0
- data/spec/dummy_app/public/uploads/field_test/carrierwave_asset/6/Pensive_Parakeet.jpg +0 -0
- data/spec/dummy_app/public/uploads/field_test/carrierwave_asset/6/thumb_Pensive_Parakeet.jpg +0 -0
- data/spec/dummy_app/script/rails +6 -0
- data/spec/factories.rb +89 -0
- data/spec/helpers/application_helper_spec.rb +277 -0
- data/spec/integration/authorization/cancan_spec.rb +349 -0
- data/spec/integration/basic/bulk_action/rails_admin_basic_bulk_action_spec.rb +25 -0
- data/spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb +44 -0
- data/spec/integration/basic/create/rails_admin_basic_create_spec.rb +154 -0
- data/spec/integration/basic/create/rails_admin_namespaced_model_create_spec.rb +23 -0
- data/spec/integration/basic/delete/rails_admin_basic_delete_spec.rb +27 -0
- data/spec/integration/basic/destroy/rails_admin_basic_destroy_spec.rb +56 -0
- data/spec/integration/basic/edit/rails_admin_basic_edit_spec.rb +109 -0
- data/spec/integration/basic/export/rails_admin_basic_export_spec.rb +87 -0
- data/spec/integration/basic/list/rails_admin_basic_list_spec.rb +392 -0
- data/spec/integration/basic/new/rails_admin_basic_new_spec.rb +74 -0
- data/spec/integration/basic/new/rails_admin_namespaced_model_new_spec.rb +31 -0
- data/spec/integration/basic/show/rails_admin_basic_show_spec.rb +91 -0
- data/spec/integration/basic/update/rails_admin_basic_update_spec.rb +219 -0
- data/spec/integration/config/edit/rails_admin_config_edit_spec.rb +954 -0
- data/spec/integration/config/list/rails_admin_config_list_spec.rb +509 -0
- data/spec/integration/config/show/rails_admin_config_show_spec.rb +302 -0
- data/spec/integration/history/rails_admin_history_spec.rb +66 -0
- data/spec/integration/rails_admin_spec.rb +113 -0
- data/spec/integration/relation_spec.rb +26 -0
- data/spec/spec_helper.rb +86 -0
- data/spec/support/tableless.rb +27 -0
- data/spec/unit/adapters/active_record/abstract_object_spec.rb +131 -0
- data/spec/unit/adapters/active_record_spec.rb +373 -0
- data/spec/unit/adapters/mongoid/abstract_object_spec.rb +30 -0
- data/spec/unit/adapters/mongoid_spec.rb +581 -0
- data/spec/unit/config/actions_spec.rb +181 -0
- data/spec/unit/config/fields/base_spec.rb +300 -0
- data/spec/unit/config/model_spec.rb +75 -0
- data/spec/unit/config/sections_spec.rb +123 -0
- data/spec/unit/config_spec.rb +273 -0
- metadata +823 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'rails_admin/config'
|
2
|
+
require 'rails_admin/config/fields/base'
|
3
|
+
|
4
|
+
module RailsAdmin
|
5
|
+
module Config
|
6
|
+
module Fields
|
7
|
+
class Association < RailsAdmin::Config::Fields::Base
|
8
|
+
|
9
|
+
def self.inherited(klass)
|
10
|
+
super(klass)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Reader for the association information hash
|
14
|
+
def association
|
15
|
+
@properties
|
16
|
+
end
|
17
|
+
|
18
|
+
register_instance_option(:pretty_value) do
|
19
|
+
v = bindings[:view]
|
20
|
+
[value].flatten.select(&:present?).map do |associated|
|
21
|
+
amc = polymorphic? ? RailsAdmin::Config.model(associated) : associated_model_config # perf optimization for non-polymorphic associations
|
22
|
+
am = amc.abstract_model
|
23
|
+
wording = associated.send(amc.object_label_method)
|
24
|
+
can_see = v.authorized?(:show, am, associated)
|
25
|
+
can_see = can_see && (show_action = RailsAdmin::Config::Actions.find(:show, { :controller => v.controller, :abstract_model => am, :object => associated }))
|
26
|
+
can_see ? v.link_to(wording, v.url_for(:action => show_action.action_name, :model_name => am.to_param, :id => associated.id)) : wording
|
27
|
+
end.to_sentence.html_safe
|
28
|
+
end
|
29
|
+
|
30
|
+
# Accessor whether association is visible or not. By default
|
31
|
+
# association checks whether the child model is excluded in
|
32
|
+
# configuration or not.
|
33
|
+
register_instance_option(:visible?) do
|
34
|
+
@visible ||= !self.associated_model_config.excluded?
|
35
|
+
end
|
36
|
+
|
37
|
+
# use the association name as a key, not the association key anymore!
|
38
|
+
register_instance_option(:label) do
|
39
|
+
(@label ||= {})[::I18n.locale] ||= abstract_model.model.human_attribute_name association[:name]
|
40
|
+
end
|
41
|
+
|
42
|
+
# scope for possible associable records
|
43
|
+
register_instance_option :associated_collection_scope do
|
44
|
+
# bindings[:object] & bindings[:controller] available
|
45
|
+
associated_collection_scope_limit = (self.associated_collection_cache_all ? nil : 30)
|
46
|
+
Proc.new do |scope|
|
47
|
+
scope.limit(associated_collection_scope_limit)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# preload entire associated collection (per associated_collection_scope) on load
|
52
|
+
# Be sure to set limit in associated_collection_scope if set is large
|
53
|
+
register_instance_option :associated_collection_cache_all do
|
54
|
+
@associated_collection_cache_all ||= (associated_model_config.abstract_model.count < 100)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Reader for the association's child model's configuration
|
58
|
+
def associated_model_config
|
59
|
+
@associated_model_config ||= RailsAdmin.config(association[:model_proc].call)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Reader for the association's child model object's label method
|
63
|
+
def associated_object_label_method
|
64
|
+
@associated_object_label_method ||= associated_model_config.object_label_method
|
65
|
+
end
|
66
|
+
|
67
|
+
# Reader for associated primary key
|
68
|
+
def associated_primary_key
|
69
|
+
@associated_primary_key ||= association[:primary_key_proc].call
|
70
|
+
end
|
71
|
+
|
72
|
+
# Reader for the association's key
|
73
|
+
def foreign_key
|
74
|
+
association[:foreign_key]
|
75
|
+
end
|
76
|
+
|
77
|
+
# Reader for the inverse relationship
|
78
|
+
def inverse_of
|
79
|
+
association[:inverse_of]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Reader whether this is a polymorphic association
|
83
|
+
def polymorphic?
|
84
|
+
association[:polymorphic]
|
85
|
+
end
|
86
|
+
|
87
|
+
# Reader for nested attributes
|
88
|
+
register_instance_option :nested_form do
|
89
|
+
association[:nested_form]
|
90
|
+
end
|
91
|
+
|
92
|
+
# Reader for the association's value unformatted
|
93
|
+
def value
|
94
|
+
bindings[:object].send(association[:name])
|
95
|
+
end
|
96
|
+
|
97
|
+
# has many?
|
98
|
+
def multiple?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
def virtual?
|
103
|
+
true
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,281 @@
|
|
1
|
+
require 'rails_admin/config/proxyable'
|
2
|
+
require 'rails_admin/config/configurable'
|
3
|
+
require 'rails_admin/config/hideable'
|
4
|
+
require 'rails_admin/config/groupable'
|
5
|
+
|
6
|
+
module RailsAdmin
|
7
|
+
module Config
|
8
|
+
module Fields
|
9
|
+
class Base
|
10
|
+
include RailsAdmin::Config::Proxyable
|
11
|
+
include RailsAdmin::Config::Configurable
|
12
|
+
include RailsAdmin::Config::Hideable
|
13
|
+
include RailsAdmin::Config::Groupable
|
14
|
+
|
15
|
+
attr_reader :name, :properties, :abstract_model
|
16
|
+
attr_accessor :defined, :order, :section
|
17
|
+
attr_reader :parent, :root
|
18
|
+
|
19
|
+
def initialize(parent, name, properties)
|
20
|
+
@parent = parent
|
21
|
+
@root = parent.root
|
22
|
+
|
23
|
+
@abstract_model = parent.abstract_model
|
24
|
+
@defined = false
|
25
|
+
@name = name
|
26
|
+
@order = 0
|
27
|
+
@properties = properties
|
28
|
+
@section = parent
|
29
|
+
end
|
30
|
+
|
31
|
+
register_instance_option :css_class do
|
32
|
+
"#{self.name}_field"
|
33
|
+
end
|
34
|
+
|
35
|
+
def type_css_class
|
36
|
+
"#{type}_type"
|
37
|
+
end
|
38
|
+
|
39
|
+
def virtual?
|
40
|
+
properties.blank?
|
41
|
+
end
|
42
|
+
|
43
|
+
register_instance_option :column_width do
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
|
47
|
+
register_instance_option :sortable do
|
48
|
+
!virtual? || children_fields.first || false
|
49
|
+
end
|
50
|
+
|
51
|
+
register_instance_option :searchable do
|
52
|
+
!virtual? || children_fields.first || false
|
53
|
+
end
|
54
|
+
|
55
|
+
register_instance_option :queryable? do
|
56
|
+
!virtual?
|
57
|
+
end
|
58
|
+
|
59
|
+
register_instance_option :filterable? do
|
60
|
+
!!searchable
|
61
|
+
end
|
62
|
+
|
63
|
+
register_instance_option :search_operator do
|
64
|
+
@search_operator ||= RailsAdmin::Config.default_search_operator
|
65
|
+
end
|
66
|
+
|
67
|
+
# serials and dates are reversed in list, which is more natural (last modified items first).
|
68
|
+
register_instance_option :sort_reverse? do
|
69
|
+
false
|
70
|
+
end
|
71
|
+
|
72
|
+
# list of columns I should search for that field [{ :column => 'table_name.column', :type => field.type }, {..}]
|
73
|
+
register_instance_option :searchable_columns do
|
74
|
+
@searchable_columns ||= case self.searchable
|
75
|
+
when true
|
76
|
+
[{ :column => "#{self.abstract_model.table_name}.#{self.name}", :type => self.type }]
|
77
|
+
when false
|
78
|
+
[]
|
79
|
+
when :all # valid only for associations
|
80
|
+
table_name = self.associated_model_config.abstract_model.table_name
|
81
|
+
self.associated_model_config.list.fields.map { |f| { :column => "#{table_name}.#{f.name}", :type => f.type } }
|
82
|
+
else
|
83
|
+
[self.searchable].flatten.map do |f|
|
84
|
+
if f.is_a?(String) && f.include?('.') # table_name.column
|
85
|
+
table_name, column = f.split '.'
|
86
|
+
type = nil
|
87
|
+
elsif f.is_a?(Hash) # <Model|table_name> => <attribute|column>
|
88
|
+
am = f.keys.first.is_a?(Class) && AbstractModel.new(f.keys.first)
|
89
|
+
table_name = am && am.table_name || f.keys.first
|
90
|
+
column = f.values.first
|
91
|
+
property = am && am.properties.find{ |p| p[:name] == f.values.first.to_sym }
|
92
|
+
type = property && property[:type]
|
93
|
+
else # <attribute|column>
|
94
|
+
am = (self.association? ? self.associated_model_config.abstract_model : self.abstract_model)
|
95
|
+
table_name = am.table_name
|
96
|
+
column = f
|
97
|
+
property = am.properties.find{ |p| p[:name] == f.to_sym }
|
98
|
+
type = property && property[:type]
|
99
|
+
end
|
100
|
+
|
101
|
+
{ :column => "#{table_name}.#{column}", :type => (type || :string) }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
register_instance_option :formatted_value do
|
107
|
+
value.to_s
|
108
|
+
end
|
109
|
+
|
110
|
+
# output for pretty printing (show, list)
|
111
|
+
register_instance_option :pretty_value do
|
112
|
+
formatted_value.presence || ' - '
|
113
|
+
end
|
114
|
+
|
115
|
+
# output for printing in export view (developers beware: no bindings[:view] and no data!)
|
116
|
+
register_instance_option :export_value do
|
117
|
+
pretty_value
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
# Accessor for field's help text displayed below input field.
|
122
|
+
register_instance_option :help do
|
123
|
+
(@help ||= {})[::I18n.locale] ||= (required? ? I18n.translate("admin.form.required") : I18n.translate("admin.form.optional")) + '. '
|
124
|
+
end
|
125
|
+
|
126
|
+
register_instance_option :html_attributes do
|
127
|
+
{}
|
128
|
+
end
|
129
|
+
|
130
|
+
register_instance_option :default_value do
|
131
|
+
nil
|
132
|
+
end
|
133
|
+
|
134
|
+
# Accessor for field's label.
|
135
|
+
#
|
136
|
+
# @see RailsAdmin::AbstractModel.properties
|
137
|
+
register_instance_option :label do
|
138
|
+
(@label ||= {})[::I18n.locale] ||= abstract_model.model.human_attribute_name name
|
139
|
+
end
|
140
|
+
|
141
|
+
# Accessor for field's maximum length per database.
|
142
|
+
#
|
143
|
+
# @see RailsAdmin::AbstractModel.properties
|
144
|
+
register_instance_option :length do
|
145
|
+
@length ||= properties && properties[:length]
|
146
|
+
end
|
147
|
+
|
148
|
+
# Accessor for field's length restrictions per validations
|
149
|
+
#
|
150
|
+
register_instance_option :valid_length do
|
151
|
+
@valid_length ||= abstract_model.model.validators_on(name).find{|v|
|
152
|
+
v.is_a?(ActiveModel::Validations::LengthValidator)}.try{|v| v.options} || {}
|
153
|
+
end
|
154
|
+
|
155
|
+
register_instance_option :partial do
|
156
|
+
:form_field
|
157
|
+
end
|
158
|
+
|
159
|
+
# Accessor for whether this is field is mandatory.
|
160
|
+
#
|
161
|
+
# @see RailsAdmin::AbstractModel.properties
|
162
|
+
register_instance_option :required? do
|
163
|
+
@required ||= !!([name] + children_fields).uniq.find do |column_name|
|
164
|
+
!!abstract_model.model.validators_on(column_name).find do |v|
|
165
|
+
v.is_a?(ActiveModel::Validations::PresenceValidator) && !v.options[:allow_nil] ||
|
166
|
+
v.is_a?(ActiveModel::Validations::NumericalityValidator) && !v.options[:allow_nil]
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Accessor for whether this is a serial field (aka. primary key, identifier).
|
172
|
+
#
|
173
|
+
# @see RailsAdmin::AbstractModel.properties
|
174
|
+
register_instance_option :serial? do
|
175
|
+
properties && properties[:serial?]
|
176
|
+
end
|
177
|
+
|
178
|
+
register_instance_option :view_helper do
|
179
|
+
:text_field
|
180
|
+
end
|
181
|
+
|
182
|
+
register_instance_option :read_only? do
|
183
|
+
not editable?
|
184
|
+
end
|
185
|
+
|
186
|
+
# init status in the view
|
187
|
+
register_instance_option :active? do
|
188
|
+
false
|
189
|
+
end
|
190
|
+
|
191
|
+
register_instance_option :visible? do
|
192
|
+
returned = true
|
193
|
+
(RailsAdmin.config.default_hidden_fields || {}).each do |section, fields|
|
194
|
+
if self.section.is_a?("RailsAdmin::Config::Sections::#{section.to_s.camelize}".constantize)
|
195
|
+
returned = false if fields.include?(self.name)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
returned
|
199
|
+
end
|
200
|
+
|
201
|
+
# columns mapped (belongs_to, paperclip, etc.). First one is used for searching/sorting by default
|
202
|
+
register_instance_option :children_fields do
|
203
|
+
[]
|
204
|
+
end
|
205
|
+
|
206
|
+
register_instance_option :render do
|
207
|
+
bindings[:view].render :partial => partial.to_s, :locals => {:field => self, :form => bindings[:form] }
|
208
|
+
end
|
209
|
+
|
210
|
+
def editable?
|
211
|
+
return false if @properties && @properties[:read_only]
|
212
|
+
!bindings[:object].class.active_authorizer[bindings[:view].controller.send(:_attr_accessible_role)].deny?(self.method_name)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Is this an association
|
216
|
+
def association?
|
217
|
+
kind_of?(RailsAdmin::Config::Fields::Association)
|
218
|
+
end
|
219
|
+
|
220
|
+
# Reader for validation errors of the bound object
|
221
|
+
def errors
|
222
|
+
([name] + children_fields).uniq.map do |column_name|
|
223
|
+
bindings[:object].errors[column_name]
|
224
|
+
end.uniq.flatten
|
225
|
+
end
|
226
|
+
|
227
|
+
# Reader whether field is optional.
|
228
|
+
#
|
229
|
+
# @see RailsAdmin::Config::Fields::Base.register_instance_option(:required?)
|
230
|
+
def optional?
|
231
|
+
not required?
|
232
|
+
end
|
233
|
+
|
234
|
+
# Inverse accessor whether this field is required.
|
235
|
+
#
|
236
|
+
# @see RailsAdmin::Config::Fields::Base.register_instance_option(:required?)
|
237
|
+
def optional(state = nil, &block)
|
238
|
+
if !state.nil? || block
|
239
|
+
required state.nil? ? proc { false == (instance_eval &block) } : false == state
|
240
|
+
else
|
241
|
+
optional?
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Writer to make field optional.
|
246
|
+
#
|
247
|
+
# @see RailsAdmin::Config::Fields::Base.optional
|
248
|
+
def optional=(state)
|
249
|
+
optional(state)
|
250
|
+
end
|
251
|
+
|
252
|
+
# Reader for field's type
|
253
|
+
def type
|
254
|
+
@type ||= self.class.name.to_s.demodulize.underscore.to_sym
|
255
|
+
end
|
256
|
+
|
257
|
+
# Reader for field's value
|
258
|
+
def value
|
259
|
+
bindings[:object].safe_send(name)
|
260
|
+
end
|
261
|
+
|
262
|
+
# Reader for nested attributes
|
263
|
+
register_instance_option :nested_form do
|
264
|
+
false
|
265
|
+
end
|
266
|
+
|
267
|
+
def inverse_of
|
268
|
+
nil
|
269
|
+
end
|
270
|
+
|
271
|
+
def method_name
|
272
|
+
name
|
273
|
+
end
|
274
|
+
|
275
|
+
def html_default_value
|
276
|
+
bindings[:object].new_record? && self.value.nil? && !self.default_value.nil? ? self.default_value : nil
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails_admin/config/fields'
|
2
|
+
require 'rails_admin/config/fields/types'
|
3
|
+
require 'rails_admin/config/fields/types/belongs_to_association'
|
4
|
+
|
5
|
+
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
6
|
+
if association = parent.abstract_model.associations.find {|a| a[:foreign_key] == properties[:name] }
|
7
|
+
field = RailsAdmin::Config::Fields::Types.load("#{association[:polymorphic] ? :polymorphic : association[:type]}_association").new(parent, association[:name], association)
|
8
|
+
fields << field
|
9
|
+
|
10
|
+
child_columns = []
|
11
|
+
id_column = parent.abstract_model.properties.find {|p| p[:name].to_s == association[:foreign_key].to_s }
|
12
|
+
child_columns << RailsAdmin::Config::Fields.default_factory.call(parent, id_column, fields)
|
13
|
+
|
14
|
+
if association[:polymorphic]
|
15
|
+
type_colum = parent.abstract_model.properties.find {|p| p[:name].to_s == association[:foreign_type].to_s }
|
16
|
+
unless type_field = fields.find{|f| f.name.to_s == type_colum[:name].to_s }
|
17
|
+
type_field = RailsAdmin::Config::Fields.default_factory.call(parent, type_colum, fields)
|
18
|
+
end
|
19
|
+
child_columns << type_field
|
20
|
+
end
|
21
|
+
|
22
|
+
child_columns.each do |child_column|
|
23
|
+
child_column.hide
|
24
|
+
child_column.filterable(false)
|
25
|
+
end
|
26
|
+
|
27
|
+
field.children_fields child_columns.map(&:name)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rails_admin/config/fields'
|
2
|
+
require 'rails_admin/config/fields/types'
|
3
|
+
require 'rails_admin/config/fields/types/file_upload'
|
4
|
+
|
5
|
+
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
6
|
+
extensions = [nil, :file_name]
|
7
|
+
model = parent.abstract_model.model
|
8
|
+
|
9
|
+
if defined?(::CarrierWave) && (model = parent.abstract_model.model).kind_of?(CarrierWave::Mount) && model.uploaders.include?(attachment_name = properties[:name].to_s.chomp('_file_name').to_sym)
|
10
|
+
|
11
|
+
|
12
|
+
columns = [model.uploader_options[attachment_name][:mount_on] || attachment_name, "#{attachment_name}_content_type".to_sym, "#{attachment_name}_file_size".to_sym]
|
13
|
+
|
14
|
+
field = RailsAdmin::Config::Fields::Types.load(:carrierwave).new(parent, attachment_name, properties)
|
15
|
+
fields << field
|
16
|
+
children_fields = []
|
17
|
+
columns.each do |children_column_name|
|
18
|
+
if child_properties = parent.abstract_model.properties.find {|p| p[:name].to_s == children_column_name.to_s }
|
19
|
+
children_field = fields.find{ |f| f.name == children_column_name } || RailsAdmin::Config::Fields.default_factory.call(parent, child_properties, fields)
|
20
|
+
children_field.hide unless field == children_field
|
21
|
+
children_field.filterable(false) unless field == children_field
|
22
|
+
children_fields << children_field.name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
field.children_fields(children_fields)
|
26
|
+
|
27
|
+
true
|
28
|
+
else
|
29
|
+
false
|
30
|
+
end
|
31
|
+
end
|