admin_assistant 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,288 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: "Version 1 API: Index"
|
4
|
+
subtitle: Index
|
5
|
+
subnav: api1
|
6
|
+
---
|
7
|
+
|
8
|
+
![index](/admin_assistant/img/blog_posts-index.png)
|
9
|
+
|
10
|
+
The index is the action that lets you view all records, with pagination and sorting. To customize it by getting the index builder inside of your admin\_assistant config:
|
11
|
+
|
12
|
+
class Admin::BlogPostsController < ApplicationController
|
13
|
+
admin_assistant_for BlogPost do |a|
|
14
|
+
a.index do |index|
|
15
|
+
index.columns :user, :title
|
16
|
+
index.sort_by 'published_at desc'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
### Index config options
|
22
|
+
|
23
|
+
#### actions
|
24
|
+
|
25
|
+
index.actions['All'] = {:all => '1'}
|
26
|
+
|
27
|
+
Adds more links to the upper-right hand-corner. By default there are two links there: "Search", and "New \[model name\]". If you have any other specific links to add, you can add them with index.actions, and they will be added to the right of those default two links.
|
28
|
+
|
29
|
+
#### cache\_total\_entries
|
30
|
+
|
31
|
+
index.cache_total_entries 12.hours
|
32
|
+
|
33
|
+
This is an optimization for large tables. Some databases are slow when trying to simply get the number of records in the table; but this number is required for any paginated view. If your index views are slow because of this, you should consider setting `cache_total_entries` to some amount of time. This will cache the count SQL request, so that the count will be slightly off for some period of time, but that probably doesn't matter if you have, for example, 150,000 users.
|
34
|
+
|
35
|
+
|
36
|
+
#### conditions
|
37
|
+
|
38
|
+
Specifies additional SQL that can restrict the records shown in the index view. This can be a simple string:
|
39
|
+
|
40
|
+
index.conditions "deleted_at is null"
|
41
|
+
|
42
|
+
It can also be a block that will be passed the params hash:
|
43
|
+
|
44
|
+
index.conditions do |params|
|
45
|
+
"deleted_at is null" unless params[:all]
|
46
|
+
end
|
47
|
+
|
48
|
+
This can also be accomplished with a protected controller method `conditions_for_index`; see below.
|
49
|
+
|
50
|
+
#### per\_page
|
51
|
+
|
52
|
+
index.per_page 100
|
53
|
+
|
54
|
+
By default, 25 rows per page will be shown. Set per\_page to set it to another number.
|
55
|
+
|
56
|
+
#### columns
|
57
|
+
|
58
|
+
index.columns :user, :title
|
59
|
+
|
60
|
+
If called, restricts which columns are shown. By default admin\_assistant will try to show all columns on the DB table, which will probably be too much if your table has a lot of columns.
|
61
|
+
|
62
|
+
Can also be used to add model methods that aren't database fields.
|
63
|
+
|
64
|
+
#### header
|
65
|
+
|
66
|
+
index.header do |params|
|
67
|
+
if params[:all]
|
68
|
+
"Blog posts (all)"
|
69
|
+
else
|
70
|
+
"Blog posts (unpublished)"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
For customization the text at the top of the page; takes a block with params as its argument
|
75
|
+
|
76
|
+
#### include
|
77
|
+
|
78
|
+
index.include :users
|
79
|
+
|
80
|
+
Accepts one or more association names to be eagerly loaded by ActiveRecord.
|
81
|
+
|
82
|
+
<a name="builder_right_column_links"> </a>
|
83
|
+
#### right\_column\_links
|
84
|
+
|
85
|
+
By default, there are two links on the right-hand side of the row for each model: "Edit" and "Show". You can add new ones by appending to `right_column_links`:
|
86
|
+
|
87
|
+
index.right_column_links << lambda { |blog_post|
|
88
|
+
[
|
89
|
+
"New comment for this blog post",
|
90
|
+
{:controller => '/admin/comments', :action => 'new',
|
91
|
+
:comment => {:blog_post_id => blog_post.id }}
|
92
|
+
]
|
93
|
+
}
|
94
|
+
|
95
|
+
The lambda should receive the model and return a two-element array: The first element should be the text of the link and the second should be the URL parameters for that link.
|
96
|
+
|
97
|
+
See also the helper method [extra\_right\_column\_links\_for\_index](#helper_extra_right_column_links_for_index).
|
98
|
+
|
99
|
+
#### search
|
100
|
+
|
101
|
+
index.search :id, :title
|
102
|
+
|
103
|
+
Shortcut to Search [`columns`](/admin_assistant/v1/api/search.html#builder_columns) .
|
104
|
+
|
105
|
+
#### sort\_by
|
106
|
+
|
107
|
+
Sets the default sorting of records, which will be used unless the user has specified sorting by clicking any of the sort headers. This can be a SQL string:
|
108
|
+
|
109
|
+
index.sort_by 'published_at desc, id asc'
|
110
|
+
|
111
|
+
It can also just be a belongs-to association:
|
112
|
+
|
113
|
+
index.sort_by :user
|
114
|
+
|
115
|
+
In the case of a belongs-to association, by default it will search for fields called `name`, `title`, `login`, or `username` on the associated model and use that.
|
116
|
+
|
117
|
+
#### total\_entries
|
118
|
+
|
119
|
+
index.total_entries = do
|
120
|
+
BlogPost.cached_count
|
121
|
+
end
|
122
|
+
|
123
|
+
This block will be called during pagination to provide the total number of records. This can come in handy if you have a huge number of records and are finding the count(\*) SQL statement too expensive.
|
124
|
+
|
125
|
+
### Column config options
|
126
|
+
|
127
|
+
There are also configurations that can be applied to specific columns in the index view.
|
128
|
+
|
129
|
+
#### ajax\_toggle
|
130
|
+
|
131
|
+
index[:textile].ajax_toggle = false
|
132
|
+
|
133
|
+
By default, all boolean fields displayed in the index can be toggled with an Ajax link. Set `ajax_toggle` to false to disable this behavior.
|
134
|
+
|
135
|
+
#### image\_size
|
136
|
+
|
137
|
+
index[:image].image_size = '300x500'
|
138
|
+
|
139
|
+
By default, [Paperclip] and [FileColumn] image files are rendered at full-size in the index. To restrict their size, pass a size string to `image_size`.
|
140
|
+
|
141
|
+
|
142
|
+
#### link\_to\_args
|
143
|
+
|
144
|
+
class Admin::BlogPostsController < ApplicationController
|
145
|
+
layout 'admin'
|
146
|
+
|
147
|
+
admin_assistant_for BlogPost do |aa|
|
148
|
+
aa.index[:user].link_to_args do |blog_post|
|
149
|
+
{:controller => 'admin/users', :action => 'edit',
|
150
|
+
:id => blog_post.user_id }
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
If you'd like this column to link somewhere from the index view, set this with a block that returns a hash for `url_for` when called.
|
157
|
+
|
158
|
+
Note that this block takes the base record as its argument, not the value of the specific column or association. In the example above, the base model is BlogPost, so the block is receiving a blog post, not the associated user.
|
159
|
+
|
160
|
+
### Controller methods
|
161
|
+
|
162
|
+
#### before\_render\_for\_index
|
163
|
+
|
164
|
+
If defined on your controller, this hook is executed just before render takes place for the index action.
|
165
|
+
|
166
|
+
class Admin::BlogPostsController < ApplicationController
|
167
|
+
layout 'admin'
|
168
|
+
|
169
|
+
admin_assistant_for BlogPost
|
170
|
+
|
171
|
+
protected
|
172
|
+
|
173
|
+
# Blog post authors should not be visible if they have requested anonymity
|
174
|
+
def before_render_for_index
|
175
|
+
@index.records.each do |record|
|
176
|
+
record.author = nil if record.author.requested_anonymity?
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
#### conditions\_for\_index
|
182
|
+
|
183
|
+
def conditions_for_index
|
184
|
+
"deleted_at is null" unless params[:all]
|
185
|
+
end
|
186
|
+
|
187
|
+
Specifies additional SQL that can restrict the records shown in the index view.
|
188
|
+
|
189
|
+
Can also be set via `index.conditions`; see `conditions` above.
|
190
|
+
|
191
|
+
### Helper methods
|
192
|
+
|
193
|
+
#### \[column\]\_html\_for\_index
|
194
|
+
|
195
|
+
def title_html_for_index(blog_post)
|
196
|
+
"TITLE #{blog_post.title.capitalize}"
|
197
|
+
end
|
198
|
+
|
199
|
+
If this method exists on the helper, it will be used to render the HTML shown in each row for the column in question. It takes the model as its only argument.
|
200
|
+
|
201
|
+
<a name="helper_extra_right_column_links_for_index"> </a>
|
202
|
+
#### extra\_right\_column\_links\_for\_index
|
203
|
+
|
204
|
+
By default, there are two links on the right-hand side of the row for each model: "Edit" and "Show". You can add new ones by returning them from `extra_right_column_links_for_index`:
|
205
|
+
|
206
|
+
def extra_right_column_links_for_index(blog_post)
|
207
|
+
link_to(
|
208
|
+
'New comment',
|
209
|
+
{
|
210
|
+
:controller => 'admin/comments', :action => 'new',
|
211
|
+
:comment => {:blog_post_id => blog_post.id}
|
212
|
+
}
|
213
|
+
)
|
214
|
+
end
|
215
|
+
|
216
|
+
Also see the builder method [right\_column\_links](#builder_right_column_links).
|
217
|
+
|
218
|
+
#### link\_to\_new\_in\_index?
|
219
|
+
|
220
|
+
The link to create a new record will be shown on the index view if there is a 'new' action for the controller (whether via admin\_assistant or otherwise). If you don't want the link generated, define a helper method like this:
|
221
|
+
|
222
|
+
def link_to_new_in_index?
|
223
|
+
false
|
224
|
+
end
|
225
|
+
|
226
|
+
#### link\_to\_search\_in\_index?
|
227
|
+
|
228
|
+
The link to the search form will be shown unless it is prevented using a define a helper method like this:
|
229
|
+
|
230
|
+
def link_to_search_in_index?
|
231
|
+
false
|
232
|
+
end
|
233
|
+
|
234
|
+
#### link\_to\_edit\_in\_index?
|
235
|
+
|
236
|
+
The edit link in the right column of each row will be shown if there is a 'edit' action for the controller (whether via admin\_assistant or otherwise). If you don't want the link generated, define a helper method like this:
|
237
|
+
|
238
|
+
def link_to_edit_in_index?(blog_post)
|
239
|
+
false
|
240
|
+
end
|
241
|
+
|
242
|
+
#### link\_to\_delete\_in\_index?
|
243
|
+
|
244
|
+
The delete link in the right column of each row will be shown if there is a 'destroy' action for the controller (whether via admin\_assistant or otherwise). If you don't want the link generated, define a helper method like this:
|
245
|
+
|
246
|
+
def link_to_delete_in_index?(blog_post)
|
247
|
+
false
|
248
|
+
end
|
249
|
+
|
250
|
+
#### link\_to\_show\_in\_index?
|
251
|
+
|
252
|
+
The show link in the right column of each row will be shown if there is a 'show' action for the controller (whether via admin\_assistant or otherwise). If you don't want the link generated, define a helper method like this:
|
253
|
+
|
254
|
+
def link_to_show_in_index?(blog_post)
|
255
|
+
false
|
256
|
+
end
|
257
|
+
|
258
|
+
#### \[column\]\_css\_class\_for\_index\_td
|
259
|
+
|
260
|
+
To add a css class to a table cell, define a helper method based on the name of the column:
|
261
|
+
|
262
|
+
def user_css_class_for_index_td(blog_post)
|
263
|
+
'custom_td_css_class'
|
264
|
+
end
|
265
|
+
|
266
|
+
#### css\_class\_for\_index\_tr
|
267
|
+
|
268
|
+
To add a css class to a table row, define a helper method like so:
|
269
|
+
|
270
|
+
def css_class_for_index_tr(blog_post)
|
271
|
+
'custom_tr_css_class'
|
272
|
+
end
|
273
|
+
|
274
|
+
### Partials
|
275
|
+
|
276
|
+
#### \_after\_index.html.erb
|
277
|
+
|
278
|
+
If this partial is present, it will be rendered after the entire index HTML.
|
279
|
+
|
280
|
+
#### \_before\_index.html.erb
|
281
|
+
|
282
|
+
If this partial is present, it will be rendered before the entire index HTML.
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
[FileColumn]: http://www.kanthak.net/opensource/file_column/
|
287
|
+
[Paperclip]: http://thoughtbot.com/projects/paperclip
|
288
|
+
|
@@ -0,0 +1,149 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: "Version 1 API"
|
4
|
+
subnav: api1
|
5
|
+
---
|
6
|
+
|
7
|
+
### Reference sections
|
8
|
+
|
9
|
+
The API reference is broken down into a few sections:
|
10
|
+
|
11
|
+
* [Core](/admin_assistant/v1/api/core.html): Settings that apply to an admin controller in general.
|
12
|
+
* [Destroy](/admin_assistant/v1/api/destroy.html): Settings that apply to destroying records. Note that `destroy` is turned off by default. To turn it on, use the core [actions](/admin_assistant/v1/api/core.html#builder_actions) method.
|
13
|
+
* [Form](/admin_assistant/v1/api/form.html): Settings that apply to creating or updating records.
|
14
|
+
* [Index](/admin_assistant/v1/api/idx.html): Settings that apply to the index view, which you use to view records, paginate, and sort.
|
15
|
+
* [Search](/admin_assistant/v1/api/search.html): Settings that apply to how searches work.
|
16
|
+
* [Show](/admin_assistant/v1/api/show.html): Settings that apply to how the show view.
|
17
|
+
|
18
|
+
|
19
|
+
### Configuration overview
|
20
|
+
|
21
|
+
|
22
|
+
There are a number of ways to configure admin\_assistant:
|
23
|
+
|
24
|
+
#### Through builder objects
|
25
|
+
|
26
|
+
`admin_assistant_for` takes a block that yields a core builder object:
|
27
|
+
|
28
|
+
class Admin::BlogPostsController < ApplicationController
|
29
|
+
layout 'admin'
|
30
|
+
|
31
|
+
admin_assistant_for BlogPost do |aa|
|
32
|
+
aa.model_class_name = 'post'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
For the actions `form` and `index`, you can get a nested builder from the core builder, which can be used to configure those individual action types.
|
37
|
+
|
38
|
+
admin_assistant_for BlogPost do |aa|
|
39
|
+
aa.index do |index|
|
40
|
+
index.sort_by "name asc"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
The nesting is intended to help organize your configuration code, but if you're in a hurry, you can also just chain the calls:
|
45
|
+
|
46
|
+
admin_assistant_for BlogPost do |aa|
|
47
|
+
aa.index.sort_by "name asc"
|
48
|
+
end
|
49
|
+
|
50
|
+
Since `search` is really a subset of `index`, its configuration builder is reached through the index builder.
|
51
|
+
|
52
|
+
admin_assistant_for BlogPost do |aa|
|
53
|
+
aa.index do |index|
|
54
|
+
index.search do |search|
|
55
|
+
search.columns :id, :title, :body
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
#### Columns on builder objects
|
61
|
+
|
62
|
+
Columns are specified on the action-types `index`, `form`, or `search`:
|
63
|
+
|
64
|
+
admin_assistant_for BlogPost do |aa|
|
65
|
+
aa.index.columns :id, :title, :body
|
66
|
+
end
|
67
|
+
|
68
|
+
There is no global `columns` setting.
|
69
|
+
|
70
|
+
These columns can be accessed with `[]`, either globally, or specific to an action-type, depending on what sort of setting is being altered.
|
71
|
+
|
72
|
+
admin_assistant_for BlogPost do |aa|
|
73
|
+
# this will apply to the :title column, both on form and index views
|
74
|
+
aa[:title].label = "Headline"
|
75
|
+
|
76
|
+
aa.form do |form|
|
77
|
+
form.columns :id, :title, :body
|
78
|
+
|
79
|
+
# This will only apply to the :title column in the form view
|
80
|
+
form[:title].description = "Enter the headline of your blog post here."
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
If you're dealing with an association, generally speaking, you'll use the column of the association name, not the foreign key ID in the database.
|
85
|
+
|
86
|
+
admin_assistant_for BlogPost do |aa|
|
87
|
+
aa.index.columns :id, :title, :user # as opposed to :user_id
|
88
|
+
end
|
89
|
+
|
90
|
+
#### Protected controller methods
|
91
|
+
|
92
|
+
For certain types of settings, the `form` and `index` action types can be customized through protected methods on the controller.
|
93
|
+
|
94
|
+
class Admin::BlogPostsController < ApplicationController
|
95
|
+
layout 'admin'
|
96
|
+
|
97
|
+
admin_assistant_for BlogPost
|
98
|
+
|
99
|
+
protected
|
100
|
+
|
101
|
+
# The index action only shows unpublished blog posts, unless somebody has
|
102
|
+
# clicked the custom "Show All" link
|
103
|
+
def conditions_for_index
|
104
|
+
"published_at is null" unless params[:all]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
Remember to make these methods protected so that Rails won't try to use them as public-facing actions, i.e. `http://www.example.com/admin/blog_posts/conditions_for_index`.
|
109
|
+
|
110
|
+
In a number of cases, you can get the same customization by passing a block to the builder object. For example, the code below works the same as the previous example:
|
111
|
+
|
112
|
+
class Admin::BlogPostsController < ApplicationController
|
113
|
+
layout 'admin'
|
114
|
+
|
115
|
+
admin_assistant_for BlogPost do |aa|
|
116
|
+
aa.index.conditions do |params|
|
117
|
+
"published_at is null" unless params[:all]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
The trade-off here is that customizing this behavior through a block is probably a little neater---fewer methods scattered all over your controller---but isn't bound to the controller. So if you find yourself needing some convenience methods on, say, `ApplicationController`, you'll be better off using a protected controller method.
|
123
|
+
|
124
|
+
#### Helper methods and partials
|
125
|
+
|
126
|
+
Other behaviors can be set by creating certain methods on the helper. Usually these behaviors have to do with presentation.
|
127
|
+
|
128
|
+
class Admin::UsersHelper
|
129
|
+
def password_input(user)
|
130
|
+
password_field_tag("user[password]", user.password, :disabled => true)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
Often you can accomplish the same thing with a partial. For example, the functionality in the above example could also be accomplished with the following saved in `app/views/admin/users/_password_input.html.erb`.
|
135
|
+
|
136
|
+
<%= password_field_tag("user[password]", user.password, :disabled => true) %>
|
137
|
+
|
138
|
+
#### Model methods
|
139
|
+
|
140
|
+
admin\_assistant can also look for methods to be defined on models, themselves. This is generally for behaviors that would apply across all admin controllers.
|
141
|
+
|
142
|
+
class ProductCategory < ActiveRecord::Base
|
143
|
+
def name_for_admin_assistant
|
144
|
+
self.category_name
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
Generally speaking there won't be many of these hooks, because in practice this can make the admin\_assistant API sort of invasive. Unless your Rails project is 99% the admin interface, it's going to get annoying to keep tripping over admin\_assistant-specific hooks when you're trying to write some front-facing code.
|
149
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: "Version 1 API: Search"
|
4
|
+
subtitle: Form
|
5
|
+
subnav: api1
|
6
|
+
---
|
7
|
+
|
8
|
+
![index](/admin_assistant/img/blog_posts-search.png)
|
9
|
+
|
10
|
+
Search restricts the records viewed in [Index] by various criteria. By default, search presents a single text field, and text entered in this field will be compared to all string and text fields in the table. By setting #columns you can have the search form specify which fields are being searched on.
|
11
|
+
|
12
|
+
Since search is closely related to [Index], its configuration is reached through the index builder:
|
13
|
+
|
14
|
+
class Admin::BlogPostsController < ApplicationController
|
15
|
+
admin_assistant_for BlogPost do |a|
|
16
|
+
a.index do |index|
|
17
|
+
index.search do |search|
|
18
|
+
search.columns :title, :user
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
You can chain calls to get to the search builder more quickly:
|
25
|
+
|
26
|
+
class Admin::BlogPostsController < ApplicationController
|
27
|
+
admin_assistant_for BlogPost do |a|
|
28
|
+
a.index.search do |search|
|
29
|
+
search.columns :title, :user
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
### Search config options
|
35
|
+
|
36
|
+
#### columns
|
37
|
+
<a name="builder_columns"> </a>
|
38
|
+
|
39
|
+
search.columns :title, :user
|
40
|
+
|
41
|
+
Call this method to set the search to supply one input for each column. When you set multiple search columns, users get the option of searching on all entered columns or any of them.
|
42
|
+
|
43
|
+
You can also call this with Index#search:
|
44
|
+
|
45
|
+
index.search :title, :user
|
46
|
+
|
47
|
+
#### default\_search\_matches\_on
|
48
|
+
|
49
|
+
If you don't specify any columns, the search form is simply one field, and whatever text is entered in that field will be compared to every text and string field on the database table. If there are other fields you'd like the default search to compare with, you can add them using `default_search_matches_on`. For example, to give users the ability to search by ID:
|
50
|
+
|
51
|
+
index.search.default_search_matches_on :id
|
52
|
+
|
53
|
+
You can also pass in SQL fragments:
|
54
|
+
|
55
|
+
index.search.default_search_matches_on \
|
56
|
+
"concat_ws(' ', users.first_name, users.last_name)"
|
57
|
+
|
58
|
+
#### include\_params\_in\_form
|
59
|
+
|
60
|
+
index.search.include_params_in_form = true
|
61
|
+
|
62
|
+
This will put any custom page params in the search form to be posted with the search parameters. You might use this if you've got another way of filtering, say, blog posts by user, and you want the search form on that page to only search within blog posts by that user.
|
63
|
+
|
64
|
+
|
65
|
+
### Column config options
|
66
|
+
|
67
|
+
These are configurations that can be applied to specific columns in the search.
|
68
|
+
|
69
|
+
#### comparators
|
70
|
+
|
71
|
+
search[:price].comparators = false
|
72
|
+
|
73
|
+
By default, integer and datetime fields are presented with a list of options for comparing to the entered value: "greater than", "greater than or equal to", "equal to", "less than or equal to", and "less than". This way the user can do a search like "show me all products that cost more than $100."
|
74
|
+
|
75
|
+
To turn this off, set `comparators` to false.
|
76
|
+
|
77
|
+
#### compare\_to\_range
|
78
|
+
|
79
|
+
search[:price].compare_to_range = true
|
80
|
+
|
81
|
+
If you want to offer a ranged search, set `compare_to_range` to true. This will render two fields for greater-than and less-than in the search.
|
82
|
+
|
83
|
+
#### conditions
|
84
|
+
|
85
|
+
search[:has_short_title].field_type = :boolean
|
86
|
+
search[:has_short_title].conditions do |has_short_title|
|
87
|
+
if has_short_title
|
88
|
+
"length(title) < 10"
|
89
|
+
elsif has_short_title == false
|
90
|
+
"length(title) >= 10"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
To be used with a virtual column in search. The block should return a SQL fragment to add to the final query, or nil to not change anything.
|
95
|
+
|
96
|
+
#### match\_text\_fields\_for\_association
|
97
|
+
|
98
|
+
search[:user].match_text_fields_for_association
|
99
|
+
|
100
|
+
Only applies to belongs-to associations. By default, belongs-to associations will be searchable using a dropdown of the associated records that currently exist. Calling `match_text_fields_for_association` will mean the input for that association will be a text input instead, and that text will be matched against all text or string fields on the associated record.
|
101
|
+
|
102
|
+
For example, let's say you have a BlogPost that belongs to a User. With this configuration on Admin::BlogPostsController:
|
103
|
+
|
104
|
+
search.columns :user
|
105
|
+
search[:user].match_text_fields_for_association
|
106
|
+
|
107
|
+
... the search form will be one field, a text input labeled "User". If the user enters "an" in that field, it will match against all blog posts by the users with the username field of "Andy", "Andrew", and "Frank".
|
108
|
+
|
109
|
+
|
110
|
+
[Index]: /admin_assistant/v1/api/idx.html
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: "Version 1 API: Show"
|
4
|
+
subtitle: Show
|
5
|
+
subnav: api1
|
6
|
+
---
|
7
|
+
|
8
|
+
Show configuration affects what is displayed in a show page, e.g. `/admin/blog_posts/show/5`.
|
9
|
+
|
10
|
+
### Show config options
|
11
|
+
|
12
|
+
#### columns
|
13
|
+
|
14
|
+
admin_assistant_for BlogPost do |aa|
|
15
|
+
aa.show.columns :user, :title, :body
|
16
|
+
end
|
17
|
+
|
18
|
+
Shows only these columns in the show page.
|
19
|
+
|
20
|
+
### Partials
|
21
|
+
|
22
|
+
#### \_\[column\]\_for_show.html.erb
|
23
|
+
|
24
|
+
If this partial is present, it will be rendered instead of the default HTML for the column.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Version 1 documentation
|
4
|
+
---
|
5
|
+
|
6
|
+
Below are the documents for admin\_assistant 1, which supports Rails 2.1.x through 2.3.x. Note that admin\_assistant 1 is deprecated, and that will only see bugfixes from now on.
|
7
|
+
|
8
|
+
* [Quick start](/admin_assistant/v1/quick_start.html)
|
9
|
+
* [Tutorial](/admin_assistant/v1/tutorial.html)
|
10
|
+
* [API](/admin_assistant/v1/api/)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: "Quick start: admin_assistant 1"
|
4
|
+
---
|
5
|
+
|
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/v1/tutorial.html">tutorial</a>.
|
8
|
+
</div>
|
9
|
+
|
10
|
+
1) Include the gem in `config/environment.rb`.
|
11
|
+
|
12
|
+
config.gem 'admin_assistant', :version => '1.0.2'
|
13
|
+
|
14
|
+
2) Install the gem and dependencies into `vendor/gems`.
|
15
|
+
|
16
|
+
rake gems:unpack:dependencies
|
17
|
+
|
18
|
+
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.
|
19
|
+
|
20
|
+
<html>
|
21
|
+
<head>
|
22
|
+
<%= javascript_include_tag("prototype", "effects", "controls") %>
|
23
|
+
<%= admin_assistant_includes %>
|
24
|
+
</head>
|
25
|
+
...
|
26
|
+
</html>
|
27
|
+
|
28
|
+
4) Setup an admin controller by attaching it to a model and using the admin layout:
|
29
|
+
|
30
|
+
class Admin::BlogPostsController < ApplicationController
|
31
|
+
layout 'admin'
|
32
|
+
|
33
|
+
admin_assistant_for BlogPost
|
34
|
+
end
|
35
|
+
|
36
|
+
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.
|
37
|
+
|
38
|
+
![index](/admin_assistant/img/blog_posts-index.png)
|
39
|
+
|
40
|
+
Depending on the model you're using, you might notice a few things:
|
41
|
+
|
42
|
+
* Boolean values can be toggled on and off in the index view.
|
43
|
+
* Any belongs-to associations are handled in the form by either a drop-down, or an Ajax autocompleter, depending on how many choices there are for the association.
|
44
|
+
* There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
|
45
|
+
* 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.
|
46
|
+
|
47
|
+
For more, check out the [API reference](/admin_assistant/v1/api/).
|
48
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: "Tutorial: admin_assistant 1"
|
4
|
+
---
|
5
|
+
|
6
|
+
<div class="note">
|
7
|
+
This document assumes you are a beginning Rails user; if you are very familiar with Rails you might want to check out our <a href="/admin_assistant/v1/quick_start.html">quick start</a>.
|
8
|
+
</div>
|
9
|
+
|
10
|
+
1) Include the gem in `config/environment.rb`.
|
11
|
+
|
12
|
+
config.gem 'admin_assistant', :version => '1.0.2'
|
13
|
+
|
14
|
+
2) Install the gem and dependencies `vendor/gems`.
|
15
|
+
|
16
|
+
rake gems:unpack:dependencies
|
17
|
+
|
18
|
+
3) 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:
|
19
|
+
|
20
|
+
<html>
|
21
|
+
<head>
|
22
|
+
<%= javascript_include_tag("prototype", "effects", "controls") %>
|
23
|
+
<%= admin_assistant_includes %>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<%=yield %>
|
27
|
+
</body>
|
28
|
+
</html>
|
29
|
+
|
30
|
+
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.
|
31
|
+
|
32
|
+
4) 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.
|
33
|
+
|
34
|
+
./script/generate controller admin/blog_posts
|
35
|
+
|
36
|
+
5) 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:
|
37
|
+
|
38
|
+
class Admin::BlogPostsController < ApplicationController
|
39
|
+
layout 'admin'
|
40
|
+
|
41
|
+
admin_assistant_for BlogPost
|
42
|
+
end
|
43
|
+
|
44
|
+
6) If you were already running your Rails app with `./script/server` etc, you should restart it.
|
45
|
+
|
46
|
+
7) Visit `/admin/blog_posts` in your browser and you'll see something like this:
|
47
|
+
|
48
|
+
![index](/admin_assistant/img/blog_posts-index.png)
|
49
|
+
|
50
|
+
You can now search, paginate, create, and edit blog posts.
|
51
|
+
|
52
|
+
Depending on the model you're using, you might notice a few things:
|
53
|
+
|
54
|
+
* Boolean values can be toggled on and off in the index view.
|
55
|
+
* Any belongs-to associations are handled in the form by either a drop-down, or an Ajax autocompleter, depending on how many choices there are for the association.
|
56
|
+
* There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
|
57
|
+
* 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.
|
58
|
+
|
59
|
+
For more, check out the [API reference](./api/).
|
60
|
+
|