admin_assistant 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/Rakefile +34 -6
- data/VERSION +1 -0
- data/admin_assistant.gemspec +440 -0
- data/doc/img/blog_posts-index.png +0 -0
- data/install.rb +25 -4
- data/lib/admin_assistant/active_record_column.rb +133 -45
- data/lib/admin_assistant/association_target.rb +16 -3
- data/lib/admin_assistant/belongs_to_column.rb +18 -10
- data/lib/admin_assistant/builder.rb +67 -30
- data/lib/admin_assistant/column.rb +153 -71
- data/lib/admin_assistant/date_time_range_end_point_selector.rb +340 -0
- data/lib/admin_assistant/default_search_column.rb +3 -7
- data/lib/admin_assistant/form_view.rb +114 -10
- data/lib/admin_assistant/has_many_column.rb +56 -0
- data/lib/admin_assistant/index.rb +220 -83
- data/lib/admin_assistant/polymorphic_belongs_to_column.rb +1 -1
- data/lib/admin_assistant/request/base.rb +196 -67
- data/lib/admin_assistant/request/create.rb +55 -7
- data/lib/admin_assistant/request/edit.rb +1 -2
- data/lib/admin_assistant/request/index.rb +16 -9
- data/lib/admin_assistant/request/new.rb +19 -7
- data/lib/admin_assistant/request/update.rb +28 -13
- data/lib/admin_assistant/search.rb +17 -2
- data/lib/admin_assistant/virtual_column.rb +15 -7
- data/lib/admin_assistant.rb +101 -81
- data/lib/javascripts/admin_assistant.js +1 -1
- data/lib/stylesheets/activescaffold.css +6 -1
- data/lib/stylesheets/default.css +17 -0
- data/lib/views/form.html.erb +7 -3
- data/lib/views/index.html.erb +13 -8
- data/lib/views/multi_form.html.erb +71 -0
- data/lib/views/show.html.erb +4 -4
- data/test_rails_app/README +256 -0
- data/test_rails_app/Rakefile +13 -0
- data/test_rails_app/app/controllers/admin/appointments2_controller.rb +15 -0
- data/test_rails_app/app/controllers/admin/appointments_controller.rb +11 -0
- data/test_rails_app/app/controllers/admin/blog_posts2_controller.rb +138 -0
- data/test_rails_app/app/controllers/admin/blog_posts3_controller.rb +76 -0
- data/test_rails_app/app/controllers/admin/blog_posts4_controller.rb +21 -0
- data/test_rails_app/app/controllers/admin/blog_posts5_controller.rb +27 -0
- data/test_rails_app/app/controllers/admin/blog_posts6_controller.rb +10 -0
- data/test_rails_app/app/controllers/admin/blog_posts_controller.rb +8 -0
- data/test_rails_app/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +15 -0
- data/test_rails_app/app/controllers/admin/blog_posts_read_only_controller.rb +19 -0
- data/test_rails_app/app/controllers/admin/bookmarks_controller.rb +11 -0
- data/test_rails_app/app/controllers/admin/comments2_controller.rb +14 -0
- data/test_rails_app/app/controllers/admin/comments_controller.rb +12 -0
- data/test_rails_app/app/controllers/admin/file_column_images2_controller.rb +10 -0
- data/test_rails_app/app/controllers/admin/file_column_images_controller.rb +6 -0
- data/test_rails_app/app/controllers/admin/images2_controller.rb +11 -0
- data/test_rails_app/app/controllers/admin/images_controller.rb +6 -0
- data/test_rails_app/app/controllers/admin/misconfigured1_controller.rb +7 -0
- data/test_rails_app/app/controllers/admin/not_migrated_yets_controller.rb +9 -0
- data/test_rails_app/app/controllers/admin/product_categories2_controller.rb +7 -0
- data/test_rails_app/app/controllers/admin/product_categories_controller.rb +5 -0
- data/test_rails_app/app/controllers/admin/products2_controller.rb +15 -0
- data/test_rails_app/app/controllers/admin/products_controller.rb +31 -0
- data/test_rails_app/app/controllers/admin/television_airings_controller.rb +5 -0
- data/test_rails_app/app/controllers/admin/television_time_slots_controller.rb +5 -0
- data/test_rails_app/app/controllers/admin/users2_controller.rb +10 -0
- data/test_rails_app/app/controllers/admin/users_controller.rb +63 -0
- data/test_rails_app/app/controllers/application.rb +16 -0
- data/test_rails_app/app/controllers/application_controller.rb +16 -0
- data/test_rails_app/app/controllers/blog_posts_controller.rb +5 -0
- data/test_rails_app/app/helpers/admin/appointments2_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/appointments_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/blog_posts2_helper.rb +27 -0
- data/test_rails_app/app/helpers/admin/blog_posts3_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/blog_posts4_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/blog_posts6_helper.rb +16 -0
- data/test_rails_app/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +29 -0
- data/test_rails_app/app/helpers/admin/blog_posts_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/blog_posts_read_only_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/bookmarks_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/comments2_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/comments_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/file_column_images2_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/file_column_images_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/images2_helper.rb +8 -0
- data/test_rails_app/app/helpers/admin/images_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/misconfigured1_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/not_migrated_yets_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/product_categories2_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/product_categories_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/products2_helper.rb +3 -0
- data/test_rails_app/app/helpers/admin/products_helper.rb +6 -0
- data/test_rails_app/app/helpers/admin/television_airings_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/television_time_slots_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/users2_helper.rb +2 -0
- data/test_rails_app/app/helpers/admin/users_helper.rb +25 -0
- data/test_rails_app/app/helpers/application_helper.rb +3 -0
- data/test_rails_app/app/helpers/blog_posts_helper.rb +2 -0
- data/test_rails_app/app/models/appointment.rb +5 -0
- data/test_rails_app/app/models/blog_post.rb +14 -0
- data/test_rails_app/app/models/blog_post_tag.rb +6 -0
- data/test_rails_app/app/models/bookmark.rb +6 -0
- data/test_rails_app/app/models/comment.rb +4 -0
- data/test_rails_app/app/models/file_column_image.rb +3 -0
- data/test_rails_app/app/models/image.rb +3 -0
- data/test_rails_app/app/models/not_migrated_yet.rb +2 -0
- data/test_rails_app/app/models/product.rb +7 -0
- data/test_rails_app/app/models/product_category.rb +9 -0
- data/test_rails_app/app/models/tag.rb +4 -0
- data/test_rails_app/app/models/television_airing.rb +3 -0
- data/test_rails_app/app/models/television_time_slot.rb +11 -0
- data/test_rails_app/app/models/user.rb +14 -0
- data/test_rails_app/app/views/admin/appointments/_subject_input.html.erb +2 -0
- data/test_rails_app/app/views/admin/appointments2/_time_input.html.erb +31 -0
- data/test_rails_app/app/views/admin/blog_posts2/_after_form.html.erb +5 -0
- data/test_rails_app/app/views/admin/blog_posts2/_after_index.html.erb +1 -0
- data/test_rails_app/app/views/admin/blog_posts2/_after_tags_input.html.erb +16 -0
- data/test_rails_app/app/views/admin/blog_posts2/_before_index.html.erb +2 -0
- data/test_rails_app/app/views/admin/blog_posts5/_after_index_header.html.erb +8 -0
- data/test_rails_app/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +1 -0
- data/test_rails_app/app/views/admin/products/_name_input.html.erb +2 -0
- data/test_rails_app/app/views/admin/products/_percent_off_input.html.erb +2 -0
- data/test_rails_app/app/views/admin/products/_price_input.html.erb +10 -0
- data/test_rails_app/app/views/blog_posts/show.html.erb +13 -0
- data/test_rails_app/app/views/layouts/admin.html.erb +31 -0
- data/test_rails_app/config/boot.rb +109 -0
- data/test_rails_app/config/database.yml +28 -0
- data/test_rails_app/config/environment.rb +78 -0
- data/test_rails_app/config/environments/development.rb +17 -0
- data/test_rails_app/config/environments/production.rb +24 -0
- data/test_rails_app/config/environments/test.rb +24 -0
- data/test_rails_app/config/initializers/inflections.rb +10 -0
- data/test_rails_app/config/initializers/mime_types.rb +5 -0
- data/test_rails_app/config/initializers/new_rails_defaults.rb +17 -0
- data/test_rails_app/config/locales/en.yml +5 -0
- data/test_rails_app/config/routes.rb +43 -0
- data/test_rails_app/db/migrate/20090213215514_create_blog_posts.rb +12 -0
- data/test_rails_app/db/migrate/20090217225542_add_body_to_blog_posts.rb +9 -0
- data/test_rails_app/db/migrate/20090221220917_create_tags.rb +13 -0
- data/test_rails_app/db/migrate/20090221220947_create_blog_post_tags.rb +14 -0
- data/test_rails_app/db/migrate/20090222162204_add_textile_to_blog_posts.rb +9 -0
- data/test_rails_app/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +9 -0
- data/test_rails_app/db/migrate/20090301191722_create_images.rb +16 -0
- data/test_rails_app/db/migrate/20090305165345_create_accounts.rb +14 -0
- data/test_rails_app/db/migrate/20090307225027_rename_accounts_to_users.rb +9 -0
- data/test_rails_app/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +9 -0
- data/test_rails_app/db/migrate/20090309185114_change_blog_posts_textile.rb +9 -0
- data/test_rails_app/db/migrate/20090309193635_create_products.rb +14 -0
- data/test_rails_app/db/migrate/20090309203056_create_comments.rb +15 -0
- data/test_rails_app/db/migrate/20090323005947_create_file_column_images.rb +12 -0
- data/test_rails_app/db/migrate/20090326160049_add_birthday_to_users.rb +9 -0
- data/test_rails_app/db/migrate/20090326223606_add_state_to_users.rb +9 -0
- data/test_rails_app/db/migrate/20090503134004_add_file_column_image_to_products.rb +9 -0
- data/test_rails_app/db/migrate/20090617173651_create_bookmarks.rb +15 -0
- data/test_rails_app/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +9 -0
- data/test_rails_app/db/migrate/20090625144313_add_avatar_fields_to_user.rb +11 -0
- data/test_rails_app/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +9 -0
- data/test_rails_app/db/migrate/20090701171857_add_force_textile_to_users.rb +9 -0
- data/test_rails_app/db/migrate/20090704163647_add_deleted_at_to_products.rb +9 -0
- data/test_rails_app/db/migrate/20090704173800_add_sale_fields_to_products.rb +13 -0
- data/test_rails_app/db/migrate/20090714024501_create_product_categories.rb +15 -0
- data/test_rails_app/db/migrate/20090819162835_add_admin_level_to_users.rb +9 -0
- data/test_rails_app/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +11 -0
- data/test_rails_app/db/migrate/20091221011256_add_position_to_product_categories.rb +9 -0
- data/test_rails_app/db/migrate/20091222160814_create_appointments.rb +14 -0
- data/test_rails_app/db/migrate/20091227224547_add_user_id_to_appointments.rb +9 -0
- data/test_rails_app/db/migrate/20100214213359_create_television_time_slots.rb +13 -0
- data/test_rails_app/db/migrate/20100214213451_create_television_airings.rb +15 -0
- data/test_rails_app/doc/README_FOR_APP +5 -0
- data/test_rails_app/lib/tasks/rspec.rake +163 -0
- data/test_rails_app/public/404.html +30 -0
- data/test_rails_app/public/422.html +30 -0
- data/test_rails_app/public/500.html +33 -0
- data/test_rails_app/public/dispatch.cgi +10 -0
- data/test_rails_app/public/dispatch.fcgi +24 -0
- data/test_rails_app/public/dispatch.rb +10 -0
- data/test_rails_app/public/favicon.ico +0 -0
- data/test_rails_app/public/images/rails.png +0 -0
- data/test_rails_app/public/index.html +274 -0
- data/test_rails_app/public/javascripts/application.js +2 -0
- data/test_rails_app/public/javascripts/controls.js +963 -0
- data/test_rails_app/public/javascripts/dragdrop.js +973 -0
- data/test_rails_app/public/javascripts/effects.js +1128 -0
- data/test_rails_app/public/javascripts/prototype.js +4320 -0
- data/test_rails_app/public/robots.txt +5 -0
- data/test_rails_app/public/stylesheets/admin.css +3 -0
- data/test_rails_app/public/stylesheets/scaffold.css +54 -0
- data/test_rails_app/script/about +4 -0
- data/test_rails_app/script/autospec +5 -0
- data/test_rails_app/script/console +3 -0
- data/test_rails_app/script/dbconsole +3 -0
- data/test_rails_app/script/destroy +3 -0
- data/test_rails_app/script/generate +3 -0
- data/test_rails_app/script/performance/benchmarker +3 -0
- data/test_rails_app/script/performance/profiler +3 -0
- data/test_rails_app/script/performance/request +3 -0
- data/test_rails_app/script/plugin +3 -0
- data/test_rails_app/script/populate_tables.rb +49 -0
- data/test_rails_app/script/process/inspector +3 -0
- data/test_rails_app/script/process/reaper +3 -0
- data/test_rails_app/script/process/spawner +3 -0
- data/test_rails_app/script/runner +3 -0
- data/test_rails_app/script/server +3 -0
- data/test_rails_app/script/spec +5 -0
- data/test_rails_app/script/spec_server +125 -0
- data/test_rails_app/spec/controllers/admin/appointments2_controller_spec.rb +88 -0
- data/test_rails_app/spec/controllers/admin/appointments_controller_spec.rb +419 -0
- data/test_rails_app/spec/controllers/admin/blog_posts2_controller_spec.rb +1021 -0
- data/test_rails_app/spec/controllers/admin/blog_posts3_controller_spec.rb +532 -0
- data/test_rails_app/spec/controllers/admin/blog_posts4_controller_spec.rb +231 -0
- data/test_rails_app/spec/controllers/admin/blog_posts5_controller_spec.rb +77 -0
- data/test_rails_app/spec/controllers/admin/blog_posts6_controller_spec.rb +49 -0
- data/test_rails_app/spec/controllers/admin/blog_posts_controller_spec.rb +987 -0
- data/test_rails_app/spec/controllers/admin/blog_posts_custom_new_and_edit_controller_spec.rb +99 -0
- data/test_rails_app/spec/controllers/admin/blog_posts_read_only_controller_spec.rb +94 -0
- data/test_rails_app/spec/controllers/admin/bookmarks_controller_spec.rb +505 -0
- data/test_rails_app/spec/controllers/admin/comments2_controller_spec.rb +70 -0
- data/test_rails_app/spec/controllers/admin/comments_controller_spec.rb +82 -0
- data/test_rails_app/spec/controllers/admin/file_column_images2_controller_spec.rb +25 -0
- data/test_rails_app/spec/controllers/admin/file_column_images_controller_spec.rb +82 -0
- data/test_rails_app/spec/controllers/admin/images2_controller_spec.rb +44 -0
- data/test_rails_app/spec/controllers/admin/images_controller_spec.rb +97 -0
- data/test_rails_app/spec/controllers/admin/misconfigured1_controller_spec.rb +21 -0
- data/test_rails_app/spec/controllers/admin/not_migrated_yets_controller_spec.rb +10 -0
- data/test_rails_app/spec/controllers/admin/product_categories2_controller_spec.rb +215 -0
- data/test_rails_app/spec/controllers/admin/product_categories_controller_spec.rb +19 -0
- data/test_rails_app/spec/controllers/admin/products2_controller_spec.rb +203 -0
- data/test_rails_app/spec/controllers/admin/products_controller_spec.rb +255 -0
- data/test_rails_app/spec/controllers/admin/television_airings_controller_spec.rb +32 -0
- data/test_rails_app/spec/controllers/admin/television_time_slots_controller_spec.rb +10 -0
- data/test_rails_app/spec/controllers/admin/users2_controller_spec.rb +65 -0
- data/test_rails_app/spec/controllers/admin/users_controller_spec.rb +344 -0
- data/test_rails_app/spec/controllers/blog_posts_controller_spec.rb +13 -0
- data/test_rails_app/spec/data/ruby_throated.jpg +0 -0
- data/test_rails_app/spec/data/tweenbot.jpg +0 -0
- data/test_rails_app/spec/fixtures/appointments.yml +9 -0
- data/test_rails_app/spec/fixtures/blog_post_tags.yml +9 -0
- data/test_rails_app/spec/fixtures/blog_posts.yml +7 -0
- data/test_rails_app/spec/fixtures/bookmarks.yml +11 -0
- data/test_rails_app/spec/fixtures/comments.yml +11 -0
- data/test_rails_app/spec/fixtures/file_column_images.yml +7 -0
- data/test_rails_app/spec/fixtures/images.yml +7 -0
- data/test_rails_app/spec/fixtures/not_migrated_yets.yml +7 -0
- data/test_rails_app/spec/fixtures/product_categories.yml +7 -0
- data/test_rails_app/spec/fixtures/products.yml +9 -0
- data/test_rails_app/spec/fixtures/tags.yml +7 -0
- data/test_rails_app/spec/fixtures/television_airings.yml +11 -0
- data/test_rails_app/spec/fixtures/television_time_slots.yml +7 -0
- data/test_rails_app/spec/fixtures/users.yml +9 -0
- data/test_rails_app/spec/helpers/admin/appointments2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/appointments_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/blog_posts2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/blog_posts3_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/blog_posts4_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/blog_posts_custom_new_and_edit_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/blog_posts_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/blog_posts_read_only_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/bookmarks_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/comments2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/comments_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/file_column_images2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/file_column_images_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/images2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/images_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/misconfigured1_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/not_migrated_yets_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/product_categories2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/product_categories_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/products2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/products_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/television_airings_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/television_time_slots_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/users2_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/admin/users_helper_spec.rb +11 -0
- data/test_rails_app/spec/helpers/blog_posts_helper_spec.rb +11 -0
- data/test_rails_app/spec/models/appointment_spec.rb +16 -0
- data/test_rails_app/spec/models/blog_post_spec.rb +13 -0
- data/test_rails_app/spec/models/blog_post_tag_spec.rb +14 -0
- data/test_rails_app/spec/models/bookmark_spec.rb +15 -0
- data/test_rails_app/spec/models/comment_spec.rb +15 -0
- data/test_rails_app/spec/models/file_column_image_spec.rb +12 -0
- data/test_rails_app/spec/models/image_spec.rb +12 -0
- data/test_rails_app/spec/models/not_migrated_yet_spec.rb +15 -0
- data/test_rails_app/spec/models/product_category_spec.rb +15 -0
- data/test_rails_app/spec/models/product_spec.rb +14 -0
- data/test_rails_app/spec/models/tag_spec.rb +13 -0
- data/test_rails_app/spec/models/television_airing_spec.rb +15 -0
- data/test_rails_app/spec/models/television_time_slot_spec.rb +13 -0
- data/test_rails_app/spec/models/user_spec.rb +14 -0
- data/test_rails_app/spec/rcov.opts +2 -0
- data/test_rails_app/spec/spec.opts +4 -0
- data/test_rails_app/spec/spec_helper.rb +88 -0
- data/test_rails_app/spec/spec_or_test_helper.rb +49 -0
- data/test_rails_app/test/fixtures/file_column_images.yml +7 -0
- data/test_rails_app/test/integration/admin_blog_posts2_integration_test.rb +16 -0
- data/test_rails_app/test/integration/admin_blog_posts5_integration_test.rb +19 -0
- data/test_rails_app/test/integration/admin_blog_posts_integration_test.rb +25 -0
- data/test_rails_app/test/test_helper.rb +28 -0
- data/test_rails_app/vendor/plugins/file_column/CHANGELOG +69 -0
- data/test_rails_app/vendor/plugins/file_column/README +54 -0
- data/test_rails_app/vendor/plugins/file_column/Rakefile +36 -0
- data/test_rails_app/vendor/plugins/file_column/TODO +6 -0
- data/test_rails_app/vendor/plugins/file_column/init.rb +13 -0
- data/test_rails_app/vendor/plugins/file_column/lib/file_column.rb +723 -0
- data/test_rails_app/vendor/plugins/file_column/lib/file_column_helper.rb +150 -0
- data/test_rails_app/vendor/plugins/file_column/lib/file_compat.rb +28 -0
- data/test_rails_app/vendor/plugins/file_column/lib/magick_file_column.rb +260 -0
- data/test_rails_app/vendor/plugins/file_column/lib/rails_file_column.rb +19 -0
- data/test_rails_app/vendor/plugins/file_column/lib/test_case.rb +124 -0
- data/test_rails_app/vendor/plugins/file_column/lib/validations.rb +112 -0
- data/test_rails_app/vendor/plugins/file_column/test/abstract_unit.rb +63 -0
- data/test_rails_app/vendor/plugins/file_column/test/connection.rb +17 -0
- data/test_rails_app/vendor/plugins/file_column/test/file_column_helper_test.rb +97 -0
- data/test_rails_app/vendor/plugins/file_column/test/file_column_test.rb +650 -0
- data/test_rails_app/vendor/plugins/file_column/test/fixtures/entry.rb +32 -0
- data/test_rails_app/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +1 -0
- data/test_rails_app/vendor/plugins/file_column/test/fixtures/kerb.jpg +0 -0
- data/test_rails_app/vendor/plugins/file_column/test/fixtures/mysql.sql +25 -0
- data/test_rails_app/vendor/plugins/file_column/test/fixtures/schema.rb +10 -0
- data/test_rails_app/vendor/plugins/file_column/test/fixtures/skanthak.png +0 -0
- data/test_rails_app/vendor/plugins/file_column/test/magick_test.rb +380 -0
- data/test_rails_app/vendor/plugins/file_column/test/magick_view_only_test.rb +21 -0
- data/vendor/ar_query/ar_query.gemspec +16 -0
- data/website/_layouts/api.html +39 -0
- data/website/_layouts/default.html +34 -0
- data/website/api/core.markdown +106 -0
- data/website/api/destroy.markdown +25 -0
- data/website/api/form.markdown +291 -0
- data/website/api/idx.markdown +286 -0
- data/website/api/index.markdown +147 -0
- data/website/api/search.markdown +108 -0
- data/website/api/show.markdown +22 -0
- data/website/community.markdown +27 -0
- data/website/css/lightbox.css +29 -0
- data/website/css/main.css +70 -0
- data/website/design_principles.markdown +50 -0
- data/website/getting_started.markdown +10 -0
- data/website/img/blog_posts-index.png +0 -0
- data/website/img/blog_posts-search.png +0 -0
- data/website/img/lightbox/bullet.gif +0 -0
- data/website/img/lightbox/close.gif +0 -0
- data/website/img/lightbox/closelabel.gif +0 -0
- data/website/img/lightbox/donate-button.gif +0 -0
- data/website/img/lightbox/download-icon.gif +0 -0
- data/website/img/lightbox/image-1.jpg +0 -0
- data/website/img/lightbox/loading.gif +0 -0
- data/website/img/lightbox/nextlabel.gif +0 -0
- data/website/img/lightbox/prevlabel.gif +0 -0
- data/website/img/lightbox/thumb-1.jpg +0 -0
- data/website/img/screen1-thumb.png +0 -0
- data/website/img/screen1.png +0 -0
- data/website/img/screen10-thumb.png +0 -0
- data/website/img/screen10.png +0 -0
- data/website/img/screen11-thumb.png +0 -0
- data/website/img/screen11.png +0 -0
- data/website/img/screen2-thumb.png +0 -0
- data/website/img/screen2.png +0 -0
- data/website/img/screen3-thumb.png +0 -0
- data/website/img/screen3.png +0 -0
- data/website/img/screen4-thumb.png +0 -0
- data/website/img/screen4.png +0 -0
- data/website/img/screen5-thumb.png +0 -0
- data/website/img/screen5.png +0 -0
- data/website/img/screen6-thumb.png +0 -0
- data/website/img/screen6.png +0 -0
- data/website/img/screen7-thumb.png +0 -0
- data/website/img/screen7.png +0 -0
- data/website/img/screen8-thumb.png +0 -0
- data/website/img/screen8.png +0 -0
- data/website/img/screen9-thumb.png +0 -0
- data/website/img/screen9.png +0 -0
- data/website/img/user-form.png +0 -0
- data/website/index.markdown +35 -0
- data/website/js/builder.js +136 -0
- data/website/js/effects.js +1122 -0
- data/website/js/lightbox.js +497 -0
- data/website/js/prototype.js +4221 -0
- data/website/js/scriptaculous.js +58 -0
- data/website/quick_start.markdown +44 -0
- data/website/screenshots.markdown +27 -0
- data/website/tutorial.markdown +56 -0
- metadata +391 -23
data/lib/admin_assistant.rb
CHANGED
@@ -10,15 +10,23 @@ end
|
|
10
10
|
require 'will_paginate'
|
11
11
|
|
12
12
|
class AdminAssistant
|
13
|
-
|
14
|
-
:index_settings, :model_class, :show_settings
|
15
|
-
attr_accessor :actions, :custom_destroy
|
16
|
-
attr_writer :model_class_name
|
13
|
+
cattr_accessor :request_start_time
|
17
14
|
|
15
|
+
def self.profile(msg)
|
16
|
+
if self.request_start_time
|
17
|
+
Rails.logger.info "#{msg}: #{Time.now - self.request_start_time}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
18
21
|
def self.template_file(template_name)
|
19
22
|
"#{File.dirname(__FILE__)}/views/#{template_name}.html.erb"
|
20
23
|
end
|
21
24
|
|
25
|
+
attr_reader :base_settings, :controller_class, :form_settings,
|
26
|
+
:index_settings, :model_class, :show_settings
|
27
|
+
attr_accessor :actions, :custom_destroy, :default_search_matches_on
|
28
|
+
attr_writer :model_class_name
|
29
|
+
|
22
30
|
def initialize(controller_class, model_class)
|
23
31
|
@controller_class, @model_class = controller_class, model_class
|
24
32
|
@model = Model.new model_class
|
@@ -27,6 +35,7 @@ class AdminAssistant
|
|
27
35
|
@index_settings = IndexSettings.new self
|
28
36
|
@show_settings = ShowSettings.new self
|
29
37
|
@base_settings = BaseSettings.new self
|
38
|
+
@default_search_matches_on = @model.searchable_columns.map &:name
|
30
39
|
end
|
31
40
|
|
32
41
|
def [](name)
|
@@ -34,7 +43,7 @@ class AdminAssistant
|
|
34
43
|
end
|
35
44
|
|
36
45
|
def accumulate_columns(names)
|
37
|
-
columns = paperclip_attachments.map { |paperclip_attachment|
|
46
|
+
columns = @model.paperclip_attachments.map { |paperclip_attachment|
|
38
47
|
PaperclipColumn.new paperclip_attachment
|
39
48
|
}
|
40
49
|
names.each do |column_name|
|
@@ -51,34 +60,44 @@ class AdminAssistant
|
|
51
60
|
end
|
52
61
|
|
53
62
|
def autocomplete_actions
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
accumulate_belongs_to_columns(default_column_names).each { |column|
|
59
|
-
ac_actions << "autocomplete_#{column.name}".to_sym
|
63
|
+
@autocomplete_actions ||= begin
|
64
|
+
ac_actions = []
|
65
|
+
if [:new, :create, :edit, :update].any? { |action|
|
66
|
+
actions.include?(action)
|
60
67
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
68
|
+
defaults = @model.default_column_names
|
69
|
+
accumulate_belongs_to_columns(defaults).each { |column|
|
70
|
+
ac_actions << "autocomplete_#{column.name}".to_sym
|
71
|
+
}
|
72
|
+
end
|
73
|
+
if actions.include?(:index)
|
74
|
+
base_settings.all_polymorphic_types.each do |p_type|
|
75
|
+
ac_actions << "autocomplete_#{p_type.name.underscore.downcase}".to_sym
|
76
|
+
end
|
65
77
|
end
|
78
|
+
ac_actions.uniq
|
66
79
|
end
|
67
|
-
|
80
|
+
@autocomplete_actions
|
68
81
|
end
|
69
82
|
|
70
83
|
def column(name)
|
71
|
-
if file_columns.include?(name.to_s)
|
84
|
+
if @model.file_columns.include?(name.to_s)
|
72
85
|
FileColumnColumn.new name
|
73
|
-
elsif paperclip_attachments.include?(name)
|
86
|
+
elsif @model.paperclip_attachments.include?(name)
|
74
87
|
PaperclipColumn.new name
|
75
|
-
elsif (belongs_to_assoc = belongs_to_assoc(name) or
|
76
|
-
belongs_to_assoc = belongs_to_assoc_by_foreign_key(name))
|
88
|
+
elsif (belongs_to_assoc = @model.belongs_to_assoc(name) or
|
89
|
+
belongs_to_assoc = @model.belongs_to_assoc_by_foreign_key(name))
|
77
90
|
column_based_on_belongs_to_assoc name, belongs_to_assoc
|
78
|
-
elsif belongs_to_assoc = belongs_to_assoc_by_polymorphic_type(name)
|
91
|
+
elsif belongs_to_assoc = @model.belongs_to_assoc_by_polymorphic_type(name)
|
79
92
|
# skip it, actually
|
80
93
|
elsif (ar_column = @model_class.columns_hash[name.to_s])
|
81
94
|
ActiveRecordColumn.new ar_column
|
95
|
+
elsif has_many_assoc = @model.has_many_assoc(name)
|
96
|
+
HasManyColumn.new(
|
97
|
+
has_many_assoc,
|
98
|
+
:match_text_fields_in_search =>
|
99
|
+
search_settings[name].match_text_fields_for_association?
|
100
|
+
)
|
82
101
|
else
|
83
102
|
VirtualColumn.new name, @model_class, self
|
84
103
|
end
|
@@ -109,34 +128,28 @@ class AdminAssistant
|
|
109
128
|
controller.controller_path.gsub(%r|/|, '_')
|
110
129
|
end
|
111
130
|
|
112
|
-
def
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
131
|
+
def crudful_request_methods
|
132
|
+
[:create, :destroy, :edit, :index, :new, :update, :show]
|
133
|
+
end
|
134
|
+
|
135
|
+
def default_column_names
|
136
|
+
@model.default_column_names
|
137
|
+
end
|
138
|
+
|
139
|
+
def file_columns
|
140
|
+
@model.file_columns
|
117
141
|
end
|
118
142
|
|
119
143
|
def method_missing(meth, *args)
|
120
|
-
if
|
121
|
-
|
144
|
+
if crudful_request_methods.include?(meth) and args.size == 1
|
145
|
+
self.class.request_start_time = Time.now if ENV['PROFILE_LOGGING']
|
146
|
+
Request.dispatch meth, self, args.first
|
147
|
+
elsif autocomplete_actions && autocomplete_actions.include?(meth)
|
148
|
+
Request.dispatch :autocomplete, self, args.first
|
149
|
+
elsif meth.to_s =~ /(.*)\?/ && crudful_request_methods.include?($1.to_sym)
|
150
|
+
supports_action? $1
|
122
151
|
else
|
123
|
-
|
124
|
-
:create, :destroy, :edit, :index, :new, :update, :show
|
125
|
-
]
|
126
|
-
if request_methods.include?(meth) and args.size == 1
|
127
|
-
request_class = Request.const_get meth.to_s.capitalize
|
128
|
-
dispatch_to_request_method request_class, args.first
|
129
|
-
elsif autocomplete_actions && autocomplete_actions.include?(meth)
|
130
|
-
dispatch_to_request_method Request::Autocomplete, args.first
|
131
|
-
else
|
132
|
-
if meth.to_s =~ /(.*)\?/ && request_methods.include?($1.to_sym)
|
133
|
-
@controller_class.public_instance_methods.include?($1)
|
134
|
-
elsif @request.respond_to?(meth)
|
135
|
-
@request.send meth, *args
|
136
|
-
else
|
137
|
-
super
|
138
|
-
end
|
139
|
-
end
|
152
|
+
super
|
140
153
|
end
|
141
154
|
end
|
142
155
|
|
@@ -145,16 +158,23 @@ class AdminAssistant
|
|
145
158
|
@model_class.name.gsub(/([A-Z])/, ' \1')[1..-1].downcase
|
146
159
|
end
|
147
160
|
|
148
|
-
def
|
149
|
-
|
150
|
-
puts "#{msg}: #{Time.now - @request_start_time}"
|
151
|
-
end
|
161
|
+
def paperclip_attachments
|
162
|
+
@model.paperclip_attachments
|
152
163
|
end
|
153
164
|
|
154
165
|
def search_settings
|
155
166
|
@index_settings.search_settings
|
156
167
|
end
|
157
168
|
|
169
|
+
def supports_action?(action)
|
170
|
+
@memoized_action_booleans ||= {}
|
171
|
+
unless @memoized_action_booleans.has_key?(action)
|
172
|
+
@memoized_action_booleans[action] =
|
173
|
+
@controller_class.public_instance_methods.include?(action)
|
174
|
+
end
|
175
|
+
@memoized_action_booleans[action]
|
176
|
+
end
|
177
|
+
|
158
178
|
def url_params(a = action)
|
159
179
|
{:controller => @controller_class.controller_path, :action => a}
|
160
180
|
end
|
@@ -168,16 +188,20 @@ class AdminAssistant
|
|
168
188
|
|
169
189
|
module ControllerClassMethods
|
170
190
|
def admin_assistant_for(model_class, &block)
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
block
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
self.
|
179
|
-
self.
|
191
|
+
begin
|
192
|
+
self.admin_assistant = AdminAssistant.new(self, model_class)
|
193
|
+
builder = Builder.new self.admin_assistant
|
194
|
+
if block
|
195
|
+
block.call builder
|
196
|
+
end
|
197
|
+
self.helper AdminAssistant::Helper
|
198
|
+
self.admin_assistant.controller_actions.each do |action|
|
199
|
+
self.send(:define_method, action) do
|
200
|
+
self.class.admin_assistant.send(action, self)
|
201
|
+
end
|
180
202
|
end
|
203
|
+
rescue ActiveRecord::StatementInvalid
|
204
|
+
Rails.logger.info "Skipping admin_assistant_for for #{self.name} because the table doesn't exist in the DB. Hopefully that's because you're deploying with a migration."
|
181
205
|
end
|
182
206
|
end
|
183
207
|
end
|
@@ -186,6 +210,13 @@ class AdminAssistant
|
|
186
210
|
def initialize(ar_model)
|
187
211
|
@ar_model = ar_model
|
188
212
|
end
|
213
|
+
|
214
|
+
def accessors
|
215
|
+
@ar_model.instance_methods.
|
216
|
+
select { |m| m =~ /=$/ }.
|
217
|
+
map { |m| m.gsub(/=/, '')}.
|
218
|
+
select { |m| @ar_model.instance_methods.include?(m) }
|
219
|
+
end
|
189
220
|
|
190
221
|
def belongs_to_associations
|
191
222
|
@ar_model.reflect_on_all_associations.select { |assoc|
|
@@ -223,26 +254,25 @@ class AdminAssistant
|
|
223
254
|
unless @file_columns
|
224
255
|
@file_columns = []
|
225
256
|
if @ar_model.respond_to?(:file_column)
|
226
|
-
names_to_check = @ar_model.columns.map
|
227
|
-
names_to_check.
|
228
|
-
|
229
|
-
select { |m| m =~ /=$/ }.
|
230
|
-
map { |m| m.gsub(/=/, '')}.
|
231
|
-
select { |m| @ar_model.instance_methods.include?(m) }
|
232
|
-
)
|
233
|
-
names_to_check.uniq.each do |name|
|
234
|
-
suffixes = %w( relative_path dir relative_dir temp )
|
235
|
-
if suffixes.all? { |suffix|
|
257
|
+
names_to_check = @ar_model.columns.map(&:name).concat(accessors).uniq
|
258
|
+
@file_columns = names_to_check.select { |name|
|
259
|
+
%w( relative_path dir relative_dir temp ).all? { |suffix|
|
236
260
|
@ar_model.method_defined? "#{name}_#{suffix}".to_sym
|
237
261
|
}
|
238
|
-
|
239
|
-
end
|
240
|
-
end
|
262
|
+
}
|
241
263
|
end
|
242
264
|
end
|
243
265
|
@file_columns
|
244
266
|
end
|
245
267
|
|
268
|
+
def has_many_assoc(association_name)
|
269
|
+
@ar_model.reflect_on_all_associations.select { |assoc|
|
270
|
+
assoc.macro == :has_many
|
271
|
+
}.detect { |assoc|
|
272
|
+
assoc.name.to_s == association_name.to_s
|
273
|
+
}
|
274
|
+
end
|
275
|
+
|
246
276
|
def paperclip_attachments
|
247
277
|
pa = []
|
248
278
|
if @ar_model.respond_to?(:attachment_definitions)
|
@@ -265,13 +295,3 @@ end
|
|
265
295
|
|
266
296
|
ActionController::Base.send :include, AdminAssistant::ControllerMethods
|
267
297
|
|
268
|
-
css_dir = "#{RAILS_ROOT}/public/stylesheets/admin_assistant"
|
269
|
-
FileUtils.mkdir(css_dir) unless File.exist?(css_dir)
|
270
|
-
FileUtils.cp_r(Dir.glob("#{File.dirname(__FILE__)}/stylesheets/*"), css_dir)
|
271
|
-
FileUtils.copy(
|
272
|
-
"#{File.dirname(__FILE__)}/javascripts/admin_assistant.js",
|
273
|
-
"#{RAILS_ROOT}/public/javascripts/admin_assistant.js"
|
274
|
-
)
|
275
|
-
images_dir = "#{RAILS_ROOT}/public/images/admin_assistant"
|
276
|
-
FileUtils.mkdir(images_dir) unless File.exist?(images_dir)
|
277
|
-
FileUtils.cp_r(Dir.glob("#{File.dirname(__FILE__)}/images/*"), images_dir)
|
@@ -152,7 +152,7 @@ AdminAssistant.RestrictedAutocompleter.prototype = {
|
|
152
152
|
onHide: this.autocompleteOnHide,
|
153
153
|
parameters: options.parameters,
|
154
154
|
paramName: options.paramName,
|
155
|
-
partialChars: 1
|
155
|
+
partialChars: 1
|
156
156
|
};
|
157
157
|
if (!options.paletteClonesInputWidth) {
|
158
158
|
ajaxAutocompleterOptions.onShow = this.onShowWithoutCloningInputWidth;
|
@@ -134,6 +134,7 @@ Don't edit this file: It gets re-copied every time the server starts.
|
|
134
134
|
|
135
135
|
.admin_assistant.form label {
|
136
136
|
font-size: 11px;
|
137
|
+
display: block;
|
137
138
|
}
|
138
139
|
|
139
140
|
.admin_assistant.form input[type=text] {
|
@@ -216,4 +217,8 @@ Don't edit this file: It gets re-copied every time the server starts.
|
|
216
217
|
font-size: small;
|
217
218
|
}
|
218
219
|
|
219
|
-
|
220
|
+
ul.aa_filter li {
|
221
|
+
float: left;
|
222
|
+
margin: 0 10px 10px 0;
|
223
|
+
font-weight: bold;
|
224
|
+
}
|
data/lib/stylesheets/default.css
CHANGED
@@ -67,6 +67,7 @@ Don't edit this file: It gets re-copied every time the server starts.
|
|
67
67
|
|
68
68
|
.admin_assistant.form .column .description {
|
69
69
|
font-size: small;
|
70
|
+
margin: 0;
|
70
71
|
}
|
71
72
|
|
72
73
|
.admin_assistant.form input {
|
@@ -81,6 +82,10 @@ Don't edit this file: It gets re-copied every time the server starts.
|
|
81
82
|
width: 50px
|
82
83
|
}
|
83
84
|
|
85
|
+
.admin_assistant.form label {
|
86
|
+
display: block;
|
87
|
+
}
|
88
|
+
|
84
89
|
.admin_assistant.form select {
|
85
90
|
font-size: large
|
86
91
|
}
|
@@ -90,6 +95,18 @@ Don't edit this file: It gets re-copied every time the server starts.
|
|
90
95
|
font-size: large
|
91
96
|
}
|
92
97
|
|
98
|
+
.admin_assistant.form th {
|
99
|
+
font-weight: normal;
|
100
|
+
text-align: left;
|
101
|
+
}
|
102
|
+
|
103
|
+
.admin_assistant.multi.form .errorExplanation {
|
104
|
+
font-size: small;
|
105
|
+
}
|
106
|
+
|
107
|
+
.admin_assistant.form .fieldWithErrors {
|
108
|
+
background: red;
|
109
|
+
}
|
93
110
|
|
94
111
|
.admin_assistant .autocomplete_palette {
|
95
112
|
background: white;
|
data/lib/views/form.html.erb
CHANGED
@@ -8,20 +8,24 @@ form_view = AdminAssistant::FormView.new(@record, @admin_assistant, self)
|
|
8
8
|
<div class="aa_header">
|
9
9
|
<h2><%= h(form_view.title) %></h2>
|
10
10
|
<div class="actions">
|
11
|
-
<%= link_to('Back to index',
|
11
|
+
<%= link_to('Back to index', @origin) %>
|
12
12
|
</div>
|
13
13
|
</div>
|
14
14
|
<% if !@record.errors.empty? %>
|
15
15
|
<%= error_messages_for 'record' %>
|
16
16
|
<% end %>
|
17
17
|
<% form_for(@record, form_view.form_for_args) do |rails_form| %>
|
18
|
+
<% if @origin %>
|
19
|
+
<%= hidden_field_tag 'origin', @origin %>
|
20
|
+
<% end %>
|
21
|
+
|
18
22
|
<% form_view.columns.each do |column| %>
|
19
23
|
<div class="column">
|
20
|
-
<label><%= h(column.label) %></label>
|
24
|
+
<label for="<%= column.field_id %>"><%= h(column.label) %></label>
|
21
25
|
<% if column.description %>
|
22
26
|
<p class="description"><%= h(column.description) %></p>
|
23
27
|
<% end %>
|
24
|
-
|
28
|
+
<%= column.html(rails_form) %>
|
25
29
|
</div>
|
26
30
|
<% end %>
|
27
31
|
<div>
|
data/lib/views/index.html.erb
CHANGED
@@ -4,15 +4,16 @@
|
|
4
4
|
%>">
|
5
5
|
<div class="aa_header">
|
6
6
|
<div class="actions">
|
7
|
-
<%= link_to_function('Search', 'AdminAssistant.show_search_form()') %>
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
<%= link_to_function('Search', 'AdminAssistant.show_search_form()') if index_view.render_search_link? %>
|
8
|
+
<% if index_view.render_new_link? %>
|
9
|
+
<%= index_view.new_link %>
|
10
|
+
<% end %>
|
11
11
|
<% @admin_assistant.index_settings.actions.each do |action, params| %>
|
12
12
|
<%= link_to_unless_current(action, params) %>
|
13
13
|
<% end %>
|
14
14
|
</div>
|
15
15
|
<h2><%= h(index_view.header) %></h2>
|
16
|
+
<%= index_view.render_after_index_header %>
|
16
17
|
</div>
|
17
18
|
|
18
19
|
<% form_for(
|
@@ -20,6 +21,9 @@
|
|
20
21
|
:url => {:action => 'index'},
|
21
22
|
:html => {:id => 'search_form', :style => 'display:none', :method => 'get'}
|
22
23
|
) do |form| %>
|
24
|
+
<% @index.hidden_fields_for_search_form.each do |name, value| -%>
|
25
|
+
<%= hidden_field_tag name, value %>
|
26
|
+
<% end -%>
|
23
27
|
<% column_views = @index.search.column_views self %>
|
24
28
|
<% if column_views.size > 1 %>
|
25
29
|
Match all conditions <%= radio_button_tag(
|
@@ -62,12 +66,12 @@
|
|
62
66
|
</thead>
|
63
67
|
<tbody id="<%= @admin_assistant.model_class.name.underscore.pluralize %>_index_tbody">
|
64
68
|
<% @index.records.each do |record| %>
|
65
|
-
<tr class="<%=
|
69
|
+
<tr class="<%= index_view.tr_css_classes(record) %>" id="<%=
|
66
70
|
@admin_assistant.model_class.name.underscore
|
67
71
|
%>_<%= record.id %>">
|
68
|
-
<%
|
69
|
-
<% td_class = column.
|
70
|
-
<td<%= " class=\"#{td_class}\""
|
72
|
+
<% index_view.columns.each do |column| %>
|
73
|
+
<% td_class = column.td_css_classes(column, record) %>
|
74
|
+
<td<%= " class=\"#{td_class}\"" unless td_class.blank? %>><%=
|
71
75
|
column.html(record)
|
72
76
|
%></td>
|
73
77
|
<% end %>
|
@@ -97,3 +101,4 @@
|
|
97
101
|
%> found
|
98
102
|
</div>
|
99
103
|
</div>
|
104
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<%
|
2
|
+
multi_form_view = AdminAssistant::MultiFormView.new(
|
3
|
+
@records, @admin_assistant, self
|
4
|
+
)
|
5
|
+
%>
|
6
|
+
<div class="admin_assistant form multi <%=
|
7
|
+
@admin_assistant.controller_css_class(controller)
|
8
|
+
%>">
|
9
|
+
<div class="aa_header">
|
10
|
+
<h2><%= h(multi_form_view.title) %></h2>
|
11
|
+
<div class="actions">
|
12
|
+
<%= link_to('Back to index', :action => 'index') %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% form_for(*multi_form_view.form_for_args) do |rails_form| %>
|
16
|
+
<% if @origin %>
|
17
|
+
<%= hidden_field_tag 'origin', @origin %>
|
18
|
+
<% end %>
|
19
|
+
<table>
|
20
|
+
<thead>
|
21
|
+
<tr>
|
22
|
+
<% multi_form_view.columns.each do |column| %>
|
23
|
+
<th>
|
24
|
+
<label><%= h(column.label) %></label>
|
25
|
+
<% if column.description %>
|
26
|
+
<p class="description"><%= h(column.description) %></p>
|
27
|
+
<% end %>
|
28
|
+
</th>
|
29
|
+
<% end %>
|
30
|
+
</tr>
|
31
|
+
</thead>
|
32
|
+
<% rails_form.each_sub_form do |rails_sub_form, sub_form_view| %>
|
33
|
+
<% record = sub_form_view.record %>
|
34
|
+
<% if !sub_form_view.record.errors.empty? %>
|
35
|
+
<tr>
|
36
|
+
<% sub_form_view.columns.each do |column| %>
|
37
|
+
<td class="errorExplanation">
|
38
|
+
<% errors = column.errors(record) %>
|
39
|
+
<% if errors %>
|
40
|
+
<% if errors.is_a?(String) %>
|
41
|
+
<%= h(column.label) %> <%= h(errors) %>
|
42
|
+
<% else %>
|
43
|
+
<ul>
|
44
|
+
<% errors.each do |error| %>
|
45
|
+
<li><%= h(column.label) %> <%= h(error) %></li>
|
46
|
+
<% end %>
|
47
|
+
</ul>
|
48
|
+
<% end %>
|
49
|
+
<% end %>
|
50
|
+
</td>
|
51
|
+
<% end %>
|
52
|
+
</tr>
|
53
|
+
<% end %>
|
54
|
+
<tr>
|
55
|
+
<% sub_form_view.columns.each do |column| %>
|
56
|
+
<td<%= " class='fieldWithErrors'" if column.errors(record) %>>
|
57
|
+
<%= column.html(rails_sub_form) %>
|
58
|
+
</td>
|
59
|
+
<% end %>
|
60
|
+
</tr>
|
61
|
+
<% end %>
|
62
|
+
</table>
|
63
|
+
<div>
|
64
|
+
<%= submit_tag(multi_form_view.submit_value) %>
|
65
|
+
<% multi_form_view.extra_submit_buttons.each do |extra_submit_button| %>
|
66
|
+
<%= submit_tag(extra_submit_button) %>
|
67
|
+
<% end %>
|
68
|
+
</div>
|
69
|
+
<% end %>
|
70
|
+
</div>
|
71
|
+
|
data/lib/views/show.html.erb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
<% show_view = AdminAssistant::ShowView.new(@record, @admin_assistant, self) %>
|
1
2
|
<div class="admin_assistant show <%=
|
2
3
|
@admin_assistant.controller_css_class(controller)
|
3
4
|
%>">
|
@@ -5,11 +6,10 @@
|
|
5
6
|
<h2><%=
|
6
7
|
h("#{request.model_class_name(@record).capitalize} #{@record.id}")
|
7
8
|
%></h2>
|
8
|
-
|
9
|
+
<% if @admin_assistant.edit? %>
|
10
|
+
<%= link_to 'Edit', :action => 'edit', :id => @record.id %>
|
11
|
+
<% end %>
|
9
12
|
</div>
|
10
|
-
<%
|
11
|
-
show_view = AdminAssistant::ShowView.new(@record, @admin_assistant, self)
|
12
|
-
%>
|
13
13
|
<% show_view.columns.each do |column| %>
|
14
14
|
<div class="column">
|
15
15
|
<label><%= h(column.label) %></label>
|