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,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RailsAdmin::Config::Model do
|
4
|
+
|
5
|
+
describe "#excluded?" do
|
6
|
+
before do
|
7
|
+
RailsAdmin.config do |config|
|
8
|
+
config.included_models = [Comment]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should say false when included, true otherwise" do
|
13
|
+
RailsAdmin.config(Player).excluded?.should == true
|
14
|
+
RailsAdmin.config(Comment).excluded?.should == false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#object_label" do
|
19
|
+
before do
|
20
|
+
RailsAdmin.config(Comment) do
|
21
|
+
object_label_method :content
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should send object_label_method to binding[:object]" do
|
26
|
+
c = Comment.new(:content => 'test')
|
27
|
+
RailsAdmin.config(Comment).with(:object => c).object_label.should == 'test'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#object_label_method" do
|
32
|
+
it "should be first of Config.label_methods if found as a column on model, or :rails_admin_default_object_label_method" do
|
33
|
+
RailsAdmin.config(Comment).object_label_method.should == :rails_admin_default_object_label_method
|
34
|
+
RailsAdmin.config(Division).object_label_method.should == :name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#label" do
|
39
|
+
it "should be pretty" do
|
40
|
+
RailsAdmin.config(Comment).label.should == 'Comment'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#label_plural" do
|
45
|
+
it "should be pretty" do
|
46
|
+
RailsAdmin.config(Comment).label_plural.should == 'Comments'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#weight" do
|
51
|
+
it "should be 0" do
|
52
|
+
RailsAdmin.config(Comment).weight.should == 0
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#parent" do
|
57
|
+
it "should be nil for ActiveRecord::Base inherited models" do
|
58
|
+
RailsAdmin.config(Comment).parent.should be_nil
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should be parent model otherwise" do
|
62
|
+
RailsAdmin.config(Hardball).parent.should == Ball
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "#navigation_label" do
|
67
|
+
it "should be nil if parent module is Object" do
|
68
|
+
RailsAdmin.config(Comment).navigation_label.should be_nil
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should be parent module otherwise" do
|
72
|
+
RailsAdmin.config(Cms::BasicPage).navigation_label.should == "Cms"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RailsAdmin::Config::Sections do
|
4
|
+
|
5
|
+
describe "configure" do
|
6
|
+
it "should configure without changing the section default list" do
|
7
|
+
RailsAdmin.config Team do
|
8
|
+
edit do
|
9
|
+
configure :name do
|
10
|
+
label "Renamed"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
fields = RailsAdmin.config(Team).edit.fields
|
15
|
+
fields.find{|f| f.name == :name }.label.should == "Renamed"
|
16
|
+
fields.count.should >= 19 # not 1
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should not change the section list if set" do
|
20
|
+
RailsAdmin.config Team do
|
21
|
+
edit do
|
22
|
+
field :manager
|
23
|
+
configure :name do
|
24
|
+
label "Renamed"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
fields = RailsAdmin.config(Team).edit.fields
|
29
|
+
fields.first.name.should == :manager
|
30
|
+
fields.count.should == 1 # not 19
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "DSL field inheritance" do
|
35
|
+
it 'should be tested' do
|
36
|
+
RailsAdmin.config do |config|
|
37
|
+
config.model Fan do
|
38
|
+
field :name do
|
39
|
+
label do
|
40
|
+
@label ||= "modified base #{label}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
list do
|
44
|
+
field :name do
|
45
|
+
label do
|
46
|
+
@label ||= "modified list #{label}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
edit do
|
51
|
+
field :name do
|
52
|
+
label do
|
53
|
+
@label ||= "modified edit #{label}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
create do
|
58
|
+
field :name do
|
59
|
+
label do
|
60
|
+
@label ||= "modified create #{label}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
RailsAdmin.config(Fan).visible_fields.count.should == 1
|
68
|
+
RailsAdmin.config(Fan).visible_fields.first.label.should == 'modified base His Name'
|
69
|
+
RailsAdmin.config(Fan).list.visible_fields.first.label.should == 'modified list His Name'
|
70
|
+
RailsAdmin.config(Fan).export.visible_fields.first.label.should == 'modified base His Name'
|
71
|
+
RailsAdmin.config(Fan).edit.visible_fields.first.label.should == 'modified edit His Name'
|
72
|
+
RailsAdmin.config(Fan).create.visible_fields.first.label.should == 'modified create His Name'
|
73
|
+
RailsAdmin.config(Fan).update.visible_fields.first.label.should == 'modified edit His Name'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "DSL group inheritance" do
|
78
|
+
it 'should be tested' do
|
79
|
+
RailsAdmin.config do |config|
|
80
|
+
config.model Team do
|
81
|
+
list do
|
82
|
+
group "a" do
|
83
|
+
field :founded
|
84
|
+
end
|
85
|
+
|
86
|
+
group "b" do
|
87
|
+
field :name
|
88
|
+
field :wins
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
edit do
|
93
|
+
group "a" do
|
94
|
+
field :name
|
95
|
+
end
|
96
|
+
|
97
|
+
group "c" do
|
98
|
+
field :founded
|
99
|
+
field :wins
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
update do
|
104
|
+
group "d" do
|
105
|
+
field :wins
|
106
|
+
end
|
107
|
+
|
108
|
+
group "e" do
|
109
|
+
field :losses
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
RailsAdmin.config(Team).list.visible_groups.map{|g| g.visible_fields.map(&:name) }.should == [[:founded], [:name, :wins]]
|
116
|
+
RailsAdmin.config(Team).edit.visible_groups.map{|g| g.visible_fields.map(&:name) }.should == [[:name], [:founded, :wins]]
|
117
|
+
RailsAdmin.config(Team).create.visible_groups.map{|g| g.visible_fields.map(&:name) }.should == [[:name], [:founded, :wins]]
|
118
|
+
RailsAdmin.config(Team).update.visible_groups.map{|g| g.visible_fields.map(&:name) }.should == [[:name], [:founded], [:wins], [:losses]]
|
119
|
+
RailsAdmin.config(Team).visible_groups.map{|g| g.visible_fields.map(&:name) }.flatten.count.should == 19
|
120
|
+
RailsAdmin.config(Team).export.visible_groups.map{|g| g.visible_fields.map(&:name) }.flatten.count.should == 19
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,273 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rails_admin/extensions/history/history'
|
3
|
+
|
4
|
+
describe RailsAdmin::Config do
|
5
|
+
|
6
|
+
describe ".included_models" do
|
7
|
+
|
8
|
+
it 'should only use included models' do
|
9
|
+
RailsAdmin.config.included_models = [Team, League]
|
10
|
+
RailsAdmin::AbstractModel.all.map(&:model).should == [League, Team] #it gets sorted
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should not restrict models if included_models is left empty' do
|
14
|
+
RailsAdmin.config.included_models = []
|
15
|
+
RailsAdmin::AbstractModel.all.map(&:model).should include(Team, League)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should further remove excluded models (whitelist - blacklist)' do
|
19
|
+
RailsAdmin.config.excluded_models = [Team]
|
20
|
+
RailsAdmin.config.included_models = [Team, League]
|
21
|
+
RailsAdmin::AbstractModel.all.map(&:model).should == [League]
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should always exclude history' do
|
25
|
+
RailsAdmin::AbstractModel.all.map(&:model).should_not include(RailsAdmin::History)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'excluded? returns true for any model not on the list' do
|
29
|
+
RailsAdmin.config.included_models = [Team, League]
|
30
|
+
|
31
|
+
team_config = RailsAdmin::AbstractModel.new('Team').config
|
32
|
+
fan_config = RailsAdmin::AbstractModel.new('Fan').config
|
33
|
+
|
34
|
+
fan_config.should be_excluded
|
35
|
+
team_config.should_not be_excluded
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
describe ".add_extension" do
|
41
|
+
before do
|
42
|
+
silence_warnings do
|
43
|
+
RailsAdmin::EXTENSIONS = []
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "registers the extension with RailsAdmin" do
|
48
|
+
RailsAdmin.add_extension(:example, ExampleModule)
|
49
|
+
RailsAdmin::EXTENSIONS.select { |name| name == :example }.length.should == 1
|
50
|
+
end
|
51
|
+
|
52
|
+
context "given an extension with an authorization adapter" do
|
53
|
+
it "registers the adapter" do
|
54
|
+
RailsAdmin.add_extension(:example, ExampleModule, {
|
55
|
+
:authorization => true
|
56
|
+
})
|
57
|
+
RailsAdmin::AUTHORIZATION_ADAPTERS[:example].should == ExampleModule::AuthorizationAdapter
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "given an extension with an auditing adapter" do
|
62
|
+
it "registers the adapter" do
|
63
|
+
RailsAdmin.add_extension(:example, ExampleModule, {
|
64
|
+
:auditing => true
|
65
|
+
})
|
66
|
+
RailsAdmin::AUDITING_ADAPTERS[:example].should == ExampleModule::AuditingAdapter
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "given an extension with a configuration adapter" do
|
71
|
+
it "registers the adapter" do
|
72
|
+
RailsAdmin.add_extension(:example, ExampleModule, {
|
73
|
+
:configuration => true
|
74
|
+
})
|
75
|
+
RailsAdmin::CONFIGURATION_ADAPTERS[:example].should == ExampleModule::ConfigurationAdapter
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe ".attr_accessible_role" do
|
81
|
+
it "sould be :default by default" do
|
82
|
+
RailsAdmin.config.attr_accessible_role.call.should == :default
|
83
|
+
end
|
84
|
+
|
85
|
+
it "sould be configurable with user role for example" do
|
86
|
+
RailsAdmin.config do |config|
|
87
|
+
config.attr_accessible_role do
|
88
|
+
:admin
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
RailsAdmin.config.attr_accessible_role.call.should == :admin
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe ".main_app_name" do
|
97
|
+
|
98
|
+
it "as a default meaningful dynamic value" do
|
99
|
+
RailsAdmin.config.main_app_name.call.should == ['Dummy App', 'Admin']
|
100
|
+
end
|
101
|
+
|
102
|
+
it "can be configured" do
|
103
|
+
RailsAdmin.config do |config|
|
104
|
+
config.main_app_name = ['static','value']
|
105
|
+
end
|
106
|
+
RailsAdmin.config.main_app_name.should == ['static','value']
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe ".authorize_with" do
|
111
|
+
context "given a key for a extension with authorization" do
|
112
|
+
before do
|
113
|
+
RailsAdmin.add_extension(:example, ExampleModule, {
|
114
|
+
:authorization => true
|
115
|
+
})
|
116
|
+
end
|
117
|
+
|
118
|
+
it "initializes the authorization adapter" do
|
119
|
+
ExampleModule::AuthorizationAdapter.should_receive(:new).with(RailsAdmin::Config)
|
120
|
+
RailsAdmin.config do |config|
|
121
|
+
config.authorize_with(:example)
|
122
|
+
end
|
123
|
+
RailsAdmin.config.authorize_with.call
|
124
|
+
end
|
125
|
+
|
126
|
+
it "passes through any additional arguments to the initializer" do
|
127
|
+
options = { :option => true }
|
128
|
+
ExampleModule::AuthorizationAdapter.should_receive(:new).with(RailsAdmin::Config, options)
|
129
|
+
RailsAdmin.config do |config|
|
130
|
+
config.authorize_with(:example, options)
|
131
|
+
end
|
132
|
+
RailsAdmin.config.authorize_with.call
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe ".audit_with" do
|
138
|
+
context "given a key for a extension with auditing" do
|
139
|
+
before do
|
140
|
+
RailsAdmin.add_extension(:example, ExampleModule, {
|
141
|
+
:auditing => true
|
142
|
+
})
|
143
|
+
end
|
144
|
+
|
145
|
+
it "initializes the auditing adapter" do
|
146
|
+
ExampleModule::AuditingAdapter.should_receive(:new).with(RailsAdmin::Config)
|
147
|
+
RailsAdmin.config do |config|
|
148
|
+
config.audit_with(:example)
|
149
|
+
end
|
150
|
+
RailsAdmin.config.audit_with.call
|
151
|
+
end
|
152
|
+
|
153
|
+
it "passes through any additional arguments to the initializer" do
|
154
|
+
options = { :option => true }
|
155
|
+
ExampleModule::AuditingAdapter.should_receive(:new).with(RailsAdmin::Config, options)
|
156
|
+
RailsAdmin.config do |config|
|
157
|
+
config.audit_with(:example, options)
|
158
|
+
end
|
159
|
+
RailsAdmin.config.audit_with.call
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
context "given paper_trail as the extension for auditing" do
|
164
|
+
before do
|
165
|
+
RailsAdmin.add_extension(:example, RailsAdmin::Extensions::PaperTrail, {
|
166
|
+
:auditing => true
|
167
|
+
})
|
168
|
+
end
|
169
|
+
|
170
|
+
it "initializes the auditing adapter" do
|
171
|
+
RailsAdmin.config do |config|
|
172
|
+
config.audit_with(:example)
|
173
|
+
end
|
174
|
+
RailsAdmin.config.audit_with.call.should_not raise_exception ArgumentError
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
describe ".configure_with" do
|
181
|
+
context "given a key for a extension with configuration" do
|
182
|
+
before do
|
183
|
+
RailsAdmin.add_extension(:example, ExampleModule, {
|
184
|
+
:configuration => true
|
185
|
+
})
|
186
|
+
end
|
187
|
+
|
188
|
+
it "initializes configuration adapter" do
|
189
|
+
ExampleModule::ConfigurationAdapter.should_receive(:new)
|
190
|
+
RailsAdmin.config do |config|
|
191
|
+
config.configure_with(:example)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
it "yields the (optionally) provided block, passing the initialized adapter" do
|
196
|
+
configurator = nil
|
197
|
+
RailsAdmin.config do |config|
|
198
|
+
config.configure_with(:example) do |configuration_adapter|
|
199
|
+
configurator = configuration_adapter
|
200
|
+
end
|
201
|
+
end
|
202
|
+
configurator.should be_a(ExampleModule::ConfigurationAdapter)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
describe ".config" do
|
208
|
+
context ".default_search_operator" do
|
209
|
+
it "sets the default_search_operator" do
|
210
|
+
RailsAdmin.config do |config|
|
211
|
+
config.default_search_operator = 'starts_with'
|
212
|
+
end
|
213
|
+
RailsAdmin::Config.default_search_operator.should == 'starts_with'
|
214
|
+
end
|
215
|
+
|
216
|
+
it "errors on unrecognized search operator" do
|
217
|
+
expect do
|
218
|
+
RailsAdmin.config do |config|
|
219
|
+
config.default_search_operator = 'random'
|
220
|
+
end
|
221
|
+
end.to raise_error(ArgumentError, "Search operator 'random' not supported")
|
222
|
+
end
|
223
|
+
|
224
|
+
it "defaults to 'default'" do
|
225
|
+
RailsAdmin::Config.default_search_operator.should == 'default'
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
describe '.visible_models' do
|
231
|
+
it 'passes controller bindings, find visible models, order them' do
|
232
|
+
RailsAdmin.config do |config|
|
233
|
+
config.included_models = [Player, Fan, Comment, Team]
|
234
|
+
|
235
|
+
config.model Player do
|
236
|
+
hide
|
237
|
+
end
|
238
|
+
config.model Fan do
|
239
|
+
weight -1
|
240
|
+
show
|
241
|
+
end
|
242
|
+
config.model Comment do
|
243
|
+
visible do
|
244
|
+
bindings[:controller]._current_user.role == :admin
|
245
|
+
end
|
246
|
+
end
|
247
|
+
config.model Team do
|
248
|
+
visible do
|
249
|
+
bindings[:controller]._current_user.role != :admin
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
RailsAdmin.config.visible_models(:controller => double(:_current_user => double(:role => :admin), :authorized? => true)).map(&:abstract_model).map(&:model).should == [Fan, Comment]
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'hides unallowed models' do
|
258
|
+
RailsAdmin.config do |config|
|
259
|
+
config.included_models = [Comment]
|
260
|
+
end
|
261
|
+
RailsAdmin.config.visible_models(:controller => double(:authorized? => true)).map(&:abstract_model).map(&:model).should == [Comment]
|
262
|
+
RailsAdmin.config.visible_models(:controller => double(:authorized? => false)).map(&:abstract_model).map(&:model).should == []
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
module ExampleModule
|
270
|
+
class AuthorizationAdapter ; end
|
271
|
+
class ConfigurationAdapter ; end
|
272
|
+
class AuditingAdapter ; end
|
273
|
+
end
|