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,2 @@
|
|
1
|
+
= rails_admin_form_for @object, :url => new_path(:model_name => @abstract_model.to_param, :id => @object.id), :as => @abstract_model.param_key, :html => { :multipart => true, :class => "form-horizontal denser", :data => { :title => @page_name } } do |form|
|
2
|
+
= form.generate :action => :create
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- @model_config.show.with(:object => @object, :view => self).visible_groups.each do |fieldset|
|
2
|
+
- unless (fields = fieldset.with(:object => @object, :view => self).visible_fields).empty?
|
3
|
+
- if !(values = fields.map{ |f| v = f.value; (!v.nil? && v != '' && v != []) ? v : nil }).compact.empty? || !RailsAdmin::config.compact_show_view
|
4
|
+
.fieldset
|
5
|
+
%h4
|
6
|
+
= fieldset.label
|
7
|
+
- if fieldset.help
|
8
|
+
%p= fieldset.help
|
9
|
+
%dl
|
10
|
+
- fields.each_with_index do |field, index|
|
11
|
+
- if !values[index].nil? || !RailsAdmin::config.compact_show_view
|
12
|
+
%dt.label{:class => "#{field.type_css_class} #{field.css_class}"}= field.label
|
13
|
+
%dd
|
14
|
+
%pre.prettyprint= field.pretty_value
|
@@ -0,0 +1,19 @@
|
|
1
|
+
if defined?(::ActiveRecord)
|
2
|
+
class ActiveRecord::Base
|
3
|
+
def self.rails_admin(&block)
|
4
|
+
RailsAdmin::Config.model(self, &block)
|
5
|
+
end
|
6
|
+
|
7
|
+
def rails_admin_default_object_label_method
|
8
|
+
self.new_record? ? "new #{self.class.to_s}" : "#{self.class.to_s} ##{self.id}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def safe_send(value)
|
12
|
+
if self.attributes.find{ |k,v| k.to_s == value.to_s }
|
13
|
+
self.read_attribute(value)
|
14
|
+
else
|
15
|
+
self.send(value)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
fr:
|
2
|
+
date:
|
3
|
+
formats:
|
4
|
+
default: "%d/%m/%Y"
|
5
|
+
short: "%e %b"
|
6
|
+
compact: "%d/%m/%y"
|
7
|
+
long: "%e %B %Y"
|
8
|
+
day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
|
9
|
+
abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
|
10
|
+
month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre]
|
11
|
+
abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.]
|
12
|
+
order:
|
13
|
+
- :day
|
14
|
+
- :month
|
15
|
+
- :year
|
16
|
+
time:
|
17
|
+
formats:
|
18
|
+
default: "%d %B %Y %H:%M:%S"
|
19
|
+
short: "%d %b %H:%M"
|
20
|
+
compact: "%d/%m/%y %H:%M"
|
21
|
+
long: "%A %d %B %Y %H:%M"
|
22
|
+
verb: "%d %B %Y"
|
23
|
+
am: 'am'
|
24
|
+
pm: 'pm'
|
@@ -0,0 +1,130 @@
|
|
1
|
+
en:
|
2
|
+
home:
|
3
|
+
name: Home
|
4
|
+
views:
|
5
|
+
pagination:
|
6
|
+
previous: "« Prev"
|
7
|
+
next: "Next »"
|
8
|
+
truncate: "…"
|
9
|
+
admin:
|
10
|
+
misc:
|
11
|
+
filter_date_format: "mm/dd/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done!
|
12
|
+
search: "Search"
|
13
|
+
filter: "Filter"
|
14
|
+
refresh: "Refresh"
|
15
|
+
show_all: "Show all"
|
16
|
+
add_filter: "Add filter"
|
17
|
+
bulk_menu_title: "Selected items"
|
18
|
+
remove: "Remove"
|
19
|
+
add_new: "Add new"
|
20
|
+
chosen: "Chosen %{name}"
|
21
|
+
chose_all: "Choose all"
|
22
|
+
clear_all: "Clear all"
|
23
|
+
up: "Up"
|
24
|
+
down: "Down"
|
25
|
+
navigation: "Navigation"
|
26
|
+
log_out: "Log out"
|
27
|
+
ago: "ago"
|
28
|
+
flash:
|
29
|
+
successful: "%{name} successfully %{action}"
|
30
|
+
error: "%{name} failed to be %{action}"
|
31
|
+
noaction: "No actions were taken"
|
32
|
+
model_not_found: "Model '%{model}' could not be found"
|
33
|
+
object_not_found: "%{model} with id '%{id}' could not be found"
|
34
|
+
table_headers:
|
35
|
+
model_name: "Model name"
|
36
|
+
last_used: "Last used"
|
37
|
+
records: "Records"
|
38
|
+
username: "User"
|
39
|
+
changes: "Changes"
|
40
|
+
created_at: "Date/Time"
|
41
|
+
item: "Item"
|
42
|
+
message: "Message"
|
43
|
+
actions:
|
44
|
+
dashboard:
|
45
|
+
title: "Site administration"
|
46
|
+
menu: "Dashboard"
|
47
|
+
breadcrumb: "Dashboard"
|
48
|
+
index:
|
49
|
+
title: "List of %{model_label_plural}"
|
50
|
+
menu: "List"
|
51
|
+
breadcrumb: "%{model_label_plural}"
|
52
|
+
show:
|
53
|
+
title: "Details for %{model_label} '%{object_label}'"
|
54
|
+
menu: "Show"
|
55
|
+
breadcrumb: "%{object_label}"
|
56
|
+
show_in_app:
|
57
|
+
menu: "Show in app"
|
58
|
+
new:
|
59
|
+
title: "New %{model_label}"
|
60
|
+
menu: "Add new"
|
61
|
+
breadcrumb: "New"
|
62
|
+
link: "Add a new %{model_label}"
|
63
|
+
done: "created"
|
64
|
+
edit:
|
65
|
+
title: "Edit %{model_label} '%{object_label}'"
|
66
|
+
menu: "Edit"
|
67
|
+
breadcrumb: "Edit"
|
68
|
+
link: "Edit this %{model_label}"
|
69
|
+
done: "updated"
|
70
|
+
delete:
|
71
|
+
title: "Delete %{model_label} '%{object_label}'"
|
72
|
+
menu: "Delete"
|
73
|
+
breadcrumb: "Delete"
|
74
|
+
link: "Delete '%{object_label}'"
|
75
|
+
done: "deleted"
|
76
|
+
bulk_delete:
|
77
|
+
title: "Delete %{model_label_plural}"
|
78
|
+
menu: "Multiple delete"
|
79
|
+
breadcrumb: "Multiple delete"
|
80
|
+
bulk_link: "Delete selected %{model_label_plural}"
|
81
|
+
export:
|
82
|
+
title: "Export %{model_label_plural}"
|
83
|
+
menu: "Export"
|
84
|
+
breadcrumb: "Export"
|
85
|
+
link: "Export found %{model_label_plural}"
|
86
|
+
bulk_link: "Export selected %{model_label_plural}"
|
87
|
+
done: "exported"
|
88
|
+
history_index:
|
89
|
+
title: "History for %{model_label_plural}"
|
90
|
+
menu: "History"
|
91
|
+
breadcrumb: "History"
|
92
|
+
history_show:
|
93
|
+
title: "History for %{model_label} '%{object_label}'"
|
94
|
+
menu: "History"
|
95
|
+
breadcrumb: "History"
|
96
|
+
form:
|
97
|
+
cancel: "Cancel"
|
98
|
+
basic_info: "Basic info"
|
99
|
+
required: "Required"
|
100
|
+
optional: "Optional"
|
101
|
+
one_char: "character"
|
102
|
+
char_length_up_to: "length up to"
|
103
|
+
char_length_of: "length of"
|
104
|
+
save: "Save"
|
105
|
+
save_and_add_another: "Save and add another"
|
106
|
+
save_and_edit: "Save and edit"
|
107
|
+
all_of_the_following_related_items_will_be_deleted: "? The following related items may be deleted or orphaned:"
|
108
|
+
are_you_sure_you_want_to_delete_the_object: "Are you sure you want to delete this %{model_name}"
|
109
|
+
confirmation: "Yes, I'm sure"
|
110
|
+
bulk_delete: "The following objects will be deleted, which may delete or orphan some of their related dependencies:"
|
111
|
+
new_model: "%{name} (new)"
|
112
|
+
export:
|
113
|
+
confirmation: "Export to %{name}"
|
114
|
+
select: "Select fields to export"
|
115
|
+
fields_from: "Fields from %{name}"
|
116
|
+
fields_from_associated: "Fields from associated %{name}"
|
117
|
+
display: "Display %{name}: %{type}"
|
118
|
+
options_for: "Options for %{name}"
|
119
|
+
empty_value_for_associated_objects: "<empty>"
|
120
|
+
click_to_reverse_selection: 'Click to reverse selection'
|
121
|
+
csv:
|
122
|
+
header_for_root_methods: "%{name}" # 'model' is available
|
123
|
+
header_for_association_methods: "%{name} [%{association}]"
|
124
|
+
encoding_to: "Encode to"
|
125
|
+
encoding_to_help: "Choose output encoding. Leave empty to let current input encoding untouched: (%{name})"
|
126
|
+
skip_header: "No header"
|
127
|
+
skip_header_help: "Do not output a header (no fields description)"
|
128
|
+
default_col_sep: ","
|
129
|
+
col_sep: "Column separator"
|
130
|
+
col_sep_help: "Leave blank for default ('%{value}')" # value is default_col_sep
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
RailsAdmin::Engine.routes.draw do
|
2
|
+
controller "main" do
|
3
|
+
RailsAdmin::Config::Actions.all(:root).each { |action| match "/#{action.route_fragment}", :to => action.action_name, :as => action.action_name, :via => action.http_methods }
|
4
|
+
scope ":model_name" do
|
5
|
+
RailsAdmin::Config::Actions.all(:collection).each { |action| match "/#{action.route_fragment}", :to => action.action_name, :as => action.action_name, :via => action.http_methods }
|
6
|
+
post "/bulk_action", :to => :bulk_action, :as => "bulk_action"
|
7
|
+
scope ":id" do
|
8
|
+
RailsAdmin::Config::Actions.all(:member).each { |action| match "/#{action.route_fragment}", :to => action.action_name, :as => action.action_name, :via => action.http_methods }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require File.expand_path('../utils', __FILE__)
|
3
|
+
|
4
|
+
# http://guides.rubyonrails.org/generators.html
|
5
|
+
# http://rdoc.info/github/wycats/thor/master/Thor/Actions.html
|
6
|
+
# keep generator idempotent, thanks
|
7
|
+
|
8
|
+
module RailsAdmin
|
9
|
+
class InstallGenerator < Rails::Generators::Base
|
10
|
+
source_root File.expand_path("../templates", __FILE__)
|
11
|
+
include Rails::Generators::Migration
|
12
|
+
include Generators::Utils::InstanceMethods
|
13
|
+
extend Generators::Utils::ClassMethods
|
14
|
+
|
15
|
+
argument :_model_name, :type => :string, :required => false, :desc => "Devise user model name"
|
16
|
+
argument :_namespace, :type => :string, :required => false, :desc => "RailsAdmin url namespace"
|
17
|
+
desc "RailsAdmin installation generator"
|
18
|
+
|
19
|
+
def install
|
20
|
+
routes = File.open(Rails.root.join("config/routes.rb")).try :read
|
21
|
+
initializer = (File.open(Rails.root.join("config/initializers/rails_admin.rb")) rescue nil).try :read
|
22
|
+
|
23
|
+
display "Hello, RailsAdmin installer will help you sets things up!", :blue
|
24
|
+
display "I need to work with Devise, let's look at a few things first:"
|
25
|
+
display "Checking for a current installation of devise..."
|
26
|
+
unless defined?(Devise)
|
27
|
+
display "Adding devise gem to your Gemfile:"
|
28
|
+
append_file "Gemfile", "\n", :force => true
|
29
|
+
gem 'devise'
|
30
|
+
else
|
31
|
+
display "Found it!"
|
32
|
+
end
|
33
|
+
unless File.exists?(Rails.root.join("config/initializers/devise.rb"))
|
34
|
+
display "Looks like you don't have devise installed! We'll install it for you:"
|
35
|
+
generate "devise:install"
|
36
|
+
else
|
37
|
+
display "Looks like you've already installed it, good!"
|
38
|
+
end
|
39
|
+
|
40
|
+
unless routes.index("devise_for")
|
41
|
+
model_name = ask_for("What would you like the user model to be called?", "user", _model_name)
|
42
|
+
display "Now setting up devise with user model name '#{model_name}':"
|
43
|
+
generate "devise", model_name
|
44
|
+
else
|
45
|
+
display "And you already set it up, good! We just need to know about your user model name..."
|
46
|
+
guess = routes.match(/devise_for :(\w+)/)[1].try(:singularize)
|
47
|
+
display("We found '#{guess}' (should be one of 'user', 'admin', etc.)")
|
48
|
+
model_name = ask_for("Correct Devise model name if needed.", guess, _model_name)
|
49
|
+
unless guess == model_name
|
50
|
+
display "Now setting up devise with user model name '#{model_name}':"
|
51
|
+
generate "devise", model_name
|
52
|
+
else
|
53
|
+
display "Ok, Devise looks already set up with user model name '#{model_name}':"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
display "Now you'll need an initializer..."
|
57
|
+
@model_name = model_name
|
58
|
+
unless initializer
|
59
|
+
template "initializer.erb", "config/initializers/rails_admin.rb"
|
60
|
+
else
|
61
|
+
display "You already have a config file. You're updating, heh? I'm generating a new 'rails_admin.rb.example' that you can review."
|
62
|
+
template "initializer.erb", "config/initializers/rails_admin.rb.example"
|
63
|
+
config_tag = initializer.match(/RailsAdmin\.config.+\|(.+)\|/)[1] rescue nil
|
64
|
+
if config_tag
|
65
|
+
if initializer.index(::Regexp.new("#{config_tag}\.current_user_method.?\{.+?\}"))
|
66
|
+
display "current_user_method found and updated with 'current_#{model_name}'", :green
|
67
|
+
gsub_file Rails.root.join("config/initializers/rails_admin.rb"), ::Regexp.new("#{config_tag}\.current_user_method.?\{.+?\}"), "#{config_tag}.current_user_method { current_#{model_name} }"
|
68
|
+
else
|
69
|
+
display "current_user_method not found. Added one with 'current_#{model_name}'!", :yellow
|
70
|
+
insert_into_file Rails.root.join("config/initializers/rails_admin.rb"), "\n\n #{config_tag}.current_user_method { current_#{model_name} } #auto-generated", :after => /^RailsAdmin\.config.+$/
|
71
|
+
end
|
72
|
+
else
|
73
|
+
display "Couldn't parse your config file: current_user_method couldn't be updated", :red
|
74
|
+
end
|
75
|
+
end
|
76
|
+
display "Adding a migration..."
|
77
|
+
migration_template 'migration.rb', 'db/migrate/create_rails_admin_histories_table.rb' rescue display $!.message
|
78
|
+
namespace = ask_for("Where do you want to mount rails_admin?", "admin", _namespace)
|
79
|
+
gsub_file "config/routes.rb", /mount RailsAdmin::Engine => \'\/.+\', :as => \'rails_admin\'/, ''
|
80
|
+
route("mount RailsAdmin::Engine => '/#{namespace}', :as => 'rails_admin'")
|
81
|
+
display "Job's done: migrate, start your server and visit '/#{namespace}'!", :blue
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class DropRailsAdminHistoriesTable < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
drop_table :rails_admin_histories
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.down
|
7
|
+
create_table :rails_admin_histories do |t|
|
8
|
+
t.text :message # title, name, or object_id
|
9
|
+
t.string :username
|
10
|
+
t.integer :item
|
11
|
+
t.string :table
|
12
|
+
t.integer :month, :limit => 2
|
13
|
+
t.integer :year, :limit => 5
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
add_index(:rails_admin_histories, [:item, :table, :month, :year], :name => 'index_rails_admin_histories' )
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# RailsAdmin config file. Generated on <%= DateTime.now.to_s(:long) %>
|
2
|
+
# See github.com/sferik/rails_admin for more informations
|
3
|
+
|
4
|
+
RailsAdmin.config do |config|
|
5
|
+
|
6
|
+
# If your default_local is different from :en, uncomment the following 2 lines and set your default locale here:
|
7
|
+
# require 'i18n'
|
8
|
+
# I18n.default_locale = :de
|
9
|
+
|
10
|
+
config.current_user_method { current_<%= @model_name.underscore %> } # auto-generated
|
11
|
+
|
12
|
+
# If you want to track changes on your models:
|
13
|
+
# config.audit_with :history, <%= @model_name.classify %>
|
14
|
+
|
15
|
+
# Or with a PaperTrail: (you need to install it first)
|
16
|
+
# config.audit_with :paper_trail, <%= @model_name.classify %>
|
17
|
+
|
18
|
+
# Set the admin name here (optional second array element will appear in a beautiful RailsAdmin red ©)
|
19
|
+
config.main_app_name = ['<%= Rails.application.engine_name.titleize.chomp(' Application') %>', 'Admin']
|
20
|
+
# or for a dynamic name:
|
21
|
+
# config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.titleize, controller.params['action'].titleize] }
|
22
|
+
|
23
|
+
|
24
|
+
# ==> Global show view settings
|
25
|
+
# Display empty fields in show views
|
26
|
+
# config.compact_show_view = false
|
27
|
+
|
28
|
+
# ==> Global list view settings
|
29
|
+
# Number of default rows per-page:
|
30
|
+
# config.default_items_per_page = 20
|
31
|
+
|
32
|
+
# ==> Included models
|
33
|
+
# Add all excluded models here:
|
34
|
+
# config.excluded_models = [<%= RailsAdmin::AbstractModel.all.map{|am| am.model.to_s }.join(', ') %>]
|
35
|
+
|
36
|
+
# Add models here if you want to go 'whitelist mode':
|
37
|
+
# config.included_models = [<%= RailsAdmin::AbstractModel.all.map{|am| am.model.to_s }.join(', ') %>]
|
38
|
+
|
39
|
+
# Application wide tried label methods for models' instances
|
40
|
+
# config.label_methods << :description # Default is [:name, :title]
|
41
|
+
|
42
|
+
# ==> Global models configuration
|
43
|
+
# config.models do
|
44
|
+
# # Configuration here will affect all included models in all scopes, handle with care!
|
45
|
+
#
|
46
|
+
# list do
|
47
|
+
# # Configuration here will affect all included models in list sections (same for show, export, edit, update, create)
|
48
|
+
#
|
49
|
+
# fields_of_type :date do
|
50
|
+
# # Configuration here will affect all date fields, in the list section, for all included models. See README for a comprehensive type list.
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# ==> Model specific configuration
|
56
|
+
# Keep in mind that *all* configuration blocks are optional.
|
57
|
+
# RailsAdmin will try his best to provide the best defaults for each section, for each field.
|
58
|
+
# Try to override as few things as possible, in the most generic way. Try to avoid setting labels for models and attributes, use ActiveRecord I18n API instead.
|
59
|
+
# Less code is better code!
|
60
|
+
# config.model MyModel do
|
61
|
+
# # Cross-section field configuration
|
62
|
+
# object_label_method :name # Name of the method called for pretty printing an *instance* of ModelName
|
63
|
+
# label 'My model' # Name of ModelName (smartly defaults to ActiveRecord's I18n API)
|
64
|
+
# label_plural 'My models' # Same, plural
|
65
|
+
# weight -1 # Navigation priority. Bigger is higher.
|
66
|
+
# parent OtherModel # Set parent model for navigation. MyModel will be nested below. OtherModel will be on first position of the dropdown
|
67
|
+
# navigation_label # Sets dropdown entry's name in navigation. Only for parents!
|
68
|
+
# # Section specific configuration:
|
69
|
+
# list do
|
70
|
+
# filters [:id, :name] # Array of field names which filters should be shown by default in the table header
|
71
|
+
# items_per_page 100 # Override default_items_per_page
|
72
|
+
# sort_by :id # Sort column (default is primary key)
|
73
|
+
# sort_reverse true # Sort direction (default is true for primary key, last created first)
|
74
|
+
# # Here goes the fields configuration for the list view
|
75
|
+
# end
|
76
|
+
# end
|
77
|
+
|
78
|
+
# Your model's configuration, to help you get started:
|
79
|
+
|
80
|
+
# All fields marked as 'hidden' won't be shown anywhere in the rails_admin unless you mark them as visible. (visible(true))
|
81
|
+
|
82
|
+
<% RailsAdmin::AbstractModel.all.map do |abstract_model| -%>
|
83
|
+
# config.model <%= abstract_model.model.model_name %> do
|
84
|
+
# # Found associations:
|
85
|
+
<%= abstract_model.config.export.fields.select{|f| f.association?}.map do |field|
|
86
|
+
%{ # configure #{field.name.inspect}, #{field.type.inspect}#{" # Hidden" unless field.visible?} }
|
87
|
+
end.join("\n") -%>
|
88
|
+
# # Found columns:
|
89
|
+
<%= abstract_model.config.export.fields.select{|f| !f.association?}.map do |field|
|
90
|
+
%{ # configure #{field.name.inspect}, #{field.type.inspect}#{" # Hidden" unless field.visible?} }
|
91
|
+
end.join("\n") -%>
|
92
|
+
# # Sections:
|
93
|
+
# list do; end
|
94
|
+
# export do; end
|
95
|
+
# show do; end
|
96
|
+
# edit do; end
|
97
|
+
# create do; end
|
98
|
+
# update do; end
|
99
|
+
# end
|
100
|
+
<%- end -%>
|
101
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateRailsAdminHistoriesTable < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :rails_admin_histories do |t|
|
4
|
+
t.text :message # title, name, or object_id
|
5
|
+
t.string :username
|
6
|
+
t.integer :item
|
7
|
+
t.string :table
|
8
|
+
t.integer :month, :limit => 2
|
9
|
+
t.integer :year, :limit => 5
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
add_index(:rails_admin_histories, [:item, :table, :month, :year], :name => 'index_rails_admin_histories' )
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :rails_admin_histories
|
17
|
+
end
|
18
|
+
end
|