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,47 @@
|
|
1
|
+
:ruby
|
2
|
+
config = field.associated_model_config
|
3
|
+
related_id = params[:associations] && params[:associations][field.name.to_s]
|
4
|
+
source_abstract_model = RailsAdmin.config(form.object.class).abstract_model
|
5
|
+
|
6
|
+
if form.object.new_record? && related_id.present? && related_id != 'new'
|
7
|
+
selected = config.abstract_model.get(related_id)
|
8
|
+
selected_id = selected.send(field.associated_primary_key)
|
9
|
+
selected_name = selected.send(field.associated_object_label_method)
|
10
|
+
else
|
11
|
+
selected_id = field.selected_id
|
12
|
+
selected_name = field.formatted_value
|
13
|
+
end
|
14
|
+
|
15
|
+
current_action = params[:action].in?(['create', 'new']) ? 'create' : 'update'
|
16
|
+
|
17
|
+
edit_url = authorized?(:edit, config.abstract_model) ? edit_path(:model_name => config.abstract_model.to_param, :modal => true, :id => '__ID__') : ''
|
18
|
+
|
19
|
+
xhr = !field.associated_collection_cache_all
|
20
|
+
|
21
|
+
collection = xhr ? [[selected_name, selected_id]] : controller.list_entries(config, :index, field.associated_collection_scope, false).map { |o| [o.send(field.associated_object_label_method), o.send(field.associated_primary_key)] }
|
22
|
+
|
23
|
+
- selected_id = (hdv = field.html_default_value).nil? ? selected_id : hdv
|
24
|
+
= form.select field.method_name, collection, { :selected => selected_id, :include_blank => true }, field.html_attributes.reverse_merge({:placeholder => t('admin.misc.search')})
|
25
|
+
|
26
|
+
- if authorized? :new, config.abstract_model
|
27
|
+
- path_hash = { :model_name => config.abstract_model.to_param, :modal => true }
|
28
|
+
- path_hash.merge!({ :associations => { field.inverse_of => (form.object.id || 'new') } }) if field.inverse_of
|
29
|
+
= link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', :data => { :link => new_path(path_hash) }, :class => "btn btn-info create", :style => 'float:left; margin-left:10px'
|
30
|
+
|
31
|
+
- if edit_url.present?
|
32
|
+
= link_to "<i class=\"icon-pencil icon-white\"></i> ".html_safe + wording_for(:link, :edit, config.abstract_model), '#', :data => { :link => edit_url }, :class => "btn btn-info update #{field.value.nil? && 'disabled'}", :style => 'float:left; margin-left:10px'
|
33
|
+
|
34
|
+
= form.javascript_for(field) do
|
35
|
+
:plain
|
36
|
+
$("#{form.jquery_namespace(field)} select").filteringSelect({
|
37
|
+
xhr: #{xhr},
|
38
|
+
createQuery: function(query) {
|
39
|
+
return { query: query }
|
40
|
+
},
|
41
|
+
remote_source: "#{index_path(config.abstract_model.to_param, :source_object_id => form.object.id, :source_abstract_model => source_abstract_model.to_param, :associated_collection => field.name, :current_action => current_action, :compact => true).html_safe}"
|
42
|
+
});
|
43
|
+
if($("#modal").length) { // hide link if we already are inside a dialog (endless issues on nested dialogs with JS)
|
44
|
+
$("#{form.jquery_namespace(field)} .btn").hide();
|
45
|
+
} else {
|
46
|
+
$("#{form.jquery_namespace(field)}").remoteForm();
|
47
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.controls
|
2
|
+
.btn-group
|
3
|
+
%a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content, #{form.jquery_namespace(field)} > .controls > .nav", :class => (field.active? ? 'active' : '')}
|
4
|
+
%i.icon-white
|
5
|
+
= form.link_to_add "<i class=\"icon-plus icon-white\"></i> #{wording_for(:link, :new, field.associated_model_config.abstract_model)}".html_safe, field.name, { :class => 'btn btn-info' }
|
6
|
+
= form.errors_for(field)
|
7
|
+
= form.help_for(field)
|
8
|
+
%ul.nav.nav-tabs{ :style => 'margin-top:5px' }
|
9
|
+
.tab-content
|
10
|
+
= form.fields_for field.name do |nested_form|
|
11
|
+
= nested_form.link_to_remove '<span class="btn btn-small btn-danger"><i class="icon-trash icon-white"></i></span>'.html_safe
|
12
|
+
= nested_form.generate({:action => :nested, :model_config => field.associated_model_config, :nested_in => field.name })
|
13
|
+
|
14
|
+
= form.javascript_for(field) do
|
15
|
+
:plain
|
16
|
+
var field = $("#{form.jquery_namespace(field)}");
|
17
|
+
var nav = field.find('> .controls > .nav');
|
18
|
+
var content = field.find('> .tab-content');
|
19
|
+
var toggler = field.find('> .controls > .btn-group > .toggler');
|
20
|
+
|
21
|
+
// add each nested field to a tab-pane and reference it in the nav
|
22
|
+
content.children(".fields").addClass('tab-pane').each(function(){
|
23
|
+
nav.append('<li><a data-toggle="tab" href="#' + this.id + '">' + $(this).children('.object-infos').data('object-label') + '</a></li>');
|
24
|
+
});
|
25
|
+
|
26
|
+
// init first tab, toggler and content/tabs visibility
|
27
|
+
nav.find("> li > a[data-toggle='tab']:first").tab('show');
|
28
|
+
if(nav.children().length == 0) {
|
29
|
+
nav.hide(); content.hide();
|
30
|
+
toggler.addClass('disabled').removeClass('active').children('i').addClass('icon-chevron-right')
|
31
|
+
} else {
|
32
|
+
if (toggler.hasClass('active')) {
|
33
|
+
nav.show(); content.show();
|
34
|
+
toggler.children('i').addClass('icon-chevron-down')
|
35
|
+
} else {
|
36
|
+
nav.hide(); content.hide();
|
37
|
+
toggler.children('i').addClass('icon-chevron-right')
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
// dynamic behaviour is in nested-form-hooks
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.controls
|
2
|
+
%ul.nav{:style => 'margin-bottom:0px; display:none'}
|
3
|
+
%a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content", :class => (field.active? ? 'active' : '') }
|
4
|
+
= form.errors_for(field)
|
5
|
+
= form.help_for(field)
|
6
|
+
|
7
|
+
- form.object.send("build_#{field.name}") unless form.object.send(field.name)
|
8
|
+
.tab-content
|
9
|
+
= form.fields_for field.name do |nested_form|
|
10
|
+
= nested_form.generate({:action => :nested, :model_config => field.associated_model_config, :nested_in => field.name })
|
11
|
+
|
12
|
+
= form.javascript_for(field) do
|
13
|
+
:plain
|
14
|
+
var field = $("#{form.jquery_namespace(field)}");
|
15
|
+
var nav = field.find("> .controls > .nav");
|
16
|
+
var content = field.find("> .tab-content");
|
17
|
+
var toggler = field.find('> .controls > .toggler');
|
18
|
+
|
19
|
+
content.children(".fields").addClass('tab-pane').each(function(){
|
20
|
+
nav.append('<li><a data-toggle="tab" href="#' + this.id + '">' + $(this).children('.object-infos').data('object-label') + '</a></li>');
|
21
|
+
});
|
22
|
+
|
23
|
+
var first_tab = nav.find("> li > a[data-toggle='tab']:first");
|
24
|
+
|
25
|
+
first_tab.tab('show');
|
26
|
+
field.find("> .controls > [data-target]:first").html('<i class="icon-white"></i> ' + first_tab.html());
|
27
|
+
|
28
|
+
if (toggler.hasClass('active')) {
|
29
|
+
toggler.children('i').addClass('icon-chevron-down');
|
30
|
+
content.show()
|
31
|
+
} else {
|
32
|
+
toggler.children('i').addClass('icon-chevron-right');
|
33
|
+
content.hide()
|
34
|
+
}
|
35
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
:ruby
|
2
|
+
type_collection = field.polymorphic_type_collection
|
3
|
+
type_column = field.association[:foreign_type].to_s
|
4
|
+
selected_type = field.bindings[:object].send(type_column)
|
5
|
+
collection = field.associated_collection(selected_type)
|
6
|
+
selected = field.bindings[:object].send(field.association[:name])
|
7
|
+
column_type_dom_id = form.dom_id(field).sub(field.method_name.to_s, type_column)
|
8
|
+
|
9
|
+
= form.select type_column, type_collection, {:include_blank => true, :selected => selected_type}, :id => column_type_dom_id
|
10
|
+
= form.select field.method_name, collection, {:include_blank => true, :selected => selected.try(:id)}, :style => "margin-left:10px;"
|
11
|
+
|
12
|
+
= form.javascript_for(field) do
|
13
|
+
:plain
|
14
|
+
var urls = #{field.polymorphic_type_urls.to_json.html_safe };
|
15
|
+
$("#{form.jquery_namespace(field)} ##{column_type_dom_id}").bind("change", function(e){
|
16
|
+
if ("" == $(this).val()) {
|
17
|
+
$("##{ form.dom_id(field) }").html('<option value=""></option>');
|
18
|
+
} else {
|
19
|
+
$.ajax({
|
20
|
+
url: urls[$(this).val()],
|
21
|
+
data: { compact: true, all: true },
|
22
|
+
beforeSend: function(xhr) {
|
23
|
+
xhr.setRequestHeader("Accept", "application/json");
|
24
|
+
},
|
25
|
+
success: function(data, status, xhr) {
|
26
|
+
var html = '<option></option>';
|
27
|
+
$(data).each(function(i, el) {
|
28
|
+
html += '<option value="' + el.id + '">' + el.label + '</option>';
|
29
|
+
});
|
30
|
+
$("#{form.jquery_namespace(field)} ##{ form.dom_id(field) }").html(html);
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= form.text_area field.method_name, field.html_attributes.reverse_merge((hdv = field.html_default_value).nil? ? { :value => field.formatted_value } : { :value => hdv })
|
2
|
+
|
3
|
+
- if field.ckeditor
|
4
|
+
= javascript_tag do
|
5
|
+
var CKEDITOR_BASEPATH = '/assets/ckeditor/';
|
6
|
+
= javascript_include_tag "/assets/ckeditor/ckeditor.js"
|
7
|
+
= form.javascript_for(field, :modal => false) do
|
8
|
+
:plain
|
9
|
+
CKEDITOR.replace('#{form.dom_id(field)}', { customConfig : '#{field.ckeditor_config_js.html_safe}' });
|
@@ -0,0 +1,15 @@
|
|
1
|
+
%input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
|
2
|
+
.form-actions
|
3
|
+
%button.btn.btn-primary{:type => "submit", :name => "_save", :'data-disable-with' => t("admin.form.save")}
|
4
|
+
%i.icon-white.icon-ok
|
5
|
+
= t("admin.form.save")
|
6
|
+
%span.extra_buttons
|
7
|
+
- if authorized? :new, @abstract_model
|
8
|
+
%button.btn.btn-info{:type => "submit", :name => "_add_another", :'data-disable-with' => t("admin.form.save_and_add_another")}
|
9
|
+
= t("admin.form.save_and_add_another")
|
10
|
+
- if authorized? :edit, @abstract_model
|
11
|
+
%button.btn.btn-info{:type => "submit", :name => "_add_edit", :'data-disable-with' => t("admin.form.save_and_edit")}
|
12
|
+
= t("admin.form.save_and_edit")
|
13
|
+
%button.btn{:type => "submit", :name => "_continue", :'data-disable-with' => t("admin.form.cancel")}
|
14
|
+
%i.icon-remove
|
15
|
+
= t("admin.form.cancel")
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%h4= I18n.t('admin.form.bulk_delete')
|
2
|
+
%ul= render :partial => "delete_notice", :collection => @objects
|
3
|
+
= form_tag bulk_delete_path(:model_name => @abstract_model.to_param, :bulk_ids => @objects.map(&:id)), :method => :delete do
|
4
|
+
.form-actions
|
5
|
+
%input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
|
6
|
+
%button.btn.btn-danger{:type => "submit", :'data-disable-with' => t("admin.form.confirmation")}
|
7
|
+
%i.icon-white.icon-ok
|
8
|
+
= t("admin.form.confirmation")
|
9
|
+
%button.btn{:type => "submit", :name => "_continue", :'data-disable-with' => t("admin.form.cancel")}
|
10
|
+
%i.icon-remove
|
11
|
+
= t("admin.form.cancel")
|
@@ -0,0 +1,31 @@
|
|
1
|
+
%table.table.table-condensed.table-striped
|
2
|
+
%thead
|
3
|
+
%tr
|
4
|
+
%th.shrink.model-name= t "admin.table_headers.model_name"
|
5
|
+
%th.shrink.last-used= t "admin.table_headers.last_used"
|
6
|
+
%th.records= t "admin.table_headers.records"
|
7
|
+
%th.shrink.controls
|
8
|
+
%tbody
|
9
|
+
- @abstract_models.each do |abstract_model|
|
10
|
+
- if authorized? :index, abstract_model
|
11
|
+
- index_path = index_path(:model_name => abstract_model.to_param)
|
12
|
+
- row_class = "#{cycle("odd", "even")}#{" link" if index_path}"
|
13
|
+
|
14
|
+
%tr{:class => row_class, :"data-link" => index_path}
|
15
|
+
%td
|
16
|
+
%span.show= link_to abstract_model.config.label_plural, index_path
|
17
|
+
%td
|
18
|
+
- if (last_used = @most_recent_changes[abstract_model.pretty_name])
|
19
|
+
= time_ago_in_words last_used
|
20
|
+
= t "admin.misc.ago"
|
21
|
+
%td
|
22
|
+
- count = @count[abstract_model.pretty_name]
|
23
|
+
- percent = count > 0 ? (@max < 2.0 ? count : ((Math.log(count) * 100.0) / Math.log(@max))) : -1
|
24
|
+
.label.animate-width-to{:class => 'label-'+get_indicator(percent), :'data-animate-length' => ([1.0, percent].max.to_i * 20), :'data-animate-width-to' => "#{[2.0, percent - 1].max.to_i}%", :style => "width:2%"}= @count[abstract_model.pretty_name]
|
25
|
+
%td.links
|
26
|
+
%ul.inline= menu_for :collection, abstract_model, nil, true
|
27
|
+
- if @auditing_adapter && authorized?(:history)
|
28
|
+
#block-tables.block
|
29
|
+
.content
|
30
|
+
%h2= t("admin.actions.history_index.menu")
|
31
|
+
= render :partial => 'rails_admin/main/dashboard_history'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
%h4
|
2
|
+
= t("admin.form.are_you_sure_you_want_to_delete_the_object", :model_name => @abstract_model.pretty_name.downcase)
|
3
|
+
“
|
4
|
+
%strong>= @model_config.with(:object => @object).object_label
|
5
|
+
\”
|
6
|
+
%span>
|
7
|
+
= t("admin.form.all_of_the_following_related_items_will_be_deleted")
|
8
|
+
|
9
|
+
%ul= render :partial => "delete_notice", :object => @object
|
10
|
+
= form_for(@object, :url => delete_path(:model_name => @abstract_model.to_param, :id => @object.id), :html => {:method => "delete"}) do
|
11
|
+
%input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
|
12
|
+
.form-actions
|
13
|
+
%button.btn.btn-danger{:type => "submit", :'data-disable-with' => t("admin.form.confirmation")}
|
14
|
+
%i.icon-white.icon-ok
|
15
|
+
= t("admin.form.confirmation")
|
16
|
+
%button.btn{:type => "submit", :name => "_continue", :'data-disable-with' => t("admin.form.cancel")}
|
17
|
+
%i.icon-remove
|
18
|
+
= t("admin.form.cancel")
|
@@ -0,0 +1,2 @@
|
|
1
|
+
= rails_admin_form_for @object, :url => edit_path(@abstract_model, @object.id), :as => @abstract_model.param_key, :html => { :method => "put", :multipart => true, :class => "form-horizontal denser", :data => { :title => @page_name } } do |form|
|
2
|
+
= form.generate :action => :update
|
@@ -0,0 +1,75 @@
|
|
1
|
+
- params = request.params.except(:action, :controller, :utf8, :page, :per_page, :format, :authenticity_token)
|
2
|
+
- visible_fields = @model_config.export.with(:view => self, :object => @abstract_model.model.new).visible_fields
|
3
|
+
|
4
|
+
= form_tag export_path(params.merge(:all => true)), :method => 'post', :class => 'form-horizontal denser' do
|
5
|
+
|
6
|
+
%input{:name => "send_data", :type => "hidden", :value => "true"}/
|
7
|
+
%fieldset
|
8
|
+
%legend
|
9
|
+
%i.icon-chevron-down
|
10
|
+
= t('admin.export.select')
|
11
|
+
.control-group
|
12
|
+
%label.control-label{:rel => 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from', :name => @model_config.label_plural.downcase)
|
13
|
+
.controls
|
14
|
+
- visible_fields.select{ |f| !f.association? || f.association[:polymorphic] }.each do |field|
|
15
|
+
- list = field.virtual? ? 'methods' : 'only'
|
16
|
+
- if field.association? && field.association[:polymorphic]
|
17
|
+
%label.checkbox{:for => "schema_#{list}_#{field.method_name}"}
|
18
|
+
= check_box_tag "schema[#{list}][]", field.method_name, true, { :id => "schema_#{list}_#{field.method_name}" }
|
19
|
+
= field.label + " [id]"
|
20
|
+
- polymorphic_type_column_name = @abstract_model.properties.find {|p| field.association[:foreign_type] == p[:name] }[:name]
|
21
|
+
%label.checkbox{:for => "schema_#{list}_#{polymorphic_type_column_name}"}
|
22
|
+
= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { :id => "schema_#{list}_#{polymorphic_type_column_name}" }
|
23
|
+
= field.label + " [type]"
|
24
|
+
- else
|
25
|
+
%label.checkbox{:for => "schema_#{list}_#{field.name}"}
|
26
|
+
= check_box_tag "schema[#{list}][]", field.name, true, { :id => "schema_#{list}_#{field.name}" }
|
27
|
+
= field.label
|
28
|
+
|
29
|
+
- visible_fields.select{ |f| f.association? && !f.association[:polymorphic] }.each do |field|
|
30
|
+
- fields = field.associated_model_config.export.with(:view => self, :object => (associated_model = field.associated_model_config.abstract_model.model).new).visible_fields.select{ |f| !f.association? }
|
31
|
+
.control-group
|
32
|
+
%label.control-label{:rel => 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from_associated', :name => field.label.downcase)
|
33
|
+
.controls
|
34
|
+
- fields.each do |associated_model_field|
|
35
|
+
- list = associated_model_field.type != 'virtual' ? 'only' : 'methods'
|
36
|
+
%label.checkbox{:for => "schema_include_#{field.name}_#{list}_#{associated_model_field.name}"}
|
37
|
+
= check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { :id => "schema_include_#{field.name}_#{list}_#{associated_model_field.name}" }
|
38
|
+
= associated_model.human_attribute_name(associated_model_field.name)
|
39
|
+
|
40
|
+
%fieldset
|
41
|
+
%legend
|
42
|
+
%i.icon-chevron-down
|
43
|
+
= t('admin.export.options_for', :name => 'csv')
|
44
|
+
.control-group
|
45
|
+
- guessed_encoding = (Rails.configuration.database_configuration[Rails.env]['encoding'].presence rescue 'UTF-8') || 'UTF-8'
|
46
|
+
%label.control-label{:for => "csv_options_encoding_to"}= t('admin.export.csv.encoding_to')
|
47
|
+
.controls
|
48
|
+
-# from http://books.google.com/support/partner/bin/answer.py?answer=30990 :
|
49
|
+
= select_tag 'csv_options[encoding_to]', options_for_select(["", "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE", "UTF-7", "ISO-8859-1", "ISO-8859-15", "IBM-850", "MacRoman", "Windows-1252", "ISO-8859-3", "IBM-852", "ISO-8859-2", "MacCE", "Windows-1250", "IBM-855", "ISO-8859-5", "ISO-IR-111", "KOI8-R", "MacCyrillic", "Windows-1251", "CP-866", "KOI-U", "MacUkranian", "GB2312", "GBK", "GB18030", "HZ", "ISO-2022-CN", "Big5", "Big5-HKSCS", "EUC-TW", "EUC-JP", "ISO-2022-JP", "Shift_JIS", "EUC-KR", "UHC", "JOHAB", "ISO-2022-KR"])
|
50
|
+
%p.help-block= t('admin.export.csv.encoding_to_help', :name => guessed_encoding)
|
51
|
+
|
52
|
+
.control-group
|
53
|
+
%label.control-label{:for => "csv_options_skip_header"}= t('admin.export.csv.skip_header')
|
54
|
+
.controls
|
55
|
+
= check_box_tag 'csv_options[skip_header]', 'true'
|
56
|
+
%p.help-block= t('admin.export.csv.skip_header_help')
|
57
|
+
|
58
|
+
.control-group
|
59
|
+
%label.control-label{:for => "csv_options_generator_col_sep"}= t('admin.export.csv.col_sep')
|
60
|
+
.controls
|
61
|
+
= select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), "<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'" })
|
62
|
+
%p.help-block= t('admin.export.csv.col_sep_help', :value => t('admin.export.csv.default_col_sep'))
|
63
|
+
|
64
|
+
.form-actions
|
65
|
+
%input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
|
66
|
+
%button.btn.btn-primary{:type => "submit", :name => 'csv'}
|
67
|
+
%i.icon-white.icon-ok
|
68
|
+
= t("admin.export.confirmation", :name => 'csv')
|
69
|
+
%button.btn.btn-info{:type => "submit", :name => 'json'}
|
70
|
+
= t("admin.export.confirmation", :name => 'json')
|
71
|
+
%button.btn.btn-info{:type => "submit", :name => 'xml'}
|
72
|
+
= t("admin.export.confirmation", :name => 'xml')
|
73
|
+
%button.btn{:type => "submit", :name => "_continue"}
|
74
|
+
%i.icon-remove
|
75
|
+
= t("admin.form.cancel")
|
@@ -0,0 +1,42 @@
|
|
1
|
+
- params = request.params.except(:action, :controller, :model_name)
|
2
|
+
- query = params[:query]
|
3
|
+
- filter = params[:filter]
|
4
|
+
- sort = params[:sort]
|
5
|
+
- sort_reverse = params[:sort_reverse]
|
6
|
+
- path_method = params[:id] ? "history_show_path" : "history_index_path"
|
7
|
+
|
8
|
+
= form_tag("", :method => "get", :class => "search form-inline") do
|
9
|
+
.well
|
10
|
+
%input{:name => "query", :type => "search", :value => query, :placeholder => "#{t("admin.misc.filter")}", :class => 'input-small'}
|
11
|
+
%button.btn.btn-primary{:type => "submit", :'data-disable-with' => "<i class='icon-white icon-refresh'></i> ".html_safe + t("admin.misc.refresh")}
|
12
|
+
%i.icon-white.icon-refresh
|
13
|
+
= t("admin.misc.refresh")
|
14
|
+
%table#history.table.table-striped.table-condensed
|
15
|
+
%thead
|
16
|
+
%tr
|
17
|
+
- columns = []
|
18
|
+
- columns << { :property_name => "created_at", :css_class => "created_at",:link_text => t('admin.table_headers.created_at') }
|
19
|
+
- columns << { :property_name => "username", :css_class => "username", :link_text => t('admin.table_headers.username') }
|
20
|
+
- columns << { :property_name => "item", :css_class => "item", :link_text => t('admin.table_headers.item') } if @general
|
21
|
+
- columns << { :property_name => "message", :css_class => "message", :link_text => t('admin.table_headers.message') }
|
22
|
+
|
23
|
+
- columns.each do |column|
|
24
|
+
- property_name = column[:property_name]
|
25
|
+
- selected = (sort == property_name)
|
26
|
+
- sort_direction = selected ? (sort_reverse ? "headerSortUp" : "headerSortDown") : nil
|
27
|
+
- sort_location = send(path_method, params.except("sort_reverse").merge(:model_name => @abstract_model.to_param, :sort => property_name).merge(selected && sort_reverse != "true" ? {:sort_reverse => "true"} : {}))
|
28
|
+
%th{:class => "header #{column[:css_class]} #{sort_direction if selected}", :'data-href' => sort_location}= column[:link_text]
|
29
|
+
%tbody
|
30
|
+
- @history.each_with_index do |object, index|
|
31
|
+
%tr
|
32
|
+
- unless object.created_at.nil?
|
33
|
+
%td= l(object.created_at, :format => :long, :default => l(object.created_at, :format => :long, :locale => :en))
|
34
|
+
%td= object.username
|
35
|
+
- if @general
|
36
|
+
%td= object.item
|
37
|
+
%td= object.message
|
38
|
+
|
39
|
+
- unless params[:all] || !@history.respond_to?(:current_page)
|
40
|
+
= paginate(@history, :theme => 'twitter-bootstrap')
|
41
|
+
= link_to(t("admin.misc.show_all"), send(path_method, params.merge(:all => true)), :class => "show-all btn") unless (tc = @history.total_count) <= @history.size || tc > 100
|
42
|
+
|
@@ -0,0 +1,140 @@
|
|
1
|
+
:ruby
|
2
|
+
require 'rails_admin/config/fields/types/datetime.rb'
|
3
|
+
query = params[:query]
|
4
|
+
params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export, :_pjax)
|
5
|
+
params.delete(:query) if params[:query].blank?
|
6
|
+
params.delete(:sort_reverse) unless params[:sort_reverse] == 'true'
|
7
|
+
sort_reverse = params[:sort_reverse]
|
8
|
+
sort = params[:sort]
|
9
|
+
params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
|
10
|
+
|
11
|
+
export_action = RailsAdmin::Config::Actions.find(:export, { :controller => self.controller, :abstract_model => @abstract_model })
|
12
|
+
export_action = export_action && authorized?(export_action.authorization_key, @abstract_model) ? export_action : nil
|
13
|
+
|
14
|
+
properties = @model_config.list.with(:view => self, :object => @abstract_model.model.new).visible_fields
|
15
|
+
# columns paginate
|
16
|
+
@filterable_fields = @model_config.list.fields.select(&:filterable?)
|
17
|
+
sets = get_column_sets(properties)
|
18
|
+
properties = sets[params[:set].to_i] || []
|
19
|
+
other_left = ((params[:set].to_i - 1) >= 0) && sets[params[:set].to_i - 1].present?
|
20
|
+
other_right = sets[params[:set].to_i + 1].present?
|
21
|
+
@index = 0
|
22
|
+
@ordered_filters = (params[:f] || @model_config.list.filters).inject({}) { |memo, filter|
|
23
|
+
field_name = filter.is_a?(Array) ? filter.first : filter
|
24
|
+
(filter.is_a?(Array) ? filter.last : { (@index += 1) => { "value" => '' } }) .each do |index, filter_hash|
|
25
|
+
unless filter_hash['disabled']
|
26
|
+
memo[index] = { field_name => filter_hash }
|
27
|
+
else
|
28
|
+
params[:f].delete(field_name)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
memo
|
32
|
+
}.to_a.sort_by(&:first)
|
33
|
+
|
34
|
+
@ordered_filter_string = @ordered_filters.map do |duplet|
|
35
|
+
filter_index = duplet[0]
|
36
|
+
filter_for_field = duplet[1]
|
37
|
+
filter_name = filter_for_field.keys.first
|
38
|
+
filter_hash = filter_for_field.values.first
|
39
|
+
field = @filterable_fields.find{ |field| field.name == filter_name.to_sym }
|
40
|
+
field_options = case field.type
|
41
|
+
when :enum
|
42
|
+
options_for_select(field.with(:object => @abstract_model.model.new).enum, filter_hash['v'])
|
43
|
+
else
|
44
|
+
''
|
45
|
+
end
|
46
|
+
%{
|
47
|
+
$.filters.append(#{field.label.to_json}, #{field.name.to_json}, #{field.type.to_json}, #{filter_hash['v'].to_json}, #{filter_hash['o'].to_json}, #{field_options.to_json}, #{filter_index.to_json});
|
48
|
+
}
|
49
|
+
end.join.html_safe if @ordered_filters
|
50
|
+
|
51
|
+
|
52
|
+
= content_for :contextual_tabs do
|
53
|
+
= bulk_menu
|
54
|
+
- if @filterable_fields.present?
|
55
|
+
%li.dropdown{:style => 'float:right'}
|
56
|
+
%a.dropdown-toggle{:href => '#', :'data-toggle' => "dropdown"}
|
57
|
+
= t('admin.misc.add_filter')
|
58
|
+
%b.caret
|
59
|
+
%ul.dropdown-menu#filters{:style => 'left:auto; right:0;'}
|
60
|
+
- @filterable_fields.each do |field|
|
61
|
+
- field_options = case field.type
|
62
|
+
- when :enum
|
63
|
+
- options_for_select(field.with(:object => @abstract_model.model.new).enum)
|
64
|
+
- else
|
65
|
+
- ''
|
66
|
+
%li
|
67
|
+
%a{:href => '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => ""}= field.label
|
68
|
+
|
69
|
+
#list{:'data-pjax-container' => true}
|
70
|
+
%script
|
71
|
+
jQuery(function($) {
|
72
|
+
$.filters.options.regional = {
|
73
|
+
datePicker: {
|
74
|
+
dateFormat: #{raw I18n.t("admin.misc.filter_date_format", :default => I18n.t("admin.misc.filter_date_format", :locale => :en)).to_json},
|
75
|
+
dayNames: #{raw RailsAdmin::Config::Fields::Types::Datetime.day_names.to_json},
|
76
|
+
dayNamesShort: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
|
77
|
+
dayNamesMin: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
|
78
|
+
firstDay: "1",
|
79
|
+
monthNames: #{raw RailsAdmin::Config::Fields::Types::Datetime.month_names.to_json},
|
80
|
+
monthNamesShort: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_month_names.to_json},
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
= @ordered_filter_string
|
85
|
+
|
86
|
+
});
|
87
|
+
%style
|
88
|
+
- properties.select{ |p| p.column_width.present? }.each do |property|
|
89
|
+
= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }"
|
90
|
+
= "#list td.#{property.css_class} { max-width: #{property.column_width}px; }"
|
91
|
+
= form_tag(index_path(params.except(*%w[page f query])), :method => :get, :class => "pjax-form form-inline") do
|
92
|
+
.well
|
93
|
+
%span#filters_box
|
94
|
+
%hr.filters_box{:style => "display:#{@ordered_filters.empty? ? 'none' : 'block'}"}
|
95
|
+
%input.input-small{:name => "query", :type => "search", :value => query, :placeholder => t("admin.misc.filter")}
|
96
|
+
%button.btn.btn-primary{:type => "submit", :'data-disable-with' => "<i class='icon-white icon-refresh'></i> ".html_safe + t("admin.misc.refresh")}
|
97
|
+
%i.icon-white.icon-refresh
|
98
|
+
= t("admin.misc.refresh")
|
99
|
+
- if export_action
|
100
|
+
%span{:style => 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), :class => 'btn btn-info'
|
101
|
+
|
102
|
+
= form_tag bulk_action_path(:model_name => @abstract_model.to_param), :method => :post, :id => "bulk_form", :class => "form" do
|
103
|
+
= hidden_field_tag :bulk_action
|
104
|
+
%table.table.table-condensed.table-striped
|
105
|
+
%thead
|
106
|
+
%tr
|
107
|
+
%th.shrink
|
108
|
+
%input.toggle{:type => "checkbox"}
|
109
|
+
- if other_left
|
110
|
+
%th.other.left.shrink= "..."
|
111
|
+
- properties.each do |property|
|
112
|
+
- selected = (sort == property.name.to_s)
|
113
|
+
- if property.sortable
|
114
|
+
- sort_location = index_path params.except('sort_reverse').except('page').merge(:sort => property.name).merge(selected && sort_reverse != "true" ? {:sort_reverse => "true"} : {})
|
115
|
+
- sort_direction = selected ? (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown") : nil
|
116
|
+
%th{:class => "#{property.sortable && "header pjax" || nil} #{property.sortable && sort_direction ? sort_direction : nil} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location)}= property.label
|
117
|
+
- if other_right
|
118
|
+
%th.other.right.shrink= "..."
|
119
|
+
%th.last.shrink
|
120
|
+
%tbody
|
121
|
+
- @objects.each do |object|
|
122
|
+
%tr
|
123
|
+
%td
|
124
|
+
= check_box_tag "bulk_ids[]", object.id, false
|
125
|
+
- if @other_left_link ||= other_left && index_path(params.except('set').merge(params[:set].to_i != 1 ? {:set => (params[:set].to_i - 1)} : {}))
|
126
|
+
%td.other.left= link_to "...", @other_left_link, :class => 'pjax'
|
127
|
+
- properties.map{ |property| property.bind(:object, object) }.each do |property|
|
128
|
+
- value = property.pretty_value
|
129
|
+
%td{:class => "#{property.css_class} #{property.type_css_class}", :title => strip_tags(value)}= value
|
130
|
+
- if @other_right_link ||= other_right && index_path(params.merge(:set => (params[:set].to_i + 1)))
|
131
|
+
%td.other.right= link_to "...", @other_right_link, :class => 'pjax'
|
132
|
+
%td.last.links
|
133
|
+
%ul.inline= menu_for :member, @abstract_model, object, true
|
134
|
+
- unless params[:all]
|
135
|
+
- total_count = @objects.total_count
|
136
|
+
= paginate(@objects, :theme => 'twitter-bootstrap', :remote => true)
|
137
|
+
= link_to(t("admin.misc.show_all"), index_path(params.merge(:all => true)), :class => "show-all btn clearfix pjax") unless total_count > 100 || total_count <= @objects.size
|
138
|
+
.clearfix.total-count= "#{total_count} #{@model_config.label_plural.downcase}"
|
139
|
+
- else
|
140
|
+
.clearfix.total-count= "#{@objects.size} #{@model_config.label_plural.downcase}"
|