admin_assistant 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -14
- data/VERSION +1 -1
- data/admin_assistant.gemspec +174 -388
- data/lib/admin_assistant/column.rb +2 -2
- data/lib/admin_assistant/has_many_column.rb +6 -1
- data/lib/admin_assistant/polymorphic_belongs_to_column.rb +5 -1
- data/lib/admin_assistant.rb +4 -5
- data/{rails_3_test → rails_3_0}/.gitignore +0 -0
- data/{rails_3_test → rails_3_0}/Gemfile +0 -0
- data/{rails_3_test → rails_3_0}/Gemfile.lock +1 -1
- data/{rails_3_test → rails_3_0}/README +0 -0
- data/{rails_3_test → rails_3_0}/Rakefile +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/appointments2_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/appointments_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts2_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts3_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts4_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts5_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts6_controller.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/controllers/admin/blog_posts_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts_read_only_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/bookmarks_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/comments2_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/comments_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/images2_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/images_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/misconfigured1_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/not_migrated_yets_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/product_categories2_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/product_categories_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/television_airings_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/television_time_slots_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/admin/users2_controller.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/controllers/admin/users_controller.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/controllers/application_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/controllers/blog_posts_controller.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/appointments_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts2_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts3_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts4_helper.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/helpers/admin/blog_posts6_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts_read_only_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/bookmarks_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/comments2_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/comments_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/images2_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/images_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/misconfigured1_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/not_migrated_yets_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/product_categories2_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/product_categories_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/television_airings_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/television_time_slots_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/helpers/admin/users2_helper.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/helpers/admin/users_helper.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/helpers/application_helper.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/appointment.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/blog_post.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/blog_post_tag.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/bookmark.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/comment.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/image.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/not_migrated_yet.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/models/product.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/product_category.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/tag.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/television_airing.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/models/television_time_slot.rb +0 -0
- data/{rails_3_test → rails_3_0}/app/models/user.rb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/appointments/_subject_input.html.erb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/appointments2/_time_input.html.erb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_after_form.html.erb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_after_index.html.erb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_after_tags_input.html.erb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_before_index.html.erb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts5/_after_index_header.html.erb +0 -0
- data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +0 -0
- data/{rails_3_test → rails_3_0}/app/views/layouts/admin.html.erb +0 -0
- data/{rails_3_test → rails_3_0}/app/views/layouts/application.html.erb +0 -0
- data/{rails_3_test → rails_3_0}/config/application.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/boot.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/database.yml +0 -0
- data/{rails_3_test → rails_3_0}/config/environment.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/environments/development.rb +0 -1
- data/{rails_3_test → rails_3_0}/config/environments/production.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/environments/test.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/initializers/backtrace_silencers.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/initializers/inflections.rb +0 -0
- data/{rails_2_test → rails_3_0}/config/initializers/mime_types.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/initializers/secret_token.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/initializers/session_store.rb +0 -0
- data/{rails_3_test → rails_3_0}/config/locales/en.yml +0 -0
- data/rails_3_0/config/routes.rb +8 -0
- data/{rails_3_test → rails_3_0}/config.ru +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090213215514_create_blog_posts.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090217225542_add_body_to_blog_posts.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090221220917_create_tags.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090221220947_create_blog_post_tags.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090222162204_add_textile_to_blog_posts.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090301191722_create_images.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090305165345_create_accounts.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090307225027_rename_accounts_to_users.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090309185114_change_blog_posts_textile.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090309193635_create_products.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090309203056_create_comments.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090323005947_create_file_column_images.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090326160049_add_birthday_to_users.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090326223606_add_state_to_users.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090503134004_add_file_column_image_to_products.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090617173651_create_bookmarks.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090625144313_add_avatar_fields_to_user.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090701171857_add_force_textile_to_users.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090704163647_add_deleted_at_to_products.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090704173800_add_sale_fields_to_products.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090714024501_create_product_categories.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20090819162835_add_admin_level_to_users.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20091221011256_add_position_to_product_categories.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20091222160814_create_appointments.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20091227224547_add_user_id_to_appointments.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20100214213359_create_television_time_slots.rb +0 -0
- data/{rails_2_test → rails_3_0}/db/migrate/20100214213451_create_television_airings.rb +0 -0
- data/{rails_3_test → rails_3_0}/db/migrate/20110426215702_remove_avatar_fields_from_users.rb +0 -0
- data/{rails_3_test → rails_3_0}/db/seeds.rb +0 -0
- data/{rails_3_test → rails_3_0}/doc/README_FOR_APP +0 -0
- data/{rails_3_test → rails_3_0}/lib/tasks/.gitkeep +0 -0
- data/{rails_3_test → rails_3_0}/public/404.html +0 -0
- data/{rails_3_test → rails_3_0}/public/422.html +0 -0
- data/{rails_3_test → rails_3_0}/public/500.html +0 -0
- data/{rails_2_test → rails_3_0}/public/favicon.ico +0 -0
- data/{rails_2_test → rails_3_0}/public/images/rails.png +0 -0
- data/{rails_3_test → rails_3_0}/public/index.html +0 -0
- data/{rails_2_test → rails_3_0}/public/javascripts/application.js +0 -0
- data/{rails_2_test → rails_3_0}/public/javascripts/jquery-1.4.4.min.js +0 -0
- data/{rails_3_test → rails_3_0}/public/javascripts/rails.js +0 -0
- data/{rails_2_test → rails_3_0}/public/robots.txt +0 -0
- data/{rails_3_test → rails_3_0}/public/stylesheets/.gitkeep +0 -0
- data/{rails_2_test → rails_3_0}/public/stylesheets/admin.css +0 -0
- data/{rails_2_test → rails_3_0}/public/stylesheets/scaffold.css +0 -0
- data/{rails_3_test → rails_3_0}/script/rails +0 -0
- data/{rails_2_test → rails_3_0}/test/data/ruby_throated.jpg +0 -0
- data/{rails_2_test → rails_3_0}/test/data/tweenbot.jpg +0 -0
- data/{rails_3_test → rails_3_0}/test/fixtures/placeholder.txt +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/appointments2_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/appointments_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts2_integration_test.rb +2 -2
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts3_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts4_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts5_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts6_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts_integration_test.rb +8 -16
- data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts_read_only_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/bookmarks_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/comments2_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/comments_integration_test.rb +0 -0
- data/{rails_2_test → rails_3_0}/test/integration/admin/images2_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/images_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/misconfigured1_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/product_categories2_integration_test.rb +0 -0
- data/{rails_2_test → rails_3_0}/test/integration/admin/product_categories_integration_test.rb +0 -0
- data/{rails_2_test → rails_3_0}/test/integration/admin/television_airings_integration_test.rb +0 -0
- data/{rails_2_test → rails_3_0}/test/integration/admin/users2_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/admin/users_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/integration/blog_posts_integration_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/performance/browsing_test.rb +0 -0
- data/{rails_3_test → rails_3_0}/test/test_helper.rb +40 -0
- data/{rails_3_test → rails_3_0}/vendor/plugins/.gitkeep +0 -0
- data/rails_3_1/Gemfile +12 -0
- data/rails_3_1/Gemfile.lock +116 -0
- data/rails_3_1/README +256 -0
- data/{rails_2_test → rails_3_1}/Rakefile +2 -8
- data/rails_3_1/config.ru +4 -0
- metadata +176 -390
- data/lib/admin_assistant/date_time_range_end_point_selector.rb +0 -341
- data/rails_2_test/README +0 -256
- data/rails_2_test/app/controllers/admin/blog_posts_controller.rb +0 -8
- data/rails_2_test/app/controllers/admin/file_column_images2_controller.rb +0 -10
- data/rails_2_test/app/controllers/admin/file_column_images_controller.rb +0 -6
- data/rails_2_test/app/controllers/admin/products2_controller.rb +0 -15
- data/rails_2_test/app/controllers/admin/products_controller.rb +0 -31
- data/rails_2_test/app/controllers/admin/users_controller.rb +0 -63
- data/rails_2_test/app/controllers/application.rb +0 -16
- data/rails_2_test/app/controllers/application_controller.rb +0 -16
- data/rails_2_test/app/helpers/admin/appointments2_helper.rb +0 -2
- data/rails_2_test/app/helpers/admin/blog_posts6_helper.rb +0 -16
- data/rails_2_test/app/helpers/admin/file_column_images2_helper.rb +0 -2
- data/rails_2_test/app/helpers/admin/file_column_images_helper.rb +0 -2
- data/rails_2_test/app/helpers/admin/products2_helper.rb +0 -3
- data/rails_2_test/app/helpers/admin/products_helper.rb +0 -6
- data/rails_2_test/app/helpers/admin/users_helper.rb +0 -25
- data/rails_2_test/app/helpers/application_helper.rb +0 -3
- data/rails_2_test/app/helpers/blog_posts_helper.rb +0 -2
- data/rails_2_test/app/models/file_column_image.rb +0 -3
- data/rails_2_test/app/models/product.rb +0 -7
- data/rails_2_test/app/models/user.rb +0 -14
- data/rails_2_test/app/views/admin/products/_name_input.html.erb +0 -2
- data/rails_2_test/app/views/admin/products/_percent_off_input.html.erb +0 -2
- data/rails_2_test/app/views/admin/products/_price_input.html.erb +0 -10
- data/rails_2_test/app/views/blog_posts/show.html.erb +0 -13
- data/rails_2_test/app/views/layouts/admin.html.erb +0 -31
- data/rails_2_test/config/boot.rb +0 -109
- data/rails_2_test/config/database.yml +0 -28
- data/rails_2_test/config/environment.rb +0 -78
- data/rails_2_test/config/environments/development.rb +0 -17
- data/rails_2_test/config/environments/production.rb +0 -24
- data/rails_2_test/config/environments/test.rb +0 -24
- data/rails_2_test/config/initializers/inflections.rb +0 -10
- data/rails_2_test/config/initializers/new_rails_defaults.rb +0 -17
- data/rails_2_test/config/locales/en.yml +0 -5
- data/rails_2_test/config/routes.rb +0 -43
- data/rails_2_test/doc/README_FOR_APP +0 -5
- data/rails_2_test/lib/tasks/rspec.rake +0 -163
- data/rails_2_test/public/404.html +0 -30
- data/rails_2_test/public/422.html +0 -30
- data/rails_2_test/public/500.html +0 -33
- data/rails_2_test/public/dispatch.cgi +0 -10
- data/rails_2_test/public/dispatch.fcgi +0 -24
- data/rails_2_test/public/dispatch.rb +0 -10
- data/rails_2_test/public/index.html +0 -274
- data/rails_2_test/script/about +0 -4
- data/rails_2_test/script/autospec +0 -5
- data/rails_2_test/script/console +0 -3
- data/rails_2_test/script/dbconsole +0 -3
- data/rails_2_test/script/destroy +0 -3
- data/rails_2_test/script/generate +0 -3
- data/rails_2_test/script/performance/benchmarker +0 -3
- data/rails_2_test/script/performance/profiler +0 -3
- data/rails_2_test/script/performance/request +0 -3
- data/rails_2_test/script/plugin +0 -3
- data/rails_2_test/script/populate_tables.rb +0 -49
- data/rails_2_test/script/process/inspector +0 -3
- data/rails_2_test/script/process/reaper +0 -3
- data/rails_2_test/script/process/spawner +0 -3
- data/rails_2_test/script/runner +0 -3
- data/rails_2_test/script/server +0 -3
- data/rails_2_test/script/spec +0 -5
- data/rails_2_test/script/spec_server +0 -125
- data/rails_2_test/test/fixtures/file_column_images.yml +0 -7
- data/rails_2_test/test/integration/admin/appointments2_integration_test.rb +0 -79
- data/rails_2_test/test/integration/admin/appointments_integration_test.rb +0 -367
- data/rails_2_test/test/integration/admin/blog_posts2_integration_test.rb +0 -806
- data/rails_2_test/test/integration/admin/blog_posts3_integration_test.rb +0 -418
- data/rails_2_test/test/integration/admin/blog_posts4_integration_test.rb +0 -189
- data/rails_2_test/test/integration/admin/blog_posts5_integration_test.rb +0 -75
- data/rails_2_test/test/integration/admin/blog_posts6_integration_test.rb +0 -39
- data/rails_2_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +0 -89
- data/rails_2_test/test/integration/admin/blog_posts_integration_test.rb +0 -788
- data/rails_2_test/test/integration/admin/blog_posts_read_only_integration_test.rb +0 -69
- data/rails_2_test/test/integration/admin/bookmarks_integration_test.rb +0 -445
- data/rails_2_test/test/integration/admin/comments2_integration_test.rb +0 -52
- data/rails_2_test/test/integration/admin/comments_integration_test.rb +0 -50
- data/rails_2_test/test/integration/admin/file_column_images2_integration_test.rb +0 -19
- data/rails_2_test/test/integration/admin/file_column_images_integration_test.rb +0 -69
- data/rails_2_test/test/integration/admin/images_integration_test.rb +0 -79
- data/rails_2_test/test/integration/admin/misconfigured1_integration_test.rb +0 -17
- data/rails_2_test/test/integration/admin/product_categories2_integration_test.rb +0 -179
- data/rails_2_test/test/integration/admin/products2_integration_test.rb +0 -155
- data/rails_2_test/test/integration/admin/products_integration_test.rb +0 -210
- data/rails_2_test/test/integration/admin/users_integration_test.rb +0 -266
- data/rails_2_test/test/integration/blog_posts_integration_test.rb +0 -9
- data/rails_2_test/test/test_helper.rb +0 -114
- data/rails_2_test/vendor/plugins/file_column/CHANGELOG +0 -69
- data/rails_2_test/vendor/plugins/file_column/README +0 -54
- data/rails_2_test/vendor/plugins/file_column/Rakefile +0 -36
- data/rails_2_test/vendor/plugins/file_column/TODO +0 -6
- data/rails_2_test/vendor/plugins/file_column/init.rb +0 -13
- data/rails_2_test/vendor/plugins/file_column/lib/file_column.rb +0 -723
- data/rails_2_test/vendor/plugins/file_column/lib/file_column_helper.rb +0 -150
- data/rails_2_test/vendor/plugins/file_column/lib/file_compat.rb +0 -28
- data/rails_2_test/vendor/plugins/file_column/lib/magick_file_column.rb +0 -260
- data/rails_2_test/vendor/plugins/file_column/lib/rails_file_column.rb +0 -19
- data/rails_2_test/vendor/plugins/file_column/lib/test_case.rb +0 -124
- data/rails_2_test/vendor/plugins/file_column/lib/validations.rb +0 -112
- data/rails_2_test/vendor/plugins/file_column/test/abstract_unit.rb +0 -63
- data/rails_2_test/vendor/plugins/file_column/test/connection.rb +0 -17
- data/rails_2_test/vendor/plugins/file_column/test/file_column_helper_test.rb +0 -97
- data/rails_2_test/vendor/plugins/file_column/test/file_column_test.rb +0 -650
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/entry.rb +0 -32
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +0 -1
- 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 +0 -25
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/schema.rb +0 -10
- 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 +0 -380
- data/rails_2_test/vendor/plugins/file_column/test/magick_view_only_test.rb +0 -21
- data/rails_3_test/app/controllers/admin/appointments2_controller.rb +0 -15
- data/rails_3_test/app/controllers/admin/appointments_controller.rb +0 -11
- data/rails_3_test/app/controllers/admin/blog_posts2_controller.rb +0 -138
- data/rails_3_test/app/controllers/admin/blog_posts3_controller.rb +0 -76
- data/rails_3_test/app/controllers/admin/blog_posts4_controller.rb +0 -21
- data/rails_3_test/app/controllers/admin/blog_posts5_controller.rb +0 -27
- data/rails_3_test/app/controllers/admin/blog_posts6_controller.rb +0 -10
- data/rails_3_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +0 -15
- data/rails_3_test/app/controllers/admin/blog_posts_read_only_controller.rb +0 -19
- data/rails_3_test/app/controllers/admin/bookmarks_controller.rb +0 -11
- data/rails_3_test/app/controllers/admin/comments2_controller.rb +0 -14
- data/rails_3_test/app/controllers/admin/comments_controller.rb +0 -12
- data/rails_3_test/app/controllers/admin/images2_controller.rb +0 -11
- data/rails_3_test/app/controllers/admin/images_controller.rb +0 -6
- data/rails_3_test/app/controllers/admin/misconfigured1_controller.rb +0 -7
- data/rails_3_test/app/controllers/admin/not_migrated_yets_controller.rb +0 -9
- data/rails_3_test/app/controllers/admin/product_categories2_controller.rb +0 -7
- data/rails_3_test/app/controllers/admin/product_categories_controller.rb +0 -5
- data/rails_3_test/app/controllers/admin/television_airings_controller.rb +0 -5
- data/rails_3_test/app/controllers/admin/television_time_slots_controller.rb +0 -5
- data/rails_3_test/app/controllers/admin/users2_controller.rb +0 -10
- data/rails_3_test/app/controllers/blog_posts_controller.rb +0 -5
- data/rails_3_test/app/helpers/admin/appointments_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/blog_posts2_helper.rb +0 -27
- data/rails_3_test/app/helpers/admin/blog_posts3_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/blog_posts4_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +0 -29
- data/rails_3_test/app/helpers/admin/blog_posts_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/blog_posts_read_only_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/bookmarks_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/comments2_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/comments_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/images2_helper.rb +0 -8
- data/rails_3_test/app/helpers/admin/images_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/misconfigured1_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/not_migrated_yets_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/product_categories2_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/product_categories_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/television_airings_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/television_time_slots_helper.rb +0 -2
- data/rails_3_test/app/helpers/admin/users2_helper.rb +0 -2
- data/rails_3_test/app/models/appointment.rb +0 -5
- data/rails_3_test/app/models/blog_post.rb +0 -14
- data/rails_3_test/app/models/blog_post_tag.rb +0 -6
- data/rails_3_test/app/models/bookmark.rb +0 -6
- data/rails_3_test/app/models/comment.rb +0 -4
- data/rails_3_test/app/models/image.rb +0 -3
- data/rails_3_test/app/models/not_migrated_yet.rb +0 -2
- data/rails_3_test/app/models/product_category.rb +0 -9
- data/rails_3_test/app/models/tag.rb +0 -4
- data/rails_3_test/app/models/television_airing.rb +0 -3
- data/rails_3_test/app/models/television_time_slot.rb +0 -11
- data/rails_3_test/app/views/admin/appointments/_subject_input.html.erb +0 -2
- data/rails_3_test/app/views/admin/appointments2/_time_input.html.erb +0 -31
- data/rails_3_test/app/views/admin/blog_posts2/_after_form.html.erb +0 -5
- data/rails_3_test/app/views/admin/blog_posts2/_after_index.html.erb +0 -1
- data/rails_3_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +0 -16
- data/rails_3_test/app/views/admin/blog_posts2/_before_index.html.erb +0 -2
- data/rails_3_test/app/views/admin/blog_posts5/_after_index_header.html.erb +0 -8
- data/rails_3_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +0 -1
- data/rails_3_test/config/initializers/mime_types.rb +0 -5
- data/rails_3_test/config/routes.rb +0 -63
- data/rails_3_test/db/migrate/20090213215514_create_blog_posts.rb +0 -12
- data/rails_3_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +0 -9
- data/rails_3_test/db/migrate/20090221220917_create_tags.rb +0 -13
- data/rails_3_test/db/migrate/20090221220947_create_blog_post_tags.rb +0 -14
- data/rails_3_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +0 -9
- data/rails_3_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +0 -9
- data/rails_3_test/db/migrate/20090301191722_create_images.rb +0 -16
- data/rails_3_test/db/migrate/20090305165345_create_accounts.rb +0 -14
- data/rails_3_test/db/migrate/20090307225027_rename_accounts_to_users.rb +0 -9
- data/rails_3_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +0 -9
- data/rails_3_test/db/migrate/20090309185114_change_blog_posts_textile.rb +0 -9
- data/rails_3_test/db/migrate/20090309193635_create_products.rb +0 -14
- data/rails_3_test/db/migrate/20090309203056_create_comments.rb +0 -15
- data/rails_3_test/db/migrate/20090323005947_create_file_column_images.rb +0 -12
- data/rails_3_test/db/migrate/20090326160049_add_birthday_to_users.rb +0 -9
- data/rails_3_test/db/migrate/20090326223606_add_state_to_users.rb +0 -9
- data/rails_3_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +0 -9
- data/rails_3_test/db/migrate/20090617173651_create_bookmarks.rb +0 -15
- data/rails_3_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +0 -9
- data/rails_3_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +0 -11
- data/rails_3_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +0 -9
- data/rails_3_test/db/migrate/20090701171857_add_force_textile_to_users.rb +0 -9
- data/rails_3_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +0 -9
- data/rails_3_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +0 -13
- data/rails_3_test/db/migrate/20090714024501_create_product_categories.rb +0 -15
- data/rails_3_test/db/migrate/20090819162835_add_admin_level_to_users.rb +0 -9
- data/rails_3_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +0 -11
- data/rails_3_test/db/migrate/20091221011256_add_position_to_product_categories.rb +0 -9
- data/rails_3_test/db/migrate/20091222160814_create_appointments.rb +0 -14
- data/rails_3_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +0 -9
- data/rails_3_test/db/migrate/20100214213359_create_television_time_slots.rb +0 -13
- data/rails_3_test/db/migrate/20100214213451_create_television_airings.rb +0 -15
- data/rails_3_test/public/favicon.ico +0 -0
- data/rails_3_test/public/images/rails.png +0 -0
- data/rails_3_test/public/javascripts/application.js +0 -2
- data/rails_3_test/public/javascripts/jquery-1.4.4.min.js +0 -167
- data/rails_3_test/public/robots.txt +0 -5
- data/rails_3_test/public/stylesheets/admin.css +0 -3
- data/rails_3_test/public/stylesheets/scaffold.css +0 -54
- 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/integration/admin/images2_integration_test.rb +0 -33
- data/rails_3_test/test/integration/admin/product_categories_integration_test.rb +0 -12
- data/rails_3_test/test/integration/admin/television_airings_integration_test.rb +0 -25
- data/rails_3_test/test/integration/admin/users2_integration_test.rb +0 -48
@@ -1,341 +0,0 @@
|
|
1
|
-
class AdminAssistant
|
2
|
-
# Copied (and then streamlined) from Rails 2.3.5 in an effort to provide
|
3
|
-
# consistent functionality all the way back to Rails 2.1.0
|
4
|
-
class DateTimeRangeEndPointSelector
|
5
|
-
include ActionView::Helpers::RawOutputHelper
|
6
|
-
include ActionView::Helpers::TagHelper
|
7
|
-
|
8
|
-
DEFAULT_PREFIX = 'date'.freeze unless const_defined?('DEFAULT_PREFIX')
|
9
|
-
POSITION = {
|
10
|
-
:year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6
|
11
|
-
}.freeze unless const_defined?('POSITION')
|
12
|
-
|
13
|
-
def initialize(datetime, options = {}, html_options = {})
|
14
|
-
@options = options.dup
|
15
|
-
@html_options = html_options.dup
|
16
|
-
@datetime = datetime
|
17
|
-
end
|
18
|
-
|
19
|
-
def select_datetime
|
20
|
-
# TODO: Remove tag conditional
|
21
|
-
# Ideally we could just join select_date and select_date for the tag case
|
22
|
-
if @options[:tag] && @options[:ignore_date]
|
23
|
-
select_time
|
24
|
-
elsif @options[:tag]
|
25
|
-
order = date_order.dup
|
26
|
-
order -= [:hour, :minute, :second]
|
27
|
-
|
28
|
-
@options[:discard_year] ||= true unless order.include?(:year)
|
29
|
-
@options[:discard_month] ||= true unless order.include?(:month)
|
30
|
-
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
|
31
|
-
@options[:discard_minute] ||= true if @options[:discard_hour]
|
32
|
-
@options[:discard_second] ||= true unless @options[:include_seconds] && !@options[:discard_minute]
|
33
|
-
|
34
|
-
# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
|
35
|
-
# valid (otherwise it could be 31 and february wouldn't be a valid date)
|
36
|
-
if @datetime && @options[:discard_day] && !@options[:discard_month]
|
37
|
-
@datetime = @datetime.change(:day => 1)
|
38
|
-
end
|
39
|
-
|
40
|
-
[:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
|
41
|
-
order += [:hour, :minute, :second] unless @options[:discard_hour]
|
42
|
-
|
43
|
-
build_selects_from_types(order)
|
44
|
-
else
|
45
|
-
"#{select_date}#{@options[:datetime_separator]}#{select_time}"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def select_date
|
50
|
-
order = date_order.dup
|
51
|
-
|
52
|
-
# TODO: Remove tag conditional
|
53
|
-
if @options[:tag]
|
54
|
-
@options[:discard_hour] = true
|
55
|
-
@options[:discard_minute] = true
|
56
|
-
@options[:discard_second] = true
|
57
|
-
|
58
|
-
@options[:discard_year] ||= true unless order.include?(:year)
|
59
|
-
@options[:discard_month] ||= true unless order.include?(:month)
|
60
|
-
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
|
61
|
-
|
62
|
-
# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
|
63
|
-
# valid (otherwise it could be 31 and february wouldn't be a valid date)
|
64
|
-
if @datetime && @options[:discard_day] && !@options[:discard_month]
|
65
|
-
@datetime = @datetime.change(:day => 1)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
[:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
|
70
|
-
|
71
|
-
build_selects_from_types(order)
|
72
|
-
end
|
73
|
-
|
74
|
-
def select_time
|
75
|
-
order = []
|
76
|
-
|
77
|
-
# TODO: Remove tag conditional
|
78
|
-
if @options[:tag]
|
79
|
-
@options[:discard_month] = true
|
80
|
-
@options[:discard_year] = true
|
81
|
-
@options[:discard_day] = true
|
82
|
-
@options[:discard_second] ||= true unless @options[:include_seconds]
|
83
|
-
|
84
|
-
order += [:year, :month, :day] unless @options[:ignore_date]
|
85
|
-
end
|
86
|
-
|
87
|
-
order += [:hour, :minute]
|
88
|
-
order << :second if @options[:include_seconds]
|
89
|
-
|
90
|
-
build_selects_from_types(order)
|
91
|
-
end
|
92
|
-
|
93
|
-
def select_second
|
94
|
-
if @options[:use_hidden] || @options[:discard_second]
|
95
|
-
build_hidden(:second, sec) if @options[:include_seconds]
|
96
|
-
else
|
97
|
-
build_options_and_select(:second, sec)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def select_minute
|
102
|
-
if @options[:use_hidden] || @options[:discard_minute]
|
103
|
-
build_hidden(:minute, min)
|
104
|
-
else
|
105
|
-
build_options_and_select(:minute, min, :step => @options[:minute_step])
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def select_hour
|
110
|
-
if @options[:use_hidden] || @options[:discard_hour]
|
111
|
-
build_hidden(:hour, hour)
|
112
|
-
else
|
113
|
-
build_options_and_select(:hour, hour, :end => 23)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def select_day
|
118
|
-
if @options[:use_hidden] || @options[:discard_day]
|
119
|
-
build_hidden(:day, day)
|
120
|
-
else
|
121
|
-
build_options_and_select(:day, day, :start => 1, :end => 31, :leading_zeros => false)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def select_month
|
126
|
-
if @options[:use_hidden] || @options[:discard_month]
|
127
|
-
build_hidden(:month, month)
|
128
|
-
else
|
129
|
-
month_options = []
|
130
|
-
1.upto(12) do |month_number|
|
131
|
-
options = { :value => month_number }
|
132
|
-
options[:selected] = "selected" if month == month_number
|
133
|
-
month_options << content_tag(:option, month_name(month_number), options) + "\n"
|
134
|
-
end
|
135
|
-
build_select(:month, month_options.join)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def select_year
|
140
|
-
if !@datetime || @datetime == 0
|
141
|
-
val = ''
|
142
|
-
middle_year = Date.today.year
|
143
|
-
else
|
144
|
-
val = middle_year = year
|
145
|
-
end
|
146
|
-
|
147
|
-
if @options[:use_hidden] || @options[:discard_year]
|
148
|
-
build_hidden(:year, val)
|
149
|
-
else
|
150
|
-
options = {}
|
151
|
-
options[:start] = @options[:start_year] || middle_year - 5
|
152
|
-
options[:end] = @options[:end_year] || middle_year + 5
|
153
|
-
options[:step] = options[:start] < options[:end] ? 1 : -1
|
154
|
-
options[:leading_zeros] = false
|
155
|
-
|
156
|
-
build_options_and_select(:year, val, options)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
private
|
161
|
-
%w( sec min hour day month year ).each do |method|
|
162
|
-
define_method(method) do
|
163
|
-
@datetime.kind_of?(Fixnum) ? @datetime : @datetime.send(method) if @datetime
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
# Returns translated month names, but also ensures that a custom month
|
168
|
-
# name array has a leading nil element
|
169
|
-
def month_names
|
170
|
-
month_names = @options[:use_month_names] || translated_month_names
|
171
|
-
month_names.unshift(nil) if month_names.size < 13
|
172
|
-
month_names
|
173
|
-
end
|
174
|
-
|
175
|
-
# Returns translated month names
|
176
|
-
# => [nil, "January", "February", "March",
|
177
|
-
# "April", "May", "June", "July",
|
178
|
-
# "August", "September", "October",
|
179
|
-
# "November", "December"]
|
180
|
-
#
|
181
|
-
# If :use_short_month option is set
|
182
|
-
# => [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
183
|
-
# "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
184
|
-
def translated_month_names
|
185
|
-
if @options[:use_short_month]
|
186
|
-
[nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
|
187
|
-
"Oct", "Nov", "Dec"]
|
188
|
-
else
|
189
|
-
[nil, "January", "February", "March", "April", "May", "June", "July",
|
190
|
-
"August", "September", "October", "November", "December"]
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
# Lookup month name for number
|
195
|
-
# month_name(1) => "January"
|
196
|
-
#
|
197
|
-
# If :use_month_numbers option is passed
|
198
|
-
# month_name(1) => 1
|
199
|
-
#
|
200
|
-
# If :add_month_numbers option is passed
|
201
|
-
# month_name(1) => "1 - January"
|
202
|
-
def month_name(number)
|
203
|
-
if @options[:use_month_numbers]
|
204
|
-
number
|
205
|
-
elsif @options[:add_month_numbers]
|
206
|
-
"#{number} - #{month_names[number]}"
|
207
|
-
else
|
208
|
-
month_names[number]
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def date_order
|
213
|
-
@options[:order] || translated_date_order
|
214
|
-
end
|
215
|
-
|
216
|
-
def translated_date_order
|
217
|
-
[:year, :month, :day]
|
218
|
-
end
|
219
|
-
|
220
|
-
# Build full select tag from date type and options
|
221
|
-
def build_options_and_select(type, selected, options = {})
|
222
|
-
build_select(type, build_options(selected, options))
|
223
|
-
end
|
224
|
-
|
225
|
-
# Build select option html from date value and options
|
226
|
-
# build_options(15, :start => 1, :end => 31)
|
227
|
-
# => "<option value="1">1</option>
|
228
|
-
# <option value=\"2\">2</option>
|
229
|
-
# <option value=\"3\">3</option>..."
|
230
|
-
def build_options(selected, options = {})
|
231
|
-
start = options.delete(:start) || 0
|
232
|
-
stop = options.delete(:end) || 59
|
233
|
-
step = options.delete(:step) || 1
|
234
|
-
leading_zeros = options.delete(:leading_zeros).nil? ? true : false
|
235
|
-
|
236
|
-
select_options = []
|
237
|
-
start.step(stop, step) do |i|
|
238
|
-
value = leading_zeros ? sprintf("%02d", i) : i
|
239
|
-
tag_options = { :value => value }
|
240
|
-
tag_options[:selected] = "selected" if selected == i
|
241
|
-
select_options << content_tag(:option, value, tag_options)
|
242
|
-
end
|
243
|
-
select_options.join("\n") + "\n"
|
244
|
-
end
|
245
|
-
|
246
|
-
# Builds select tag from date type and html select options
|
247
|
-
# build_select(:month, "<option value="1">January</option>...")
|
248
|
-
# => "<select id="post_written_on_2i" name="post[written_on(2i)]">
|
249
|
-
# <option value="1">January</option>...
|
250
|
-
# </select>"
|
251
|
-
def build_select(type, select_options_as_html)
|
252
|
-
select_options = {
|
253
|
-
:id => input_id_from_type(type),
|
254
|
-
:name => input_name_from_type(type)
|
255
|
-
}.merge(@html_options)
|
256
|
-
select_options.merge!(:disabled => 'disabled') if @options[:disabled]
|
257
|
-
|
258
|
-
select_html = "\n"
|
259
|
-
select_html << content_tag(:option, '', :value => '') + "\n" if @options[:include_blank]
|
260
|
-
select_html << prompt_option_tag(type, @options[:prompt]) + "\n" if @options[:prompt]
|
261
|
-
select_html << select_options_as_html.to_s
|
262
|
-
|
263
|
-
content_tag(:select, raw(select_html), select_options) + "\n"
|
264
|
-
end
|
265
|
-
|
266
|
-
# Builds a prompt option tag with supplied options or from default options
|
267
|
-
# prompt_option_tag(:month, :prompt => 'Select month')
|
268
|
-
# => "<option value="">Select month</option>"
|
269
|
-
def prompt_option_tag(type, options)
|
270
|
-
default_options = {:year => false, :month => false, :day => false, :hour => false, :minute => false, :second => false}
|
271
|
-
|
272
|
-
case options
|
273
|
-
when Hash
|
274
|
-
prompt = default_options.merge(options)[type.to_sym]
|
275
|
-
when String
|
276
|
-
prompt = options
|
277
|
-
else
|
278
|
-
prompt = I18n.translate(('datetime.prompts.' + type.to_s).to_sym, :locale => @options[:locale])
|
279
|
-
end
|
280
|
-
|
281
|
-
prompt ? content_tag(:option, prompt, :value => '') : ''
|
282
|
-
end
|
283
|
-
|
284
|
-
# Builds hidden input tag for date part and value
|
285
|
-
# build_hidden(:year, 2008)
|
286
|
-
# => "<input id="post_written_on_1i" name="post[written_on(1i)]" type="hidden" value="2008" />"
|
287
|
-
def build_hidden(type, value)
|
288
|
-
tag(:input, {
|
289
|
-
:type => "hidden",
|
290
|
-
:id => input_id_from_type(type),
|
291
|
-
:name => input_name_from_type(type),
|
292
|
-
:value => value
|
293
|
-
}) + "\n"
|
294
|
-
end
|
295
|
-
|
296
|
-
# Returns the name attribute for the input tag
|
297
|
-
# => post[written_on(1i)]
|
298
|
-
def input_name_from_type(type)
|
299
|
-
prefix = @options[:prefix] || DEFAULT_PREFIX
|
300
|
-
prefix += "[#{@options[:index]}]" if @options.has_key?(:index)
|
301
|
-
|
302
|
-
field_name = @options[:field_name] || type
|
303
|
-
if @options[:include_position]
|
304
|
-
field_name += "(#{POSITION[type]}i)"
|
305
|
-
end
|
306
|
-
|
307
|
-
@options[:discard_type] ? prefix : "#{prefix}[#{field_name}]"
|
308
|
-
end
|
309
|
-
|
310
|
-
# Returns the id attribute for the input tag
|
311
|
-
# => "post_written_on_1i"
|
312
|
-
def input_id_from_type(type)
|
313
|
-
input_name_from_type(type).gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '')
|
314
|
-
end
|
315
|
-
|
316
|
-
# Given an ordering of datetime components, create the selection HTML
|
317
|
-
# and join them with their appropriate separators.
|
318
|
-
def build_selects_from_types(order)
|
319
|
-
select = ''
|
320
|
-
order.reverse.each do |type|
|
321
|
-
separator = separator(type) unless type == order.first # don't add on last field
|
322
|
-
select.insert(0, separator.to_s + send("select_#{type}").to_s)
|
323
|
-
end
|
324
|
-
select
|
325
|
-
end
|
326
|
-
|
327
|
-
# Returns the separator for a given datetime component
|
328
|
-
def separator(type)
|
329
|
-
case type
|
330
|
-
when :month, :day
|
331
|
-
@options[:date_separator]
|
332
|
-
when :hour
|
333
|
-
(@options[:discard_year] && @options[:discard_day]) ? "" : @options[:datetime_separator]
|
334
|
-
when :minute
|
335
|
-
@options[:time_separator]
|
336
|
-
when :second
|
337
|
-
@options[:include_seconds] ? @options[:time_separator] : ""
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|
data/rails_2_test/README
DELETED
@@ -1,256 +0,0 @@
|
|
1
|
-
== Welcome to Rails
|
2
|
-
|
3
|
-
Rails is a web-application framework that includes everything needed to create
|
4
|
-
database-backed web applications according to the Model-View-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb" templates
|
7
|
-
that are primarily responsible for inserting pre-built data in between HTML tags.
|
8
|
-
The model contains the "smart" domain objects (such as Account, Product, Person,
|
9
|
-
Post) that holds all the business logic and knows how to persist themselves to
|
10
|
-
a database. The controller handles the incoming requests (such as Save New Account,
|
11
|
-
Update Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
-
|
13
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
-
layer entitled Active Record. This layer allows you to present the data from
|
15
|
-
database rows as objects and embellish these data objects with business logic
|
16
|
-
methods. You can read more about Active Record in
|
17
|
-
link:files/vendor/rails/activerecord/README.html.
|
18
|
-
|
19
|
-
The controller and view are handled by the Action Pack, which handles both
|
20
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
-
are bundled in a single package due to their heavy interdependence. This is
|
22
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
-
more separate. Each of these packages can be used independently outside of
|
24
|
-
Rails. You can read more about Action Pack in
|
25
|
-
link:files/vendor/rails/actionpack/README.html.
|
26
|
-
|
27
|
-
|
28
|
-
== Getting Started
|
29
|
-
|
30
|
-
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
31
|
-
and your application name. Ex: rails myapp
|
32
|
-
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
33
|
-
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
34
|
-
4. Follow the guidelines to start developing your application
|
35
|
-
|
36
|
-
|
37
|
-
== Web Servers
|
38
|
-
|
39
|
-
By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
|
40
|
-
Rails will use WEBrick, the webserver that ships with Ruby. When you run script/server,
|
41
|
-
Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
|
42
|
-
that you can always get up and running quickly.
|
43
|
-
|
44
|
-
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
45
|
-
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
46
|
-
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
47
|
-
More info at: http://mongrel.rubyforge.org
|
48
|
-
|
49
|
-
If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
|
50
|
-
Mongrel and WEBrick and also suited for production use, but requires additional
|
51
|
-
installation and currently only works well on OS X/Unix (Windows users are encouraged
|
52
|
-
to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
|
53
|
-
http://www.lighttpd.net.
|
54
|
-
|
55
|
-
And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
|
56
|
-
web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
|
57
|
-
for production.
|
58
|
-
|
59
|
-
But of course its also possible to run Rails on any platform that supports FCGI.
|
60
|
-
Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
|
61
|
-
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
|
62
|
-
|
63
|
-
|
64
|
-
== Apache .htaccess example
|
65
|
-
|
66
|
-
# General Apache options
|
67
|
-
AddHandler fastcgi-script .fcgi
|
68
|
-
AddHandler cgi-script .cgi
|
69
|
-
Options +FollowSymLinks +ExecCGI
|
70
|
-
|
71
|
-
# If you don't want Rails to look in certain directories,
|
72
|
-
# use the following rewrite rules so that Apache won't rewrite certain requests
|
73
|
-
#
|
74
|
-
# Example:
|
75
|
-
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
76
|
-
# RewriteRule .* - [L]
|
77
|
-
|
78
|
-
# Redirect all requests not available on the filesystem to Rails
|
79
|
-
# By default the cgi dispatcher is used which is very slow
|
80
|
-
#
|
81
|
-
# For better performance replace the dispatcher with the fastcgi one
|
82
|
-
#
|
83
|
-
# Example:
|
84
|
-
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
85
|
-
RewriteEngine On
|
86
|
-
|
87
|
-
# If your Rails application is accessed via an Alias directive,
|
88
|
-
# then you MUST also set the RewriteBase in this htaccess file.
|
89
|
-
#
|
90
|
-
# Example:
|
91
|
-
# Alias /myrailsapp /path/to/myrailsapp/public
|
92
|
-
# RewriteBase /myrailsapp
|
93
|
-
|
94
|
-
RewriteRule ^$ index.html [QSA]
|
95
|
-
RewriteRule ^([^.]+)$ $1.html [QSA]
|
96
|
-
RewriteCond %{REQUEST_FILENAME} !-f
|
97
|
-
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
98
|
-
|
99
|
-
# In case Rails experiences terminal errors
|
100
|
-
# Instead of displaying this message you can supply a file here which will be rendered instead
|
101
|
-
#
|
102
|
-
# Example:
|
103
|
-
# ErrorDocument 500 /500.html
|
104
|
-
|
105
|
-
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
106
|
-
|
107
|
-
|
108
|
-
== Debugging Rails
|
109
|
-
|
110
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
111
|
-
will help you debug it and get it back on the rails.
|
112
|
-
|
113
|
-
First area to check is the application log files. Have "tail -f" commands running
|
114
|
-
on the server.log and development.log. Rails will automatically display debugging
|
115
|
-
and runtime information to these files. Debugging info will also be shown in the
|
116
|
-
browser on requests from 127.0.0.1.
|
117
|
-
|
118
|
-
You can also log your own messages directly into the log file from your code using
|
119
|
-
the Ruby logger class from inside your controllers. Example:
|
120
|
-
|
121
|
-
class WeblogController < ActionController::Base
|
122
|
-
def destroy
|
123
|
-
@weblog = Weblog.find(params[:id])
|
124
|
-
@weblog.destroy
|
125
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
The result will be a message in your log file along the lines of:
|
130
|
-
|
131
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
132
|
-
|
133
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
134
|
-
|
135
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
136
|
-
|
137
|
-
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
138
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
139
|
-
|
140
|
-
These two online (and free) books will bring you up to speed on the Ruby language
|
141
|
-
and also on programming in general.
|
142
|
-
|
143
|
-
|
144
|
-
== Debugger
|
145
|
-
|
146
|
-
Debugger support is available through the debugger command when you start your Mongrel or
|
147
|
-
Webrick server with --debugger. This means that you can break out of execution at any point
|
148
|
-
in the code, investigate and change the model, AND then resume execution!
|
149
|
-
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
|
150
|
-
Example:
|
151
|
-
|
152
|
-
class WeblogController < ActionController::Base
|
153
|
-
def index
|
154
|
-
@posts = Post.find(:all)
|
155
|
-
debugger
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
So the controller will accept the action, run the first line, then present you
|
160
|
-
with a IRB prompt in the server window. Here you can do things like:
|
161
|
-
|
162
|
-
>> @posts.inspect
|
163
|
-
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
164
|
-
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
165
|
-
>> @posts.first.title = "hello from a debugger"
|
166
|
-
=> "hello from a debugger"
|
167
|
-
|
168
|
-
...and even better is that you can examine how your runtime objects actually work:
|
169
|
-
|
170
|
-
>> f = @posts.first
|
171
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
172
|
-
>> f.
|
173
|
-
Display all 152 possibilities? (y or n)
|
174
|
-
|
175
|
-
Finally, when you're ready to resume execution, you enter "cont"
|
176
|
-
|
177
|
-
|
178
|
-
== Console
|
179
|
-
|
180
|
-
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
181
|
-
Here you'll have all parts of the application configured, just like it is when the
|
182
|
-
application is running. You can inspect domain models, change values, and save to the
|
183
|
-
database. Starting the script without arguments will launch it in the development environment.
|
184
|
-
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
185
|
-
|
186
|
-
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
187
|
-
|
188
|
-
== dbconsole
|
189
|
-
|
190
|
-
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
|
191
|
-
You would be connected to the database with the credentials defined in database.yml.
|
192
|
-
Starting the script without arguments will connect you to the development database. Passing an
|
193
|
-
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
|
194
|
-
Currently works for mysql, postgresql and sqlite.
|
195
|
-
|
196
|
-
== Description of Contents
|
197
|
-
|
198
|
-
app
|
199
|
-
Holds all the code that's specific to this particular application.
|
200
|
-
|
201
|
-
app/controllers
|
202
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
203
|
-
automated URL mapping. All controllers should descend from ApplicationController
|
204
|
-
which itself descends from ActionController::Base.
|
205
|
-
|
206
|
-
app/models
|
207
|
-
Holds models that should be named like post.rb.
|
208
|
-
Most models will descend from ActiveRecord::Base.
|
209
|
-
|
210
|
-
app/views
|
211
|
-
Holds the template files for the view that should be named like
|
212
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
|
213
|
-
syntax.
|
214
|
-
|
215
|
-
app/views/layouts
|
216
|
-
Holds the template files for layouts to be used with views. This models the common
|
217
|
-
header/footer method of wrapping views. In your views, define a layout using the
|
218
|
-
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
|
219
|
-
call <% yield %> to render the view using this layout.
|
220
|
-
|
221
|
-
app/helpers
|
222
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
223
|
-
for you automatically when using script/generate for controllers. Helpers can be used to
|
224
|
-
wrap functionality for your views into methods.
|
225
|
-
|
226
|
-
config
|
227
|
-
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
228
|
-
|
229
|
-
db
|
230
|
-
Contains the database schema in schema.rb. db/migrate contains all
|
231
|
-
the sequence of Migrations for your schema.
|
232
|
-
|
233
|
-
doc
|
234
|
-
This directory is where your application documentation will be stored when generated
|
235
|
-
using <tt>rake doc:app</tt>
|
236
|
-
|
237
|
-
lib
|
238
|
-
Application specific libraries. Basically, any kind of custom code that doesn't
|
239
|
-
belong under controllers, models, or helpers. This directory is in the load path.
|
240
|
-
|
241
|
-
public
|
242
|
-
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
243
|
-
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
244
|
-
set as the DOCUMENT_ROOT of your web server.
|
245
|
-
|
246
|
-
script
|
247
|
-
Helper scripts for automation and generation.
|
248
|
-
|
249
|
-
test
|
250
|
-
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
251
|
-
test files will be generated for you and placed in this directory.
|
252
|
-
|
253
|
-
vendor
|
254
|
-
External libraries that the application depends on. Also includes the plugins subdirectory.
|
255
|
-
If the app has frozen rails, those gems also go here, under vendor/rails/.
|
256
|
-
This directory is in the load path.
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class Admin::Products2Controller < ApplicationController
|
2
|
-
layout 'admin'
|
3
|
-
|
4
|
-
admin_assistant_for Product do |a|
|
5
|
-
a.index do |index|
|
6
|
-
index.columns :id, :name, :price, :product_category
|
7
|
-
index[:product_category].sort_by = 'category_name'
|
8
|
-
index.search do |search|
|
9
|
-
search.columns :name, :price
|
10
|
-
search[:price].compare_to_range = true
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class Admin::ProductsController < ApplicationController
|
2
|
-
layout 'admin'
|
3
|
-
|
4
|
-
admin_assistant_for Product do |a|
|
5
|
-
a.actions :index, :create, :update, :destroy
|
6
|
-
|
7
|
-
a.destroy do |product|
|
8
|
-
product.update_attribute :deleted_at, Time.now.utc
|
9
|
-
end
|
10
|
-
|
11
|
-
a.form do |form|
|
12
|
-
form.columns :name, :price, :file_column_image, :percent_off,
|
13
|
-
:sale_starts_at, :sale_ends_at
|
14
|
-
form[:file_column_image].image_size = '100x100'
|
15
|
-
form[:sale_starts_at].clear_link = 'Not on sale'
|
16
|
-
form[:sale_ends_at].clear_link = "Sale doesn't end"
|
17
|
-
end
|
18
|
-
|
19
|
-
a.index do |index|
|
20
|
-
index.columns :id, :name, :price, :file_column_image, :product_category
|
21
|
-
index.conditions 'deleted_at is null'
|
22
|
-
index.search :name, :price
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
protected
|
27
|
-
|
28
|
-
def price_from_form(price)
|
29
|
-
(price[:dollars].to_i * 100) + price[:cents].to_i
|
30
|
-
end
|
31
|
-
end
|