admin_assistant 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/admin_assistant.gemspec +404 -8
- data/rails_2_test/README +256 -0
- data/rails_2_test/Rakefile +13 -0
- data/rails_2_test/app/controllers/admin/appointments2_controller.rb +15 -0
- data/rails_2_test/app/controllers/admin/appointments_controller.rb +11 -0
- data/rails_2_test/app/controllers/admin/blog_posts2_controller.rb +138 -0
- data/rails_2_test/app/controllers/admin/blog_posts3_controller.rb +76 -0
- data/rails_2_test/app/controllers/admin/blog_posts4_controller.rb +21 -0
- data/rails_2_test/app/controllers/admin/blog_posts5_controller.rb +27 -0
- data/rails_2_test/app/controllers/admin/blog_posts6_controller.rb +10 -0
- data/rails_2_test/app/controllers/admin/blog_posts_controller.rb +8 -0
- data/rails_2_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +15 -0
- data/rails_2_test/app/controllers/admin/blog_posts_read_only_controller.rb +19 -0
- data/rails_2_test/app/controllers/admin/bookmarks_controller.rb +11 -0
- data/rails_2_test/app/controllers/admin/comments2_controller.rb +14 -0
- data/rails_2_test/app/controllers/admin/comments_controller.rb +12 -0
- data/rails_2_test/app/controllers/admin/file_column_images2_controller.rb +10 -0
- data/rails_2_test/app/controllers/admin/file_column_images_controller.rb +6 -0
- data/rails_2_test/app/controllers/admin/images2_controller.rb +11 -0
- data/rails_2_test/app/controllers/admin/images_controller.rb +6 -0
- data/rails_2_test/app/controllers/admin/misconfigured1_controller.rb +7 -0
- data/rails_2_test/app/controllers/admin/not_migrated_yets_controller.rb +9 -0
- data/rails_2_test/app/controllers/admin/product_categories2_controller.rb +7 -0
- data/rails_2_test/app/controllers/admin/product_categories_controller.rb +5 -0
- data/rails_2_test/app/controllers/admin/products2_controller.rb +15 -0
- data/rails_2_test/app/controllers/admin/products_controller.rb +31 -0
- data/rails_2_test/app/controllers/admin/television_airings_controller.rb +5 -0
- data/rails_2_test/app/controllers/admin/television_time_slots_controller.rb +5 -0
- data/rails_2_test/app/controllers/admin/users2_controller.rb +10 -0
- data/rails_2_test/app/controllers/admin/users_controller.rb +63 -0
- data/rails_2_test/app/controllers/application.rb +16 -0
- data/rails_2_test/app/controllers/application_controller.rb +16 -0
- data/rails_2_test/app/controllers/blog_posts_controller.rb +5 -0
- data/rails_2_test/app/helpers/admin/appointments2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/appointments_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts2_helper.rb +27 -0
- data/rails_2_test/app/helpers/admin/blog_posts3_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts4_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts6_helper.rb +16 -0
- data/rails_2_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +29 -0
- data/rails_2_test/app/helpers/admin/blog_posts_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts_read_only_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/bookmarks_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/comments2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/comments_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/file_column_images2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/file_column_images_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/images2_helper.rb +8 -0
- data/rails_2_test/app/helpers/admin/images_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/misconfigured1_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/not_migrated_yets_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/product_categories2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/product_categories_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/products2_helper.rb +3 -0
- data/rails_2_test/app/helpers/admin/products_helper.rb +6 -0
- data/rails_2_test/app/helpers/admin/television_airings_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/television_time_slots_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/users2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/users_helper.rb +25 -0
- data/rails_2_test/app/helpers/application_helper.rb +3 -0
- data/rails_2_test/app/helpers/blog_posts_helper.rb +2 -0
- data/rails_2_test/app/models/appointment.rb +5 -0
- data/rails_2_test/app/models/blog_post.rb +14 -0
- data/rails_2_test/app/models/blog_post_tag.rb +6 -0
- data/rails_2_test/app/models/bookmark.rb +6 -0
- data/rails_2_test/app/models/comment.rb +4 -0
- data/rails_2_test/app/models/file_column_image.rb +3 -0
- data/rails_2_test/app/models/image.rb +3 -0
- data/rails_2_test/app/models/not_migrated_yet.rb +2 -0
- data/rails_2_test/app/models/product.rb +7 -0
- data/rails_2_test/app/models/product_category.rb +9 -0
- data/rails_2_test/app/models/tag.rb +4 -0
- data/rails_2_test/app/models/television_airing.rb +3 -0
- data/rails_2_test/app/models/television_time_slot.rb +11 -0
- data/rails_2_test/app/models/user.rb +14 -0
- data/rails_2_test/app/views/admin/appointments/_subject_input.html.erb +2 -0
- data/rails_2_test/app/views/admin/appointments2/_time_input.html.erb +31 -0
- data/rails_2_test/app/views/admin/blog_posts2/_after_form.html.erb +5 -0
- data/rails_2_test/app/views/admin/blog_posts2/_after_index.html.erb +1 -0
- data/rails_2_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +16 -0
- data/rails_2_test/app/views/admin/blog_posts2/_before_index.html.erb +2 -0
- data/rails_2_test/app/views/admin/blog_posts5/_after_index_header.html.erb +8 -0
- data/rails_2_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +1 -0
- data/rails_2_test/app/views/admin/products/_name_input.html.erb +2 -0
- data/rails_2_test/app/views/admin/products/_percent_off_input.html.erb +2 -0
- data/rails_2_test/app/views/admin/products/_price_input.html.erb +10 -0
- data/rails_2_test/app/views/blog_posts/show.html.erb +13 -0
- data/rails_2_test/app/views/layouts/admin.html.erb +31 -0
- data/rails_2_test/config/boot.rb +109 -0
- data/rails_2_test/config/database.yml +28 -0
- data/rails_2_test/config/environment.rb +78 -0
- data/rails_2_test/config/environments/development.rb +17 -0
- data/rails_2_test/config/environments/production.rb +24 -0
- data/rails_2_test/config/environments/test.rb +24 -0
- data/rails_2_test/config/initializers/inflections.rb +10 -0
- data/rails_2_test/config/initializers/mime_types.rb +5 -0
- data/rails_2_test/config/initializers/new_rails_defaults.rb +17 -0
- data/rails_2_test/config/locales/en.yml +5 -0
- data/rails_2_test/config/routes.rb +43 -0
- data/rails_2_test/db/migrate/20090213215514_create_blog_posts.rb +12 -0
- data/rails_2_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090221220917_create_tags.rb +13 -0
- data/rails_2_test/db/migrate/20090221220947_create_blog_post_tags.rb +14 -0
- data/rails_2_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090301191722_create_images.rb +16 -0
- data/rails_2_test/db/migrate/20090305165345_create_accounts.rb +14 -0
- data/rails_2_test/db/migrate/20090307225027_rename_accounts_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090309185114_change_blog_posts_textile.rb +9 -0
- data/rails_2_test/db/migrate/20090309193635_create_products.rb +14 -0
- data/rails_2_test/db/migrate/20090309203056_create_comments.rb +15 -0
- data/rails_2_test/db/migrate/20090323005947_create_file_column_images.rb +12 -0
- data/rails_2_test/db/migrate/20090326160049_add_birthday_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090326223606_add_state_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +9 -0
- data/rails_2_test/db/migrate/20090617173651_create_bookmarks.rb +15 -0
- data/rails_2_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +9 -0
- data/rails_2_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +11 -0
- data/rails_2_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090701171857_add_force_textile_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +9 -0
- data/rails_2_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +13 -0
- data/rails_2_test/db/migrate/20090714024501_create_product_categories.rb +15 -0
- data/rails_2_test/db/migrate/20090819162835_add_admin_level_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +11 -0
- data/rails_2_test/db/migrate/20091221011256_add_position_to_product_categories.rb +9 -0
- data/rails_2_test/db/migrate/20091222160814_create_appointments.rb +14 -0
- data/rails_2_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +9 -0
- data/rails_2_test/db/migrate/20100214213359_create_television_time_slots.rb +13 -0
- data/rails_2_test/db/migrate/20100214213451_create_television_airings.rb +15 -0
- data/rails_2_test/doc/README_FOR_APP +5 -0
- data/rails_2_test/lib/tasks/rspec.rake +163 -0
- data/rails_2_test/public/404.html +30 -0
- data/rails_2_test/public/422.html +30 -0
- data/rails_2_test/public/500.html +33 -0
- data/rails_2_test/public/dispatch.cgi +10 -0
- data/rails_2_test/public/dispatch.fcgi +24 -0
- data/rails_2_test/public/dispatch.rb +10 -0
- data/rails_2_test/public/favicon.ico +0 -0
- data/rails_2_test/public/images/rails.png +0 -0
- data/rails_2_test/public/index.html +274 -0
- data/rails_2_test/public/javascripts/application.js +2 -0
- data/rails_2_test/public/javascripts/jquery-1.4.4.min.js +167 -0
- data/rails_2_test/public/robots.txt +5 -0
- data/rails_2_test/public/stylesheets/admin.css +3 -0
- data/rails_2_test/public/stylesheets/scaffold.css +54 -0
- data/rails_2_test/script/about +4 -0
- data/rails_2_test/script/autospec +5 -0
- data/rails_2_test/script/console +3 -0
- data/rails_2_test/script/dbconsole +3 -0
- data/rails_2_test/script/destroy +3 -0
- data/rails_2_test/script/generate +3 -0
- data/rails_2_test/script/performance/benchmarker +3 -0
- data/rails_2_test/script/performance/profiler +3 -0
- data/rails_2_test/script/performance/request +3 -0
- data/rails_2_test/script/plugin +3 -0
- data/rails_2_test/script/populate_tables.rb +49 -0
- data/rails_2_test/script/process/inspector +3 -0
- data/rails_2_test/script/process/reaper +3 -0
- data/rails_2_test/script/process/spawner +3 -0
- data/rails_2_test/script/runner +3 -0
- data/rails_2_test/script/server +3 -0
- data/rails_2_test/script/spec +5 -0
- data/rails_2_test/script/spec_server +125 -0
- data/rails_2_test/test/data/ruby_throated.jpg +0 -0
- data/rails_2_test/test/data/tweenbot.jpg +0 -0
- data/rails_2_test/test/fixtures/file_column_images.yml +7 -0
- data/rails_2_test/test/integration/admin/appointments2_integration_test.rb +79 -0
- data/rails_2_test/test/integration/admin/appointments_integration_test.rb +367 -0
- data/rails_2_test/test/integration/admin/blog_posts2_integration_test.rb +806 -0
- data/rails_2_test/test/integration/admin/blog_posts3_integration_test.rb +418 -0
- data/rails_2_test/test/integration/admin/blog_posts4_integration_test.rb +189 -0
- data/rails_2_test/test/integration/admin/blog_posts5_integration_test.rb +75 -0
- data/rails_2_test/test/integration/admin/blog_posts6_integration_test.rb +39 -0
- data/rails_2_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +89 -0
- data/rails_2_test/test/integration/admin/blog_posts_integration_test.rb +788 -0
- data/rails_2_test/test/integration/admin/blog_posts_read_only_integration_test.rb +69 -0
- data/rails_2_test/test/integration/admin/bookmarks_integration_test.rb +445 -0
- data/rails_2_test/test/integration/admin/comments2_integration_test.rb +52 -0
- data/rails_2_test/test/integration/admin/comments_integration_test.rb +50 -0
- data/rails_2_test/test/integration/admin/file_column_images2_integration_test.rb +19 -0
- data/rails_2_test/test/integration/admin/file_column_images_integration_test.rb +69 -0
- data/rails_2_test/test/integration/admin/images2_integration_test.rb +33 -0
- data/rails_2_test/test/integration/admin/images_integration_test.rb +79 -0
- data/rails_2_test/test/integration/admin/misconfigured1_integration_test.rb +17 -0
- data/rails_2_test/test/integration/admin/product_categories2_integration_test.rb +179 -0
- data/rails_2_test/test/integration/admin/product_categories_integration_test.rb +12 -0
- data/rails_2_test/test/integration/admin/products2_integration_test.rb +155 -0
- data/rails_2_test/test/integration/admin/products_integration_test.rb +210 -0
- data/rails_2_test/test/integration/admin/television_airings_integration_test.rb +25 -0
- data/rails_2_test/test/integration/admin/users2_integration_test.rb +48 -0
- data/rails_2_test/test/integration/admin/users_integration_test.rb +266 -0
- data/rails_2_test/test/integration/blog_posts_integration_test.rb +9 -0
- data/rails_2_test/test/test_helper.rb +114 -0
- data/rails_2_test/vendor/plugins/file_column/CHANGELOG +69 -0
- data/rails_2_test/vendor/plugins/file_column/README +54 -0
- data/rails_2_test/vendor/plugins/file_column/Rakefile +36 -0
- data/rails_2_test/vendor/plugins/file_column/TODO +6 -0
- data/rails_2_test/vendor/plugins/file_column/init.rb +13 -0
- data/rails_2_test/vendor/plugins/file_column/lib/file_column.rb +723 -0
- data/rails_2_test/vendor/plugins/file_column/lib/file_column_helper.rb +150 -0
- data/rails_2_test/vendor/plugins/file_column/lib/file_compat.rb +28 -0
- data/rails_2_test/vendor/plugins/file_column/lib/magick_file_column.rb +260 -0
- data/rails_2_test/vendor/plugins/file_column/lib/rails_file_column.rb +19 -0
- data/rails_2_test/vendor/plugins/file_column/lib/test_case.rb +124 -0
- data/rails_2_test/vendor/plugins/file_column/lib/validations.rb +112 -0
- data/rails_2_test/vendor/plugins/file_column/test/abstract_unit.rb +63 -0
- data/rails_2_test/vendor/plugins/file_column/test/connection.rb +17 -0
- data/rails_2_test/vendor/plugins/file_column/test/file_column_helper_test.rb +97 -0
- data/rails_2_test/vendor/plugins/file_column/test/file_column_test.rb +650 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/entry.rb +32 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +1 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/kerb.jpg +0 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/mysql.sql +25 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/schema.rb +10 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/skanthak.png +0 -0
- data/rails_2_test/vendor/plugins/file_column/test/magick_test.rb +380 -0
- data/rails_2_test/vendor/plugins/file_column/test/magick_view_only_test.rb +21 -0
- data/rails_3_test/.gitignore +4 -0
- data/rails_3_test/Gemfile +12 -0
- data/rails_3_test/Gemfile.lock +100 -0
- data/rails_3_test/README +256 -0
- data/rails_3_test/Rakefile +7 -0
- data/rails_3_test/app/controllers/admin/appointments2_controller.rb +15 -0
- data/rails_3_test/app/controllers/admin/appointments_controller.rb +11 -0
- data/rails_3_test/app/controllers/admin/blog_posts2_controller.rb +138 -0
- data/rails_3_test/app/controllers/admin/blog_posts3_controller.rb +76 -0
- data/rails_3_test/app/controllers/admin/blog_posts4_controller.rb +21 -0
- data/rails_3_test/app/controllers/admin/blog_posts5_controller.rb +27 -0
- data/rails_3_test/app/controllers/admin/blog_posts6_controller.rb +10 -0
- data/rails_3_test/app/controllers/admin/blog_posts_controller.rb +9 -0
- data/rails_3_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +15 -0
- data/rails_3_test/app/controllers/admin/blog_posts_read_only_controller.rb +19 -0
- data/rails_3_test/app/controllers/admin/bookmarks_controller.rb +11 -0
- data/rails_3_test/app/controllers/admin/comments2_controller.rb +14 -0
- data/rails_3_test/app/controllers/admin/comments_controller.rb +12 -0
- data/rails_3_test/app/controllers/admin/images2_controller.rb +11 -0
- data/rails_3_test/app/controllers/admin/images_controller.rb +6 -0
- data/rails_3_test/app/controllers/admin/misconfigured1_controller.rb +7 -0
- data/rails_3_test/app/controllers/admin/not_migrated_yets_controller.rb +9 -0
- data/rails_3_test/app/controllers/admin/product_categories2_controller.rb +7 -0
- data/rails_3_test/app/controllers/admin/product_categories_controller.rb +5 -0
- data/rails_3_test/app/controllers/admin/television_airings_controller.rb +5 -0
- data/rails_3_test/app/controllers/admin/television_time_slots_controller.rb +5 -0
- data/rails_3_test/app/controllers/admin/users2_controller.rb +10 -0
- data/rails_3_test/app/controllers/admin/users_controller.rb +48 -0
- data/rails_3_test/app/controllers/application_controller.rb +7 -0
- data/rails_3_test/app/controllers/blog_posts_controller.rb +5 -0
- data/rails_3_test/app/helpers/admin/appointments_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts2_helper.rb +27 -0
- data/rails_3_test/app/helpers/admin/blog_posts3_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts4_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts6_helper.rb +13 -0
- data/rails_3_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +29 -0
- data/rails_3_test/app/helpers/admin/blog_posts_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts_read_only_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/bookmarks_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/comments2_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/comments_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/images2_helper.rb +8 -0
- data/rails_3_test/app/helpers/admin/images_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/misconfigured1_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/not_migrated_yets_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/product_categories2_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/product_categories_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/television_airings_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/television_time_slots_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/users2_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/users_helper.rb +13 -0
- data/rails_3_test/app/helpers/application_helper.rb +2 -0
- data/rails_3_test/app/models/appointment.rb +5 -0
- data/rails_3_test/app/models/blog_post.rb +14 -0
- data/rails_3_test/app/models/blog_post_tag.rb +6 -0
- data/rails_3_test/app/models/bookmark.rb +6 -0
- data/rails_3_test/app/models/comment.rb +4 -0
- data/rails_3_test/app/models/image.rb +3 -0
- data/rails_3_test/app/models/not_migrated_yet.rb +2 -0
- data/rails_3_test/app/models/product.rb +5 -0
- data/rails_3_test/app/models/product_category.rb +9 -0
- data/rails_3_test/app/models/tag.rb +4 -0
- data/rails_3_test/app/models/television_airing.rb +3 -0
- data/rails_3_test/app/models/television_time_slot.rb +11 -0
- data/rails_3_test/app/models/user.rb +11 -0
- data/rails_3_test/app/views/admin/appointments/_subject_input.html.erb +2 -0
- data/rails_3_test/app/views/admin/appointments2/_time_input.html.erb +31 -0
- data/rails_3_test/app/views/admin/blog_posts2/_after_form.html.erb +5 -0
- data/rails_3_test/app/views/admin/blog_posts2/_after_index.html.erb +1 -0
- data/rails_3_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +16 -0
- data/rails_3_test/app/views/admin/blog_posts2/_before_index.html.erb +2 -0
- data/rails_3_test/app/views/admin/blog_posts5/_after_index_header.html.erb +8 -0
- data/rails_3_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +1 -0
- data/rails_3_test/app/views/layouts/admin.html.erb +32 -0
- data/rails_3_test/app/views/layouts/application.html.erb +14 -0
- data/rails_3_test/config/application.rb +42 -0
- data/rails_3_test/config/boot.rb +6 -0
- data/rails_3_test/config/database.yml +22 -0
- data/rails_3_test/config/environment.rb +5 -0
- data/rails_3_test/config/environments/development.rb +26 -0
- data/rails_3_test/config/environments/production.rb +49 -0
- data/rails_3_test/config/environments/test.rb +35 -0
- data/rails_3_test/config/initializers/backtrace_silencers.rb +7 -0
- data/rails_3_test/config/initializers/inflections.rb +10 -0
- data/rails_3_test/config/initializers/mime_types.rb +5 -0
- data/rails_3_test/config/initializers/secret_token.rb +7 -0
- data/rails_3_test/config/initializers/session_store.rb +8 -0
- data/rails_3_test/config/locales/en.yml +5 -0
- data/rails_3_test/config/routes.rb +63 -0
- data/rails_3_test/config.ru +4 -0
- data/rails_3_test/db/migrate/20090213215514_create_blog_posts.rb +12 -0
- data/rails_3_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090221220917_create_tags.rb +13 -0
- data/rails_3_test/db/migrate/20090221220947_create_blog_post_tags.rb +14 -0
- data/rails_3_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090301191722_create_images.rb +16 -0
- data/rails_3_test/db/migrate/20090305165345_create_accounts.rb +14 -0
- data/rails_3_test/db/migrate/20090307225027_rename_accounts_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090309185114_change_blog_posts_textile.rb +9 -0
- data/rails_3_test/db/migrate/20090309193635_create_products.rb +14 -0
- data/rails_3_test/db/migrate/20090309203056_create_comments.rb +15 -0
- data/rails_3_test/db/migrate/20090323005947_create_file_column_images.rb +12 -0
- data/rails_3_test/db/migrate/20090326160049_add_birthday_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090326223606_add_state_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +9 -0
- data/rails_3_test/db/migrate/20090617173651_create_bookmarks.rb +15 -0
- data/rails_3_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +9 -0
- data/rails_3_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +11 -0
- data/rails_3_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090701171857_add_force_textile_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +9 -0
- data/rails_3_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +13 -0
- data/rails_3_test/db/migrate/20090714024501_create_product_categories.rb +15 -0
- data/rails_3_test/db/migrate/20090819162835_add_admin_level_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +11 -0
- data/rails_3_test/db/migrate/20091221011256_add_position_to_product_categories.rb +9 -0
- data/rails_3_test/db/migrate/20091222160814_create_appointments.rb +14 -0
- data/rails_3_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +9 -0
- data/rails_3_test/db/migrate/20100214213359_create_television_time_slots.rb +13 -0
- data/rails_3_test/db/migrate/20100214213451_create_television_airings.rb +15 -0
- data/rails_3_test/db/migrate/20110426215702_remove_avatar_fields_from_users.rb +11 -0
- data/rails_3_test/db/seeds.rb +7 -0
- data/rails_3_test/doc/README_FOR_APP +2 -0
- data/rails_3_test/lib/tasks/.gitkeep +0 -0
- data/rails_3_test/public/404.html +26 -0
- data/rails_3_test/public/422.html +26 -0
- data/rails_3_test/public/500.html +26 -0
- data/rails_3_test/public/favicon.ico +0 -0
- data/rails_3_test/public/images/rails.png +0 -0
- data/rails_3_test/public/index.html +239 -0
- data/rails_3_test/public/javascripts/application.js +2 -0
- data/rails_3_test/public/javascripts/jquery-1.4.4.min.js +167 -0
- data/rails_3_test/public/javascripts/rails.js +191 -0
- data/rails_3_test/public/robots.txt +5 -0
- data/rails_3_test/public/stylesheets/.gitkeep +0 -0
- data/rails_3_test/public/stylesheets/admin.css +3 -0
- data/rails_3_test/public/stylesheets/scaffold.css +54 -0
- data/rails_3_test/script/rails +6 -0
- data/rails_3_test/test/data/ruby_throated.jpg +0 -0
- data/rails_3_test/test/data/tweenbot.jpg +0 -0
- data/rails_3_test/test/fixtures/placeholder.txt +0 -0
- data/rails_3_test/test/integration/admin/appointments2_integration_test.rb +79 -0
- data/rails_3_test/test/integration/admin/appointments_integration_test.rb +367 -0
- data/rails_3_test/test/integration/admin/blog_posts2_integration_test.rb +789 -0
- data/rails_3_test/test/integration/admin/blog_posts3_integration_test.rb +418 -0
- data/rails_3_test/test/integration/admin/blog_posts4_integration_test.rb +189 -0
- data/rails_3_test/test/integration/admin/blog_posts5_integration_test.rb +75 -0
- data/rails_3_test/test/integration/admin/blog_posts6_integration_test.rb +39 -0
- data/rails_3_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +89 -0
- data/rails_3_test/test/integration/admin/blog_posts_integration_test.rb +784 -0
- data/rails_3_test/test/integration/admin/blog_posts_read_only_integration_test.rb +69 -0
- data/rails_3_test/test/integration/admin/bookmarks_integration_test.rb +445 -0
- data/rails_3_test/test/integration/admin/comments2_integration_test.rb +52 -0
- data/rails_3_test/test/integration/admin/comments_integration_test.rb +50 -0
- data/rails_3_test/test/integration/admin/images2_integration_test.rb +33 -0
- data/rails_3_test/test/integration/admin/images_integration_test.rb +79 -0
- data/rails_3_test/test/integration/admin/misconfigured1_integration_test.rb +21 -0
- data/rails_3_test/test/integration/admin/product_categories2_integration_test.rb +179 -0
- data/rails_3_test/test/integration/admin/product_categories_integration_test.rb +12 -0
- data/rails_3_test/test/integration/admin/television_airings_integration_test.rb +25 -0
- data/rails_3_test/test/integration/admin/users2_integration_test.rb +48 -0
- data/rails_3_test/test/integration/admin/users_integration_test.rb +182 -0
- data/rails_3_test/test/integration/blog_posts_integration_test.rb +10 -0
- data/rails_3_test/test/performance/browsing_test.rb +9 -0
- data/rails_3_test/test/test_helper.rb +98 -0
- data/rails_3_test/vendor/plugins/.gitkeep +0 -0
- data/website/_layouts/api.html +20 -17
- data/website/_layouts/api1.html +42 -0
- data/website/_layouts/default.html +42 -18
- data/website/api/core.markdown +6 -3
- data/website/api/destroy.markdown +4 -2
- data/website/api/form.markdown +6 -5
- data/website/api/idx.markdown +8 -7
- data/website/api/index.markdown +9 -7
- data/website/api/search.markdown +5 -3
- data/website/api/show.markdown +4 -2
- data/website/community.markdown +3 -2
- data/website/css/main.css +83 -17
- data/website/design_principles.markdown +3 -8
- data/website/index.markdown +13 -9
- data/website/js/lightbox.js +2 -2
- data/website/quick_start.markdown +10 -10
- data/website/screenshots.markdown +11 -11
- data/website/tutorial.markdown +23 -14
- data/website/v1/api/core.markdown +108 -0
- data/website/v1/api/destroy.markdown +27 -0
- data/website/v1/api/form.markdown +293 -0
- data/website/v1/api/idx.markdown +288 -0
- data/website/v1/api/index.markdown +149 -0
- data/website/v1/api/search.markdown +110 -0
- data/website/v1/api/show.markdown +24 -0
- data/website/v1/index.markdown +10 -0
- data/website/v1/quick_start.markdown +48 -0
- data/website/v1/tutorial.markdown +60 -0
- metadata +407 -9
|
@@ -3,25 +3,25 @@ layout: default
|
|
|
3
3
|
title: Quick start
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
<div class="note">
|
|
7
|
+
This document assumes you are highly familiar with Ruby and Rails; if you are a beginning Rails user you might want to start with our <a href="/admin_assistant/tutorial.html">tutorial</a>.
|
|
8
|
+
</div>
|
|
7
9
|
|
|
8
|
-
1)
|
|
10
|
+
1) Add the gem to your Gemfile, and install it with `bundle install`.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
gem 'admin_assistant'
|
|
11
13
|
|
|
12
|
-
2)
|
|
13
|
-
|
|
14
|
-
3) admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include prototype.js, effects.js, and controls.js, if you're not including them already.
|
|
14
|
+
2) admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include jquery, if you're not including it already.
|
|
15
15
|
|
|
16
16
|
<html>
|
|
17
17
|
<head>
|
|
18
|
-
<%= javascript_include_tag("
|
|
18
|
+
<%= javascript_include_tag("jquery-1.6.2.min") %>
|
|
19
19
|
<%= admin_assistant_includes %>
|
|
20
20
|
</head>
|
|
21
21
|
...
|
|
22
22
|
</html>
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
3) Setup an admin controller by attaching it to a model and using the admin layout:
|
|
25
25
|
|
|
26
26
|
class Admin::BlogPostsController < ApplicationController
|
|
27
27
|
layout 'admin'
|
|
@@ -31,7 +31,7 @@ title: Quick start
|
|
|
31
31
|
|
|
32
32
|
That's it for the basic version. You should now be able to go to /admin/blog\_posts in your app and search, paginate, create, and edit blog posts.
|
|
33
33
|
|
|
34
|
-

|
|
35
35
|
|
|
36
36
|
Depending on the model you're using, you might notice a few things:
|
|
37
37
|
|
|
@@ -40,5 +40,5 @@ Depending on the model you're using, you might notice a few things:
|
|
|
40
40
|
* There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
|
|
41
41
|
* If you have more than 10 pages of a given model, the pagination at the bottom includes a jump form to let you automatically jump to a page you enter.
|
|
42
42
|
|
|
43
|
-
For more, check out the [API reference](
|
|
43
|
+
For more, check out the [API reference](/admin_assistant/api/).
|
|
44
44
|
|
|
@@ -3,25 +3,25 @@ layout: default
|
|
|
3
3
|
title: Screenshots
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<a href="
|
|
6
|
+
<a href="/admin_assistant/img/screen1.png" rel="lightbox[screens]" class="thumb" title="With a few lines of code, admin_assistant gives you a lot of default functionality for one model, including an index view with pagination and sorting, search, creating, and editing."><img src="/admin_assistant/img/screen1-thumb.png"></a>
|
|
7
7
|
|
|
8
|
-
<a href="
|
|
8
|
+
<a href="/admin_assistant/img/screen2.png" rel="lightbox[screens]" class="thumb" title="Sorting is built-in, and done in the URL for easy bookmarking, etc."><img src="/admin_assistant/img/screen2-thumb.png"></a>
|
|
9
9
|
|
|
10
|
-
<a href="
|
|
10
|
+
<a href="/admin_assistant/img/screen3.png" rel="lightbox[screens]" class="thumb" title="If there are many results, the pagination section will include a form for jumping to a specific page quickly."><img src="/admin_assistant/img/screen3-thumb.png"></a>
|
|
11
11
|
|
|
12
|
-
<a href="
|
|
12
|
+
<a href="/admin_assistant/img/screen4.png" rel="lightbox[screens]" class="thumb" title="By default, any boolean field on the model can be toggled in the index view with an Ajax link."><img src="/admin_assistant/img/screen4-thumb.png"></a>
|
|
13
13
|
|
|
14
|
-
<a href="
|
|
14
|
+
<a href="/admin_assistant/img/screen5.png" rel="lightbox[screens]" class="thumb" title="New and edit pages render default widgets for each column on the model. Datetime fields, for example, each get a "Clear" javascript link by default."><img src="/admin_assistant/img/screen5-thumb.png"></a>
|
|
15
15
|
|
|
16
|
-
<a href="
|
|
16
|
+
<a href="/admin_assistant/img/screen6.png" rel="lightbox[screens]" class="thumb" title="If the model has a belongs-to association, and there are too many records on that associated table to be usable in a dropdown, admin_assistant renders an autocompleter instead."><img src="/admin_assistant/img/screen6-thumb.png"></a>
|
|
17
17
|
|
|
18
|
-
<a href="
|
|
18
|
+
<a href="/admin_assistant/img/screen7.png" rel="lightbox[screens]" class="thumb" title="On the form, individual column inputs on the form can be overridden with custom logic. On this admin controller for the Product model, the column "price" is being rendered with the ERB template _price_input.html.erb. The submitted parameters are then pre-processed with a protected controller method called price_from_form."><img src="/admin_assistant/img/screen7-thumb.png"></a>
|
|
19
19
|
|
|
20
|
-
<a href="
|
|
20
|
+
<a href="/admin_assistant/img/screen8.png" rel="lightbox[screens]" class="thumb" title="A customized search form can give you searching by specific columns. The user can choose to match all or any of the conditions. Also, numerical fields include comparators by default, so, for example, you can search for all products costing greater than $100."><img src="/admin_assistant/img/screen8-thumb.png"></a>
|
|
21
21
|
|
|
22
|
-
<a href="
|
|
22
|
+
<a href="/admin_assistant/img/screen9.png" rel="lightbox[screens]" class="thumb" title="The same autocompleting for belongs-to associations is also available in the search form. In this example, the user is searching for blog posts by author."><img src="/admin_assistant/img/screen9-thumb.png"></a>
|
|
23
23
|
|
|
24
|
-
<a href="
|
|
24
|
+
<a href="/admin_assistant/img/screen10.png" rel="lightbox[screens]" class="thumb" title="There is an optional theme that mimics ActiveScaffold, which may come in handy if you're in the process of transitioning away from ActiveScaffold. admin_assistant does not conflict with ActiveScaffold; you can use the two in different controllers of the same Rails app."><img src="/admin_assistant/img/screen10-thumb.png"></a>
|
|
25
25
|
|
|
26
|
-
<a href="
|
|
26
|
+
<a href="/admin_assistant/img/screen11.png" rel="lightbox[screens]" class="thumb" title="admin_assistant handles images out of the box through Paperclip."><img src="/admin_assistant/img/screen11-thumb.png"></a>
|
|
27
27
|
|
data/website/tutorial.markdown
CHANGED
|
@@ -1,35 +1,44 @@
|
|
|
1
1
|
---
|
|
2
2
|
layout: default
|
|
3
|
-
title:
|
|
3
|
+
title: Tutorial
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
<div class="note">
|
|
7
|
+
This document assumes you are a beginning Rails user; if you are familiar with Rails you might want to check out our <a href="/admin_assistant/quick_start.html">quick start</a>.
|
|
8
|
+
</div>
|
|
7
9
|
|
|
8
|
-
1)
|
|
10
|
+
1) Add the gem to `Gemfile` in the root of your Rails project.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
gem 'admin_assistant'
|
|
13
|
+
|
|
14
|
+
2) Install the gem locally.
|
|
15
|
+
|
|
16
|
+
$ bundle install
|
|
17
|
+
|
|
18
|
+
3) admin\_assistant uses jQuery. You may already have jQuery installed for your project, but if not, you can get it like so:
|
|
11
19
|
|
|
12
|
-
|
|
20
|
+
$ curl http://code.jquery.com/jquery-1.6.2.min.js > \
|
|
21
|
+
public/javascripts/jquery-1.6.2.min.js
|
|
13
22
|
|
|
14
|
-
|
|
23
|
+
4) If you don't have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called `app/views/layouts/admin.html.erb` like this:
|
|
15
24
|
|
|
16
25
|
<html>
|
|
17
26
|
<head>
|
|
18
|
-
<%= javascript_include_tag("
|
|
27
|
+
<%= javascript_include_tag("jquery-1.6.2.min") %>
|
|
19
28
|
<%= admin_assistant_includes %>
|
|
20
29
|
</head>
|
|
21
30
|
<body>
|
|
22
|
-
<%=yield %>
|
|
31
|
+
<%= yield %>
|
|
23
32
|
</body>
|
|
24
33
|
</html>
|
|
25
34
|
|
|
26
35
|
If you've already created an admin layout, you should add the javascript references, and the call to `admin_assistant_includes`. This includes the standard CSS and Javascript that are packed with admin\_assistant.
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
5) Create your new admin controller for a pre-existing model. We'll be using a BlogPost as an example but you should be able to use any model in your Rails app.
|
|
29
38
|
|
|
30
39
|
./script/generate controller admin/blog_posts
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
6) Open `app/controllers/admin/blog_posts_controller.rb` and set it up to use the admin layout and to use admin\_assistant for the BlogPost model:
|
|
33
42
|
|
|
34
43
|
class Admin::BlogPostsController < ApplicationController
|
|
35
44
|
layout 'admin'
|
|
@@ -37,11 +46,11 @@ If you've already created an admin layout, you should add the javascript referen
|
|
|
37
46
|
admin_assistant_for BlogPost
|
|
38
47
|
end
|
|
39
48
|
|
|
40
|
-
|
|
49
|
+
7) If you were already running your Rails app with `./script/server` etc, you should restart it.
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
8) Visit `/admin/blog_posts` in your browser and you'll see something like this:
|
|
43
52
|
|
|
44
|
-

|
|
45
54
|
|
|
46
55
|
You can now search, paginate, create, and edit blog posts.
|
|
47
56
|
|
|
@@ -52,5 +61,5 @@ Depending on the model you're using, you might notice a few things:
|
|
|
52
61
|
* There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
|
|
53
62
|
* If you have more than 10 pages of a given model, the pagination at the bottom includes a jump form to let you automatically jump to a page you enter.
|
|
54
63
|
|
|
55
|
-
For more, check out the [API reference](
|
|
64
|
+
For more, check out the [API reference](/admin_assistant/api/).
|
|
56
65
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: "Version 1 API: Core"
|
|
4
|
+
subtitle: Core
|
|
5
|
+
subnav: api1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
### Includes
|
|
9
|
+
|
|
10
|
+
admin\_assistant comes with its own Javascript and CSS. Call `admin_assistant_includes` in your admin layout to use them:
|
|
11
|
+
|
|
12
|
+
<html>
|
|
13
|
+
<head>
|
|
14
|
+
<%= admin_assistant_includes %>
|
|
15
|
+
</head>
|
|
16
|
+
...
|
|
17
|
+
</html>
|
|
18
|
+
|
|
19
|
+
You also have the option of making admin\_assistant look very similar to activescaffold CSS-wise, which might come in handy if you're in the process of transition from one to the other:
|
|
20
|
+
|
|
21
|
+
<%= admin_assistant_includes :theme => 'activescaffold' %>
|
|
22
|
+
|
|
23
|
+
Submissions of other themes are welcome.
|
|
24
|
+
|
|
25
|
+
### Configuring the core builder object
|
|
26
|
+
|
|
27
|
+
<a name="builder_actions"> </a>
|
|
28
|
+
#### actions
|
|
29
|
+
|
|
30
|
+
admin\_assistant uses the old-fashioned seven Rails actions: index, show, new/create, edit/update, and destroy. By default, you get all of them except destroy. To add destroy, you can simply append it to the `actions` method:
|
|
31
|
+
|
|
32
|
+
admin_assistant_for User do |aa|
|
|
33
|
+
aa.actions << :destroy
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
You can also send `actions` a list of actions and it will only allow those:
|
|
37
|
+
|
|
38
|
+
# I only want to create or index images, not edit, show or destroy
|
|
39
|
+
admin_assistant_for Image do |aa|
|
|
40
|
+
aa.actions :create, :index
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
### model\_class\_name
|
|
44
|
+
|
|
45
|
+
Use this to override what the model is named in the interface, in links like "New blog post" or "50 blog posts found". The string passed in should be lowercase.
|
|
46
|
+
|
|
47
|
+
aa.model_class_name = 'post'
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Column config options
|
|
51
|
+
|
|
52
|
+
#### boolean\_labels
|
|
53
|
+
|
|
54
|
+
aa[:textile].boolean_labels = %w(Yes No)
|
|
55
|
+
|
|
56
|
+
For a boolean fields, will change how the values get displayed, instead of simply "true" and "false".
|
|
57
|
+
|
|
58
|
+
#### label
|
|
59
|
+
|
|
60
|
+
aa[:user].label = 'Author'
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
Overrides the default label for that column in index, search, and form views.
|
|
64
|
+
|
|
65
|
+
#### polymorphic\_types
|
|
66
|
+
|
|
67
|
+
aa[:bookmarkable].polymorphic_types = [BlogPost, Comment, Product, User]
|
|
68
|
+
|
|
69
|
+
If a column is a polymorphic association, admin\_assistant will offer specific widgets for searching and editing this column. With `polymorphic_types` you can tell it what possible types the association can be set to.
|
|
70
|
+
|
|
71
|
+
#### strftime\_format
|
|
72
|
+
|
|
73
|
+
aa[:published_at].strftime_format = "%b %d, %Y %H:%M:%S"
|
|
74
|
+
|
|
75
|
+
If the column is a date or time, this will use the given strftime format for displaying the column in index and shows views.
|
|
76
|
+
|
|
77
|
+
### Helper methods
|
|
78
|
+
|
|
79
|
+
#### \[column\]\_value
|
|
80
|
+
|
|
81
|
+
Determines what value is passed to form inputs, index views, etc, for the individual column. This is most useful for a virtual column.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Model methods
|
|
86
|
+
|
|
87
|
+
#### name\_for\_admin\_assistant
|
|
88
|
+
|
|
89
|
+
When dealing with associations, admin\_assistant needs a convenient way to display a given record. By default, it will look for a method with the name `name`, `title`, `login`, or `username`. If you'd like to provide custom functionality across all admin\_assistant controllers, define the method `name_for_admin_assistant` on the model.
|
|
90
|
+
|
|
91
|
+
For example, let's say you have a ProductCategory class with a field `category_name`. With the code below, any time a product category is referred to through an association, admin\_assistant will display the `category_name`, in index views, form selects, etc.
|
|
92
|
+
|
|
93
|
+
class ProductCategory < ActiveRecord::Base
|
|
94
|
+
def name_for_admin_assistant
|
|
95
|
+
self.category_name
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
#### sort\_value\_for\_admin\_assistant
|
|
100
|
+
|
|
101
|
+
When showing associated records, admin\_assistant will sort by the method `sort_value_for_admin_assistant` if it's defined on the model. This comes in handy if you want to specify sorting on form drop-downs for belongs-to associations.
|
|
102
|
+
|
|
103
|
+
class Appointment < ActiveRecord::Base
|
|
104
|
+
def sort_value_for_admin_assistant
|
|
105
|
+
self.time
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: "Version 1 API: Destroy"
|
|
4
|
+
subtitle: Destroy
|
|
5
|
+
subnav: api1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Note that the `destroy` action is turned off by default. To turn it on, use the core [actions](/admin_assistant/v1/api/core.html#builder_actions) method.
|
|
9
|
+
|
|
10
|
+
By default, `destroy` simply retrieves the model instance, and calls `ActiveRecord::Base#destroy`. If you'd like to define your own custom deletion semantics, you can set a block that will be called instead of the model's built-in `destroy` method:
|
|
11
|
+
|
|
12
|
+
admin_assistant_for Product do |a|
|
|
13
|
+
a.actions << :destroy
|
|
14
|
+
a.destroy do |product|
|
|
15
|
+
product.update_attribute :deleted, true
|
|
16
|
+
product.notify_admins_of_deletion
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
You may also find plugins such as [as\_paranoid] or [acts\_as\_paranoid] useful here. If you're using a plugin such as that, which changes the behavior of `ActiveRecord::Base#destroy`, it means that you will probably not need to customize admin\_assistant in this way.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
[acts_as_paranoid]: http://ar-paranoid.rubyforge.org/
|
|
26
|
+
[as_paranoid]: http://github.com/semanticart/is_paranoid/tree/master
|
|
27
|
+
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: "Version 1 API: Form"
|
|
4
|
+
subtitle: Form
|
|
5
|
+
subnav: api1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
Form configuration affects both creating new records and updating existing records. Most of its customization happens through the form builder object:
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Admin::BlogPostsController < ApplicationController
|
|
14
|
+
admin_assistant_for BlogPost do |a|
|
|
15
|
+
a.form do |form|
|
|
16
|
+
form.columns :user, :title, :body
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
### Form config options
|
|
22
|
+
|
|
23
|
+
#### columns
|
|
24
|
+
|
|
25
|
+
form.columns :user, :title, :body
|
|
26
|
+
|
|
27
|
+
Shows only these columns in the form.
|
|
28
|
+
|
|
29
|
+
#### columns\_for\_edit
|
|
30
|
+
|
|
31
|
+
form.columns_for_edit :title, :user, :published_at, :body, :merged_into
|
|
32
|
+
|
|
33
|
+
Shows only these columns in the edit action.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
#### columns\_for\_new
|
|
37
|
+
|
|
38
|
+
form.columns_for_new :title, :user, :published_at
|
|
39
|
+
|
|
40
|
+
Shows only these columns in the new action.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
#### multi
|
|
44
|
+
|
|
45
|
+
form.multi = true
|
|
46
|
+
|
|
47
|
+
Set this to true to enable multi-record creation in your form. Validation errors will be shown on top of the individual row that caused the error, and if any of the records has a validation error, none of the records will be created.
|
|
48
|
+
|
|
49
|
+
Please note that this feature is alpha and may change significantly in the near future. As always, input is appreciated.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
#### submit\_buttons
|
|
53
|
+
|
|
54
|
+
form.submit_buttons << 'Preview'
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
By default, there is one button at the bottom of the form, saying either "Create" or "Update". By appending to this array you can specify other buttons, and then check if those buttons were clicked in `destination_after_save`, below.
|
|
58
|
+
|
|
59
|
+
### Column config options
|
|
60
|
+
|
|
61
|
+
#### datetime\_select\_options
|
|
62
|
+
|
|
63
|
+
form[:published_at].datetime_select_options =
|
|
64
|
+
{:include_blank => false, :start_year => 2009}
|
|
65
|
+
|
|
66
|
+
Passes through these options to the datetime select for this column. By default this is set to `{:include_blank => true}`.
|
|
67
|
+
|
|
68
|
+
#### default
|
|
69
|
+
|
|
70
|
+
form[:published_at].default do |controller|
|
|
71
|
+
controller.default_published_at
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
Sets a default value for the column when rendering the new form.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
#### description
|
|
78
|
+
|
|
79
|
+
form[:publish].description = "Click this check box to publish this blog post."
|
|
80
|
+
|
|
81
|
+
Sets descriptive text that will appear next to the column's input.
|
|
82
|
+
|
|
83
|
+
#### image\_size
|
|
84
|
+
|
|
85
|
+
form[:image].image_size = '300x500'
|
|
86
|
+
|
|
87
|
+
By default, [Paperclip] and [FileColumn] image files are rendered at full-size in the form. To restrict their size, pass a size string to `image_size`.
|
|
88
|
+
|
|
89
|
+
#### input
|
|
90
|
+
|
|
91
|
+
form[:publish].input = :check_box
|
|
92
|
+
|
|
93
|
+
Currently supports `:check_box`, `:select`, `:text_area`, and `:us_state`. `:us_state` will render a drop-down with U.S. states.
|
|
94
|
+
|
|
95
|
+
#### nilify\_link
|
|
96
|
+
|
|
97
|
+
Date and datetime fields come with a javascript link the clears the value in the date or datetime selects. The text of this link is "Set \[column name\] to nil" by default, but you may want to customize this text:
|
|
98
|
+
|
|
99
|
+
form[:sale_starts_at].nilify_link = 'Not on sale'
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
#### read\_only
|
|
103
|
+
|
|
104
|
+
a.form[:comment].read_only
|
|
105
|
+
|
|
106
|
+
If this is set, the given column will only be displayed, and not editable.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
#### select\_choices
|
|
110
|
+
|
|
111
|
+
form[:admin_level].select_choices = %w(normal admin superuser)
|
|
112
|
+
|
|
113
|
+
Uses this with select inputs to set or override what is passed to Rails' `select` method as its `choices` argument.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
#### select\_options
|
|
117
|
+
|
|
118
|
+
form[:user].select_options = {:include_blank => false}
|
|
119
|
+
|
|
120
|
+
Use this with belongs-to associations to tell admin\_assistant how to configure the `select` dropdown for the associated field. By default, this is set to `{:include_blank => true}`.
|
|
121
|
+
|
|
122
|
+
#### text\_area\_options
|
|
123
|
+
|
|
124
|
+
form[:body].text_area_options = {:cols => 20, :rows => 40}
|
|
125
|
+
|
|
126
|
+
Sets options to pass through to the text area that will be rendered for this column.
|
|
127
|
+
|
|
128
|
+
#### write\_once
|
|
129
|
+
|
|
130
|
+
form[:body].write_once
|
|
131
|
+
|
|
132
|
+
If this is set, the given column will only be editable on the new page, not on the edit page.
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Controller methods
|
|
136
|
+
|
|
137
|
+
#### after\_save
|
|
138
|
+
|
|
139
|
+
Runs after the record is saved.
|
|
140
|
+
|
|
141
|
+
#### before\_create
|
|
142
|
+
|
|
143
|
+
Runs before the record is created.
|
|
144
|
+
|
|
145
|
+
#### before\_save
|
|
146
|
+
|
|
147
|
+
def before_save(blog_post)
|
|
148
|
+
if params[:blog_post][:publish] && blog_post.published_at.nil?
|
|
149
|
+
blog_post.published_at = Time.now.utc
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
Runs before the record is saved.
|
|
154
|
+
|
|
155
|
+
#### before\_update
|
|
156
|
+
|
|
157
|
+
Runs before the record is updated.
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
#### before\_validation
|
|
161
|
+
|
|
162
|
+
Runs before the record is validated.
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
#### \[column\]\_exists?
|
|
166
|
+
|
|
167
|
+
Used for image fields in generating form pages. If this method exists on the controller, it will be called to see if the image exists. You'll probably use this in conjunction with `[column]_url` and `destroy_[column]_in_attributes`.
|
|
168
|
+
|
|
169
|
+
def tmp_avatar_exists?(user)
|
|
170
|
+
user.has_avatar?
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
#### \[column\]\_url
|
|
174
|
+
|
|
175
|
+
Used for image fields in generating form pages. If the existing record has an image, and this method exists on the controller, it will be called to get the URL that should be rendered. You'll probably use this in conjunction with `[column]_exists?` and `destroy_[column]_in_attributes`.
|
|
176
|
+
|
|
177
|
+
def tmp_avatar_url(user)
|
|
178
|
+
"http://my-image-server.com/users/#{user.id}.jpg?v=#{user.avatar_version}"
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
#### \[column\]\_from\_form
|
|
184
|
+
|
|
185
|
+
def tags_from_form(tags_strings)
|
|
186
|
+
tags_strings.split(/\s+/).map { |tag_str|
|
|
187
|
+
Tag.find_by_tag(tag_str) || Tag.create(:tag => tag_str)
|
|
188
|
+
}
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
Should return a value suitable for assignment. In the above example, a BlogPost has-many tags, and the method tags\_from\_form will turn the string `"funny, video, lolcat"` into an array of three Tag model records, so admin\_assistant can set BlogPost#tags to that array.
|
|
192
|
+
|
|
193
|
+
If you need to return a value from another parameter, you can accept a second argument, which will be the params hash for the record.
|
|
194
|
+
|
|
195
|
+
def title_from_form(title_str, record_params)
|
|
196
|
+
if title_str.blank?
|
|
197
|
+
record_params[:title_alt]
|
|
198
|
+
else
|
|
199
|
+
title_str
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
If the value being returned is meant to be assigned through an association, you may find it useful to return custom errors to work around the strangeness of ActiveRecord's association-assignment error-handling. So admin\_assistant lets you optionally take a 3rd errors argument, which you can use to attach errors to the core model. This error object isn't returned, but changes to it will persist outside the body of the method.
|
|
204
|
+
|
|
205
|
+
def tags_from_form(tags_string, record_params, errors)
|
|
206
|
+
tags = tags_string.split(/\s+/).map { |tag_str|
|
|
207
|
+
Tag.find_by_tag(tag_str) || Tag.create(:tag => tag_str)
|
|
208
|
+
}
|
|
209
|
+
if tags.any? { |t| !t.valid? }
|
|
210
|
+
errors.add(:tags, "One or more tags was invalid")
|
|
211
|
+
end
|
|
212
|
+
tags
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
#### destination\_after\_save
|
|
219
|
+
|
|
220
|
+
def destination_after_save(blog_post, params)
|
|
221
|
+
if params[:commit] == 'Preview'
|
|
222
|
+
{:action => 'edit', :id => blog_post.id, :preview => '1'}
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
This method should return a hash to redirect to after a successful save. If it returns nil, the default is to return to the index page.
|
|
227
|
+
|
|
228
|
+
#### destroy\_\[column\]\_in\_attributes
|
|
229
|
+
|
|
230
|
+
Used for image fields. If a file field already exists, and the user clicks on the checkbox to delete this file, this method will be called if it's defined. You'll probably use this in conjunction with `[column]_exists?` and `[column]_exists?`.
|
|
231
|
+
|
|
232
|
+
def destroy_tmp_avatar_in_attributes(attributes)
|
|
233
|
+
attributes[:has_avatar] = false
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
#### validate
|
|
238
|
+
|
|
239
|
+
Runs after the model's built-in validation, before admin\_assistant tries to save the model.
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
### Helper methods
|
|
243
|
+
|
|
244
|
+
#### after\_\[column\]\_input
|
|
245
|
+
|
|
246
|
+
If this helper method is present, whatever text it returns will be rendered after the default input for the column in the form. Takes the record as its only argument. You can also create a partial named `_after_[column]_input.html.erb`.
|
|
247
|
+
|
|
248
|
+
def after_password_input(user)
|
|
249
|
+
if user.id
|
|
250
|
+
"Reset #{check_box_tag('reset_password')}"
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
#### \[column\]\_input
|
|
255
|
+
|
|
256
|
+
If this helper method is present, whatever text it returns will be rendered instead of the default input for the column in the form. If it returns nil, the default input will be rendered instead. Takes the record as its only argument.
|
|
257
|
+
|
|
258
|
+
def password_input(user)
|
|
259
|
+
if !user.id
|
|
260
|
+
"(autogenerated)"
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
You can also create a partial named `_[column]_input.html.erb`.
|
|
265
|
+
|
|
266
|
+
#### \[column\]\_string
|
|
267
|
+
|
|
268
|
+
If this helper method is present, its returned string will be rendered within a text field. Odds are you'll use this with the controller method `[column]_from_form`, above.
|
|
269
|
+
|
|
270
|
+
def tags_string(blog_post)
|
|
271
|
+
blog_post.tags.map { |tag| tag.tag }.join ' '
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
### Partials
|
|
276
|
+
|
|
277
|
+
#### \_\[column\]\_input.html.erb
|
|
278
|
+
|
|
279
|
+
If this partial is present, it will be rendered instead of the default input for the column.
|
|
280
|
+
|
|
281
|
+
#### \_after\_\[column\]\_input.html.erb
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
If this partial is present, it will be rendered after the default input for the column. You can also use the helper method `after_[column]_input`.
|
|
285
|
+
|
|
286
|
+
#### \_after\_form.html.erb
|
|
287
|
+
|
|
288
|
+
If this partial is present in the controller's views directory, it will be rendered after the normal form.
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
[FileColumn]: http://www.kanthak.net/opensource/file_column/
|
|
292
|
+
[Paperclip]: http://thoughtbot.com/projects/paperclip
|
|
293
|
+
|