admin_assistant 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION +1 -1
  3. data/admin_assistant.gemspec +404 -8
  4. data/rails_2_test/README +256 -0
  5. data/rails_2_test/Rakefile +13 -0
  6. data/rails_2_test/app/controllers/admin/appointments2_controller.rb +15 -0
  7. data/rails_2_test/app/controllers/admin/appointments_controller.rb +11 -0
  8. data/rails_2_test/app/controllers/admin/blog_posts2_controller.rb +138 -0
  9. data/rails_2_test/app/controllers/admin/blog_posts3_controller.rb +76 -0
  10. data/rails_2_test/app/controllers/admin/blog_posts4_controller.rb +21 -0
  11. data/rails_2_test/app/controllers/admin/blog_posts5_controller.rb +27 -0
  12. data/rails_2_test/app/controllers/admin/blog_posts6_controller.rb +10 -0
  13. data/rails_2_test/app/controllers/admin/blog_posts_controller.rb +8 -0
  14. data/rails_2_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +15 -0
  15. data/rails_2_test/app/controllers/admin/blog_posts_read_only_controller.rb +19 -0
  16. data/rails_2_test/app/controllers/admin/bookmarks_controller.rb +11 -0
  17. data/rails_2_test/app/controllers/admin/comments2_controller.rb +14 -0
  18. data/rails_2_test/app/controllers/admin/comments_controller.rb +12 -0
  19. data/rails_2_test/app/controllers/admin/file_column_images2_controller.rb +10 -0
  20. data/rails_2_test/app/controllers/admin/file_column_images_controller.rb +6 -0
  21. data/rails_2_test/app/controllers/admin/images2_controller.rb +11 -0
  22. data/rails_2_test/app/controllers/admin/images_controller.rb +6 -0
  23. data/rails_2_test/app/controllers/admin/misconfigured1_controller.rb +7 -0
  24. data/rails_2_test/app/controllers/admin/not_migrated_yets_controller.rb +9 -0
  25. data/rails_2_test/app/controllers/admin/product_categories2_controller.rb +7 -0
  26. data/rails_2_test/app/controllers/admin/product_categories_controller.rb +5 -0
  27. data/rails_2_test/app/controllers/admin/products2_controller.rb +15 -0
  28. data/rails_2_test/app/controllers/admin/products_controller.rb +31 -0
  29. data/rails_2_test/app/controllers/admin/television_airings_controller.rb +5 -0
  30. data/rails_2_test/app/controllers/admin/television_time_slots_controller.rb +5 -0
  31. data/rails_2_test/app/controllers/admin/users2_controller.rb +10 -0
  32. data/rails_2_test/app/controllers/admin/users_controller.rb +63 -0
  33. data/rails_2_test/app/controllers/application.rb +16 -0
  34. data/rails_2_test/app/controllers/application_controller.rb +16 -0
  35. data/rails_2_test/app/controllers/blog_posts_controller.rb +5 -0
  36. data/rails_2_test/app/helpers/admin/appointments2_helper.rb +2 -0
  37. data/rails_2_test/app/helpers/admin/appointments_helper.rb +2 -0
  38. data/rails_2_test/app/helpers/admin/blog_posts2_helper.rb +27 -0
  39. data/rails_2_test/app/helpers/admin/blog_posts3_helper.rb +2 -0
  40. data/rails_2_test/app/helpers/admin/blog_posts4_helper.rb +2 -0
  41. data/rails_2_test/app/helpers/admin/blog_posts6_helper.rb +16 -0
  42. data/rails_2_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +29 -0
  43. data/rails_2_test/app/helpers/admin/blog_posts_helper.rb +2 -0
  44. data/rails_2_test/app/helpers/admin/blog_posts_read_only_helper.rb +2 -0
  45. data/rails_2_test/app/helpers/admin/bookmarks_helper.rb +2 -0
  46. data/rails_2_test/app/helpers/admin/comments2_helper.rb +2 -0
  47. data/rails_2_test/app/helpers/admin/comments_helper.rb +2 -0
  48. data/rails_2_test/app/helpers/admin/file_column_images2_helper.rb +2 -0
  49. data/rails_2_test/app/helpers/admin/file_column_images_helper.rb +2 -0
  50. data/rails_2_test/app/helpers/admin/images2_helper.rb +8 -0
  51. data/rails_2_test/app/helpers/admin/images_helper.rb +2 -0
  52. data/rails_2_test/app/helpers/admin/misconfigured1_helper.rb +2 -0
  53. data/rails_2_test/app/helpers/admin/not_migrated_yets_helper.rb +2 -0
  54. data/rails_2_test/app/helpers/admin/product_categories2_helper.rb +2 -0
  55. data/rails_2_test/app/helpers/admin/product_categories_helper.rb +2 -0
  56. data/rails_2_test/app/helpers/admin/products2_helper.rb +3 -0
  57. data/rails_2_test/app/helpers/admin/products_helper.rb +6 -0
  58. data/rails_2_test/app/helpers/admin/television_airings_helper.rb +2 -0
  59. data/rails_2_test/app/helpers/admin/television_time_slots_helper.rb +2 -0
  60. data/rails_2_test/app/helpers/admin/users2_helper.rb +2 -0
  61. data/rails_2_test/app/helpers/admin/users_helper.rb +25 -0
  62. data/rails_2_test/app/helpers/application_helper.rb +3 -0
  63. data/rails_2_test/app/helpers/blog_posts_helper.rb +2 -0
  64. data/rails_2_test/app/models/appointment.rb +5 -0
  65. data/rails_2_test/app/models/blog_post.rb +14 -0
  66. data/rails_2_test/app/models/blog_post_tag.rb +6 -0
  67. data/rails_2_test/app/models/bookmark.rb +6 -0
  68. data/rails_2_test/app/models/comment.rb +4 -0
  69. data/rails_2_test/app/models/file_column_image.rb +3 -0
  70. data/rails_2_test/app/models/image.rb +3 -0
  71. data/rails_2_test/app/models/not_migrated_yet.rb +2 -0
  72. data/rails_2_test/app/models/product.rb +7 -0
  73. data/rails_2_test/app/models/product_category.rb +9 -0
  74. data/rails_2_test/app/models/tag.rb +4 -0
  75. data/rails_2_test/app/models/television_airing.rb +3 -0
  76. data/rails_2_test/app/models/television_time_slot.rb +11 -0
  77. data/rails_2_test/app/models/user.rb +14 -0
  78. data/rails_2_test/app/views/admin/appointments/_subject_input.html.erb +2 -0
  79. data/rails_2_test/app/views/admin/appointments2/_time_input.html.erb +31 -0
  80. data/rails_2_test/app/views/admin/blog_posts2/_after_form.html.erb +5 -0
  81. data/rails_2_test/app/views/admin/blog_posts2/_after_index.html.erb +1 -0
  82. data/rails_2_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +16 -0
  83. data/rails_2_test/app/views/admin/blog_posts2/_before_index.html.erb +2 -0
  84. data/rails_2_test/app/views/admin/blog_posts5/_after_index_header.html.erb +8 -0
  85. data/rails_2_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +1 -0
  86. data/rails_2_test/app/views/admin/products/_name_input.html.erb +2 -0
  87. data/rails_2_test/app/views/admin/products/_percent_off_input.html.erb +2 -0
  88. data/rails_2_test/app/views/admin/products/_price_input.html.erb +10 -0
  89. data/rails_2_test/app/views/blog_posts/show.html.erb +13 -0
  90. data/rails_2_test/app/views/layouts/admin.html.erb +31 -0
  91. data/rails_2_test/config/boot.rb +109 -0
  92. data/rails_2_test/config/database.yml +28 -0
  93. data/rails_2_test/config/environment.rb +78 -0
  94. data/rails_2_test/config/environments/development.rb +17 -0
  95. data/rails_2_test/config/environments/production.rb +24 -0
  96. data/rails_2_test/config/environments/test.rb +24 -0
  97. data/rails_2_test/config/initializers/inflections.rb +10 -0
  98. data/rails_2_test/config/initializers/mime_types.rb +5 -0
  99. data/rails_2_test/config/initializers/new_rails_defaults.rb +17 -0
  100. data/rails_2_test/config/locales/en.yml +5 -0
  101. data/rails_2_test/config/routes.rb +43 -0
  102. data/rails_2_test/db/migrate/20090213215514_create_blog_posts.rb +12 -0
  103. data/rails_2_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +9 -0
  104. data/rails_2_test/db/migrate/20090221220917_create_tags.rb +13 -0
  105. data/rails_2_test/db/migrate/20090221220947_create_blog_post_tags.rb +14 -0
  106. data/rails_2_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +9 -0
  107. data/rails_2_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +9 -0
  108. data/rails_2_test/db/migrate/20090301191722_create_images.rb +16 -0
  109. data/rails_2_test/db/migrate/20090305165345_create_accounts.rb +14 -0
  110. data/rails_2_test/db/migrate/20090307225027_rename_accounts_to_users.rb +9 -0
  111. data/rails_2_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +9 -0
  112. data/rails_2_test/db/migrate/20090309185114_change_blog_posts_textile.rb +9 -0
  113. data/rails_2_test/db/migrate/20090309193635_create_products.rb +14 -0
  114. data/rails_2_test/db/migrate/20090309203056_create_comments.rb +15 -0
  115. data/rails_2_test/db/migrate/20090323005947_create_file_column_images.rb +12 -0
  116. data/rails_2_test/db/migrate/20090326160049_add_birthday_to_users.rb +9 -0
  117. data/rails_2_test/db/migrate/20090326223606_add_state_to_users.rb +9 -0
  118. data/rails_2_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +9 -0
  119. data/rails_2_test/db/migrate/20090617173651_create_bookmarks.rb +15 -0
  120. data/rails_2_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +9 -0
  121. data/rails_2_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +11 -0
  122. data/rails_2_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +9 -0
  123. data/rails_2_test/db/migrate/20090701171857_add_force_textile_to_users.rb +9 -0
  124. data/rails_2_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +9 -0
  125. data/rails_2_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +13 -0
  126. data/rails_2_test/db/migrate/20090714024501_create_product_categories.rb +15 -0
  127. data/rails_2_test/db/migrate/20090819162835_add_admin_level_to_users.rb +9 -0
  128. data/rails_2_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +11 -0
  129. data/rails_2_test/db/migrate/20091221011256_add_position_to_product_categories.rb +9 -0
  130. data/rails_2_test/db/migrate/20091222160814_create_appointments.rb +14 -0
  131. data/rails_2_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +9 -0
  132. data/rails_2_test/db/migrate/20100214213359_create_television_time_slots.rb +13 -0
  133. data/rails_2_test/db/migrate/20100214213451_create_television_airings.rb +15 -0
  134. data/rails_2_test/doc/README_FOR_APP +5 -0
  135. data/rails_2_test/lib/tasks/rspec.rake +163 -0
  136. data/rails_2_test/public/404.html +30 -0
  137. data/rails_2_test/public/422.html +30 -0
  138. data/rails_2_test/public/500.html +33 -0
  139. data/rails_2_test/public/dispatch.cgi +10 -0
  140. data/rails_2_test/public/dispatch.fcgi +24 -0
  141. data/rails_2_test/public/dispatch.rb +10 -0
  142. data/rails_2_test/public/favicon.ico +0 -0
  143. data/rails_2_test/public/images/rails.png +0 -0
  144. data/rails_2_test/public/index.html +274 -0
  145. data/rails_2_test/public/javascripts/application.js +2 -0
  146. data/rails_2_test/public/javascripts/jquery-1.4.4.min.js +167 -0
  147. data/rails_2_test/public/robots.txt +5 -0
  148. data/rails_2_test/public/stylesheets/admin.css +3 -0
  149. data/rails_2_test/public/stylesheets/scaffold.css +54 -0
  150. data/rails_2_test/script/about +4 -0
  151. data/rails_2_test/script/autospec +5 -0
  152. data/rails_2_test/script/console +3 -0
  153. data/rails_2_test/script/dbconsole +3 -0
  154. data/rails_2_test/script/destroy +3 -0
  155. data/rails_2_test/script/generate +3 -0
  156. data/rails_2_test/script/performance/benchmarker +3 -0
  157. data/rails_2_test/script/performance/profiler +3 -0
  158. data/rails_2_test/script/performance/request +3 -0
  159. data/rails_2_test/script/plugin +3 -0
  160. data/rails_2_test/script/populate_tables.rb +49 -0
  161. data/rails_2_test/script/process/inspector +3 -0
  162. data/rails_2_test/script/process/reaper +3 -0
  163. data/rails_2_test/script/process/spawner +3 -0
  164. data/rails_2_test/script/runner +3 -0
  165. data/rails_2_test/script/server +3 -0
  166. data/rails_2_test/script/spec +5 -0
  167. data/rails_2_test/script/spec_server +125 -0
  168. data/rails_2_test/test/data/ruby_throated.jpg +0 -0
  169. data/rails_2_test/test/data/tweenbot.jpg +0 -0
  170. data/rails_2_test/test/fixtures/file_column_images.yml +7 -0
  171. data/rails_2_test/test/integration/admin/appointments2_integration_test.rb +79 -0
  172. data/rails_2_test/test/integration/admin/appointments_integration_test.rb +367 -0
  173. data/rails_2_test/test/integration/admin/blog_posts2_integration_test.rb +806 -0
  174. data/rails_2_test/test/integration/admin/blog_posts3_integration_test.rb +418 -0
  175. data/rails_2_test/test/integration/admin/blog_posts4_integration_test.rb +189 -0
  176. data/rails_2_test/test/integration/admin/blog_posts5_integration_test.rb +75 -0
  177. data/rails_2_test/test/integration/admin/blog_posts6_integration_test.rb +39 -0
  178. data/rails_2_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +89 -0
  179. data/rails_2_test/test/integration/admin/blog_posts_integration_test.rb +788 -0
  180. data/rails_2_test/test/integration/admin/blog_posts_read_only_integration_test.rb +69 -0
  181. data/rails_2_test/test/integration/admin/bookmarks_integration_test.rb +445 -0
  182. data/rails_2_test/test/integration/admin/comments2_integration_test.rb +52 -0
  183. data/rails_2_test/test/integration/admin/comments_integration_test.rb +50 -0
  184. data/rails_2_test/test/integration/admin/file_column_images2_integration_test.rb +19 -0
  185. data/rails_2_test/test/integration/admin/file_column_images_integration_test.rb +69 -0
  186. data/rails_2_test/test/integration/admin/images2_integration_test.rb +33 -0
  187. data/rails_2_test/test/integration/admin/images_integration_test.rb +79 -0
  188. data/rails_2_test/test/integration/admin/misconfigured1_integration_test.rb +17 -0
  189. data/rails_2_test/test/integration/admin/product_categories2_integration_test.rb +179 -0
  190. data/rails_2_test/test/integration/admin/product_categories_integration_test.rb +12 -0
  191. data/rails_2_test/test/integration/admin/products2_integration_test.rb +155 -0
  192. data/rails_2_test/test/integration/admin/products_integration_test.rb +210 -0
  193. data/rails_2_test/test/integration/admin/television_airings_integration_test.rb +25 -0
  194. data/rails_2_test/test/integration/admin/users2_integration_test.rb +48 -0
  195. data/rails_2_test/test/integration/admin/users_integration_test.rb +266 -0
  196. data/rails_2_test/test/integration/blog_posts_integration_test.rb +9 -0
  197. data/rails_2_test/test/test_helper.rb +114 -0
  198. data/rails_2_test/vendor/plugins/file_column/CHANGELOG +69 -0
  199. data/rails_2_test/vendor/plugins/file_column/README +54 -0
  200. data/rails_2_test/vendor/plugins/file_column/Rakefile +36 -0
  201. data/rails_2_test/vendor/plugins/file_column/TODO +6 -0
  202. data/rails_2_test/vendor/plugins/file_column/init.rb +13 -0
  203. data/rails_2_test/vendor/plugins/file_column/lib/file_column.rb +723 -0
  204. data/rails_2_test/vendor/plugins/file_column/lib/file_column_helper.rb +150 -0
  205. data/rails_2_test/vendor/plugins/file_column/lib/file_compat.rb +28 -0
  206. data/rails_2_test/vendor/plugins/file_column/lib/magick_file_column.rb +260 -0
  207. data/rails_2_test/vendor/plugins/file_column/lib/rails_file_column.rb +19 -0
  208. data/rails_2_test/vendor/plugins/file_column/lib/test_case.rb +124 -0
  209. data/rails_2_test/vendor/plugins/file_column/lib/validations.rb +112 -0
  210. data/rails_2_test/vendor/plugins/file_column/test/abstract_unit.rb +63 -0
  211. data/rails_2_test/vendor/plugins/file_column/test/connection.rb +17 -0
  212. data/rails_2_test/vendor/plugins/file_column/test/file_column_helper_test.rb +97 -0
  213. data/rails_2_test/vendor/plugins/file_column/test/file_column_test.rb +650 -0
  214. data/rails_2_test/vendor/plugins/file_column/test/fixtures/entry.rb +32 -0
  215. data/rails_2_test/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +1 -0
  216. data/rails_2_test/vendor/plugins/file_column/test/fixtures/kerb.jpg +0 -0
  217. data/rails_2_test/vendor/plugins/file_column/test/fixtures/mysql.sql +25 -0
  218. data/rails_2_test/vendor/plugins/file_column/test/fixtures/schema.rb +10 -0
  219. data/rails_2_test/vendor/plugins/file_column/test/fixtures/skanthak.png +0 -0
  220. data/rails_2_test/vendor/plugins/file_column/test/magick_test.rb +380 -0
  221. data/rails_2_test/vendor/plugins/file_column/test/magick_view_only_test.rb +21 -0
  222. data/rails_3_test/.gitignore +4 -0
  223. data/rails_3_test/Gemfile +12 -0
  224. data/rails_3_test/Gemfile.lock +100 -0
  225. data/rails_3_test/README +256 -0
  226. data/rails_3_test/Rakefile +7 -0
  227. data/rails_3_test/app/controllers/admin/appointments2_controller.rb +15 -0
  228. data/rails_3_test/app/controllers/admin/appointments_controller.rb +11 -0
  229. data/rails_3_test/app/controllers/admin/blog_posts2_controller.rb +138 -0
  230. data/rails_3_test/app/controllers/admin/blog_posts3_controller.rb +76 -0
  231. data/rails_3_test/app/controllers/admin/blog_posts4_controller.rb +21 -0
  232. data/rails_3_test/app/controllers/admin/blog_posts5_controller.rb +27 -0
  233. data/rails_3_test/app/controllers/admin/blog_posts6_controller.rb +10 -0
  234. data/rails_3_test/app/controllers/admin/blog_posts_controller.rb +9 -0
  235. data/rails_3_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +15 -0
  236. data/rails_3_test/app/controllers/admin/blog_posts_read_only_controller.rb +19 -0
  237. data/rails_3_test/app/controllers/admin/bookmarks_controller.rb +11 -0
  238. data/rails_3_test/app/controllers/admin/comments2_controller.rb +14 -0
  239. data/rails_3_test/app/controllers/admin/comments_controller.rb +12 -0
  240. data/rails_3_test/app/controllers/admin/images2_controller.rb +11 -0
  241. data/rails_3_test/app/controllers/admin/images_controller.rb +6 -0
  242. data/rails_3_test/app/controllers/admin/misconfigured1_controller.rb +7 -0
  243. data/rails_3_test/app/controllers/admin/not_migrated_yets_controller.rb +9 -0
  244. data/rails_3_test/app/controllers/admin/product_categories2_controller.rb +7 -0
  245. data/rails_3_test/app/controllers/admin/product_categories_controller.rb +5 -0
  246. data/rails_3_test/app/controllers/admin/television_airings_controller.rb +5 -0
  247. data/rails_3_test/app/controllers/admin/television_time_slots_controller.rb +5 -0
  248. data/rails_3_test/app/controllers/admin/users2_controller.rb +10 -0
  249. data/rails_3_test/app/controllers/admin/users_controller.rb +48 -0
  250. data/rails_3_test/app/controllers/application_controller.rb +7 -0
  251. data/rails_3_test/app/controllers/blog_posts_controller.rb +5 -0
  252. data/rails_3_test/app/helpers/admin/appointments_helper.rb +2 -0
  253. data/rails_3_test/app/helpers/admin/blog_posts2_helper.rb +27 -0
  254. data/rails_3_test/app/helpers/admin/blog_posts3_helper.rb +2 -0
  255. data/rails_3_test/app/helpers/admin/blog_posts4_helper.rb +2 -0
  256. data/rails_3_test/app/helpers/admin/blog_posts6_helper.rb +13 -0
  257. data/rails_3_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +29 -0
  258. data/rails_3_test/app/helpers/admin/blog_posts_helper.rb +2 -0
  259. data/rails_3_test/app/helpers/admin/blog_posts_read_only_helper.rb +2 -0
  260. data/rails_3_test/app/helpers/admin/bookmarks_helper.rb +2 -0
  261. data/rails_3_test/app/helpers/admin/comments2_helper.rb +2 -0
  262. data/rails_3_test/app/helpers/admin/comments_helper.rb +2 -0
  263. data/rails_3_test/app/helpers/admin/images2_helper.rb +8 -0
  264. data/rails_3_test/app/helpers/admin/images_helper.rb +2 -0
  265. data/rails_3_test/app/helpers/admin/misconfigured1_helper.rb +2 -0
  266. data/rails_3_test/app/helpers/admin/not_migrated_yets_helper.rb +2 -0
  267. data/rails_3_test/app/helpers/admin/product_categories2_helper.rb +2 -0
  268. data/rails_3_test/app/helpers/admin/product_categories_helper.rb +2 -0
  269. data/rails_3_test/app/helpers/admin/television_airings_helper.rb +2 -0
  270. data/rails_3_test/app/helpers/admin/television_time_slots_helper.rb +2 -0
  271. data/rails_3_test/app/helpers/admin/users2_helper.rb +2 -0
  272. data/rails_3_test/app/helpers/admin/users_helper.rb +13 -0
  273. data/rails_3_test/app/helpers/application_helper.rb +2 -0
  274. data/rails_3_test/app/models/appointment.rb +5 -0
  275. data/rails_3_test/app/models/blog_post.rb +14 -0
  276. data/rails_3_test/app/models/blog_post_tag.rb +6 -0
  277. data/rails_3_test/app/models/bookmark.rb +6 -0
  278. data/rails_3_test/app/models/comment.rb +4 -0
  279. data/rails_3_test/app/models/image.rb +3 -0
  280. data/rails_3_test/app/models/not_migrated_yet.rb +2 -0
  281. data/rails_3_test/app/models/product.rb +5 -0
  282. data/rails_3_test/app/models/product_category.rb +9 -0
  283. data/rails_3_test/app/models/tag.rb +4 -0
  284. data/rails_3_test/app/models/television_airing.rb +3 -0
  285. data/rails_3_test/app/models/television_time_slot.rb +11 -0
  286. data/rails_3_test/app/models/user.rb +11 -0
  287. data/rails_3_test/app/views/admin/appointments/_subject_input.html.erb +2 -0
  288. data/rails_3_test/app/views/admin/appointments2/_time_input.html.erb +31 -0
  289. data/rails_3_test/app/views/admin/blog_posts2/_after_form.html.erb +5 -0
  290. data/rails_3_test/app/views/admin/blog_posts2/_after_index.html.erb +1 -0
  291. data/rails_3_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +16 -0
  292. data/rails_3_test/app/views/admin/blog_posts2/_before_index.html.erb +2 -0
  293. data/rails_3_test/app/views/admin/blog_posts5/_after_index_header.html.erb +8 -0
  294. data/rails_3_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +1 -0
  295. data/rails_3_test/app/views/layouts/admin.html.erb +32 -0
  296. data/rails_3_test/app/views/layouts/application.html.erb +14 -0
  297. data/rails_3_test/config/application.rb +42 -0
  298. data/rails_3_test/config/boot.rb +6 -0
  299. data/rails_3_test/config/database.yml +22 -0
  300. data/rails_3_test/config/environment.rb +5 -0
  301. data/rails_3_test/config/environments/development.rb +26 -0
  302. data/rails_3_test/config/environments/production.rb +49 -0
  303. data/rails_3_test/config/environments/test.rb +35 -0
  304. data/rails_3_test/config/initializers/backtrace_silencers.rb +7 -0
  305. data/rails_3_test/config/initializers/inflections.rb +10 -0
  306. data/rails_3_test/config/initializers/mime_types.rb +5 -0
  307. data/rails_3_test/config/initializers/secret_token.rb +7 -0
  308. data/rails_3_test/config/initializers/session_store.rb +8 -0
  309. data/rails_3_test/config/locales/en.yml +5 -0
  310. data/rails_3_test/config/routes.rb +63 -0
  311. data/rails_3_test/config.ru +4 -0
  312. data/rails_3_test/db/migrate/20090213215514_create_blog_posts.rb +12 -0
  313. data/rails_3_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +9 -0
  314. data/rails_3_test/db/migrate/20090221220917_create_tags.rb +13 -0
  315. data/rails_3_test/db/migrate/20090221220947_create_blog_post_tags.rb +14 -0
  316. data/rails_3_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +9 -0
  317. data/rails_3_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +9 -0
  318. data/rails_3_test/db/migrate/20090301191722_create_images.rb +16 -0
  319. data/rails_3_test/db/migrate/20090305165345_create_accounts.rb +14 -0
  320. data/rails_3_test/db/migrate/20090307225027_rename_accounts_to_users.rb +9 -0
  321. data/rails_3_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +9 -0
  322. data/rails_3_test/db/migrate/20090309185114_change_blog_posts_textile.rb +9 -0
  323. data/rails_3_test/db/migrate/20090309193635_create_products.rb +14 -0
  324. data/rails_3_test/db/migrate/20090309203056_create_comments.rb +15 -0
  325. data/rails_3_test/db/migrate/20090323005947_create_file_column_images.rb +12 -0
  326. data/rails_3_test/db/migrate/20090326160049_add_birthday_to_users.rb +9 -0
  327. data/rails_3_test/db/migrate/20090326223606_add_state_to_users.rb +9 -0
  328. data/rails_3_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +9 -0
  329. data/rails_3_test/db/migrate/20090617173651_create_bookmarks.rb +15 -0
  330. data/rails_3_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +9 -0
  331. data/rails_3_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +11 -0
  332. data/rails_3_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +9 -0
  333. data/rails_3_test/db/migrate/20090701171857_add_force_textile_to_users.rb +9 -0
  334. data/rails_3_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +9 -0
  335. data/rails_3_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +13 -0
  336. data/rails_3_test/db/migrate/20090714024501_create_product_categories.rb +15 -0
  337. data/rails_3_test/db/migrate/20090819162835_add_admin_level_to_users.rb +9 -0
  338. data/rails_3_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +11 -0
  339. data/rails_3_test/db/migrate/20091221011256_add_position_to_product_categories.rb +9 -0
  340. data/rails_3_test/db/migrate/20091222160814_create_appointments.rb +14 -0
  341. data/rails_3_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +9 -0
  342. data/rails_3_test/db/migrate/20100214213359_create_television_time_slots.rb +13 -0
  343. data/rails_3_test/db/migrate/20100214213451_create_television_airings.rb +15 -0
  344. data/rails_3_test/db/migrate/20110426215702_remove_avatar_fields_from_users.rb +11 -0
  345. data/rails_3_test/db/seeds.rb +7 -0
  346. data/rails_3_test/doc/README_FOR_APP +2 -0
  347. data/rails_3_test/lib/tasks/.gitkeep +0 -0
  348. data/rails_3_test/public/404.html +26 -0
  349. data/rails_3_test/public/422.html +26 -0
  350. data/rails_3_test/public/500.html +26 -0
  351. data/rails_3_test/public/favicon.ico +0 -0
  352. data/rails_3_test/public/images/rails.png +0 -0
  353. data/rails_3_test/public/index.html +239 -0
  354. data/rails_3_test/public/javascripts/application.js +2 -0
  355. data/rails_3_test/public/javascripts/jquery-1.4.4.min.js +167 -0
  356. data/rails_3_test/public/javascripts/rails.js +191 -0
  357. data/rails_3_test/public/robots.txt +5 -0
  358. data/rails_3_test/public/stylesheets/.gitkeep +0 -0
  359. data/rails_3_test/public/stylesheets/admin.css +3 -0
  360. data/rails_3_test/public/stylesheets/scaffold.css +54 -0
  361. data/rails_3_test/script/rails +6 -0
  362. data/rails_3_test/test/data/ruby_throated.jpg +0 -0
  363. data/rails_3_test/test/data/tweenbot.jpg +0 -0
  364. data/rails_3_test/test/fixtures/placeholder.txt +0 -0
  365. data/rails_3_test/test/integration/admin/appointments2_integration_test.rb +79 -0
  366. data/rails_3_test/test/integration/admin/appointments_integration_test.rb +367 -0
  367. data/rails_3_test/test/integration/admin/blog_posts2_integration_test.rb +789 -0
  368. data/rails_3_test/test/integration/admin/blog_posts3_integration_test.rb +418 -0
  369. data/rails_3_test/test/integration/admin/blog_posts4_integration_test.rb +189 -0
  370. data/rails_3_test/test/integration/admin/blog_posts5_integration_test.rb +75 -0
  371. data/rails_3_test/test/integration/admin/blog_posts6_integration_test.rb +39 -0
  372. data/rails_3_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +89 -0
  373. data/rails_3_test/test/integration/admin/blog_posts_integration_test.rb +784 -0
  374. data/rails_3_test/test/integration/admin/blog_posts_read_only_integration_test.rb +69 -0
  375. data/rails_3_test/test/integration/admin/bookmarks_integration_test.rb +445 -0
  376. data/rails_3_test/test/integration/admin/comments2_integration_test.rb +52 -0
  377. data/rails_3_test/test/integration/admin/comments_integration_test.rb +50 -0
  378. data/rails_3_test/test/integration/admin/images2_integration_test.rb +33 -0
  379. data/rails_3_test/test/integration/admin/images_integration_test.rb +79 -0
  380. data/rails_3_test/test/integration/admin/misconfigured1_integration_test.rb +21 -0
  381. data/rails_3_test/test/integration/admin/product_categories2_integration_test.rb +179 -0
  382. data/rails_3_test/test/integration/admin/product_categories_integration_test.rb +12 -0
  383. data/rails_3_test/test/integration/admin/television_airings_integration_test.rb +25 -0
  384. data/rails_3_test/test/integration/admin/users2_integration_test.rb +48 -0
  385. data/rails_3_test/test/integration/admin/users_integration_test.rb +182 -0
  386. data/rails_3_test/test/integration/blog_posts_integration_test.rb +10 -0
  387. data/rails_3_test/test/performance/browsing_test.rb +9 -0
  388. data/rails_3_test/test/test_helper.rb +98 -0
  389. data/rails_3_test/vendor/plugins/.gitkeep +0 -0
  390. data/website/_layouts/api.html +20 -17
  391. data/website/_layouts/api1.html +42 -0
  392. data/website/_layouts/default.html +42 -18
  393. data/website/api/core.markdown +6 -3
  394. data/website/api/destroy.markdown +4 -2
  395. data/website/api/form.markdown +6 -5
  396. data/website/api/idx.markdown +8 -7
  397. data/website/api/index.markdown +9 -7
  398. data/website/api/search.markdown +5 -3
  399. data/website/api/show.markdown +4 -2
  400. data/website/community.markdown +3 -2
  401. data/website/css/main.css +83 -17
  402. data/website/design_principles.markdown +3 -8
  403. data/website/index.markdown +13 -9
  404. data/website/js/lightbox.js +2 -2
  405. data/website/quick_start.markdown +10 -10
  406. data/website/screenshots.markdown +11 -11
  407. data/website/tutorial.markdown +23 -14
  408. data/website/v1/api/core.markdown +108 -0
  409. data/website/v1/api/destroy.markdown +27 -0
  410. data/website/v1/api/form.markdown +293 -0
  411. data/website/v1/api/idx.markdown +288 -0
  412. data/website/v1/api/index.markdown +149 -0
  413. data/website/v1/api/search.markdown +110 -0
  414. data/website/v1/api/show.markdown +24 -0
  415. data/website/v1/index.markdown +10 -0
  416. data/website/v1/quick_start.markdown +48 -0
  417. data/website/v1/tutorial.markdown +60 -0
  418. metadata +407 -9
@@ -3,25 +3,25 @@ layout: default
3
3
  title: Quick start
4
4
  ---
5
5
 
6
- *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 [tutorial](./tutorial.html).*
6
+ <div class="note">
7
+ This document assumes you are highly familiar with Ruby and Rails; if you are a beginning Rails user you might want to start with our <a href="/admin_assistant/tutorial.html">tutorial</a>.
8
+ </div>
7
9
 
8
- 1) First, install the plugin from Github.
10
+ 1) Add the gem to your Gemfile, and install it with `bundle install`.
9
11
 
10
- ./script/plugin install git://github.com/fhwang/admin_assistant.git
12
+ gem 'admin_assistant'
11
13
 
12
- 2) If you don't have the popular will\_paginate gem, you'll need that too. See [http://wiki.github.com/mislav/will_paginate/installation](http://wiki.github.com/mislav/will_paginate/installation) for more info.
13
-
14
- 3) admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include prototype.js, effects.js, and controls.js, if you're not including them already.
14
+ 2) admin\_assistant comes packaged with standard CSS and Javascript that you should include in whatever layout your admin controllers will be using. You'll also need to make sure to include jquery, if you're not including it already.
15
15
 
16
16
  <html>
17
17
  <head>
18
- <%= javascript_include_tag("prototype", "effects", "controls") %>
18
+ <%= javascript_include_tag("jquery-1.6.2.min") %>
19
19
  <%= admin_assistant_includes %>
20
20
  </head>
21
21
  ...
22
22
  </html>
23
23
 
24
- 4) Setup an admin controller by attaching it to a model and using the admin layout:
24
+ 3) Setup an admin controller by attaching it to a model and using the admin layout:
25
25
 
26
26
  class Admin::BlogPostsController < ApplicationController
27
27
  layout 'admin'
@@ -31,7 +31,7 @@ title: Quick start
31
31
 
32
32
  That's it for the basic version. You should now be able to go to /admin/blog\_posts in your app and search, paginate, create, and edit blog posts.
33
33
 
34
- ![index](./img/blog_posts-index.png)
34
+ ![index](/admin_assistant/img/blog_posts-index.png)
35
35
 
36
36
  Depending on the model you're using, you might notice a few things:
37
37
 
@@ -40,5 +40,5 @@ Depending on the model you're using, you might notice a few things:
40
40
  * There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
41
41
  * If you have more than 10 pages of a given model, the pagination at the bottom includes a jump form to let you automatically jump to a page you enter.
42
42
 
43
- For more, check out the [API reference](./api/).
43
+ For more, check out the [API reference](/admin_assistant/api/).
44
44
 
@@ -3,25 +3,25 @@ layout: default
3
3
  title: Screenshots
4
4
  ---
5
5
 
6
- <a href="./img/screen1.png" rel="lightbox[screens]" class="thumb" title="With a few lines of code, admin_assistant gives you a lot of default functionality for one model, including an index view with pagination and sorting, search, creating, and editing."><img src="./img/screen1-thumb.png"></a>
6
+ <a href="/admin_assistant/img/screen1.png" rel="lightbox[screens]" class="thumb" title="With a few lines of code, admin_assistant gives you a lot of default functionality for one model, including an index view with pagination and sorting, search, creating, and editing."><img src="/admin_assistant/img/screen1-thumb.png"></a>
7
7
 
8
- <a href="./img/screen2.png" rel="lightbox[screens]" class="thumb" title="Sorting is built-in, and done in the URL for easy bookmarking, etc."><img src="./img/screen2-thumb.png"></a>
8
+ <a href="/admin_assistant/img/screen2.png" rel="lightbox[screens]" class="thumb" title="Sorting is built-in, and done in the URL for easy bookmarking, etc."><img src="/admin_assistant/img/screen2-thumb.png"></a>
9
9
 
10
- <a href="./img/screen3.png" rel="lightbox[screens]" class="thumb" title="If there are many results, the pagination section will include a form for jumping to a specific page quickly."><img src="./img/screen3-thumb.png"></a>
10
+ <a href="/admin_assistant/img/screen3.png" rel="lightbox[screens]" class="thumb" title="If there are many results, the pagination section will include a form for jumping to a specific page quickly."><img src="/admin_assistant/img/screen3-thumb.png"></a>
11
11
 
12
- <a href="./img/screen4.png" rel="lightbox[screens]" class="thumb" title="By default, any boolean field on the model can be toggled in the index view with an Ajax link."><img src="./img/screen4-thumb.png"></a>
12
+ <a href="/admin_assistant/img/screen4.png" rel="lightbox[screens]" class="thumb" title="By default, any boolean field on the model can be toggled in the index view with an Ajax link."><img src="/admin_assistant/img/screen4-thumb.png"></a>
13
13
 
14
- <a href="./img/screen5.png" rel="lightbox[screens]" class="thumb" title="New and edit pages render default widgets for each column on the model. Datetime fields, for example, each get a &quot;Clear&quot; javascript link by default."><img src="./img/screen5-thumb.png"></a>
14
+ <a href="/admin_assistant/img/screen5.png" rel="lightbox[screens]" class="thumb" title="New and edit pages render default widgets for each column on the model. Datetime fields, for example, each get a &quot;Clear&quot; javascript link by default."><img src="/admin_assistant/img/screen5-thumb.png"></a>
15
15
 
16
- <a href="./img/screen6.png" rel="lightbox[screens]" class="thumb" title="If the model has a belongs-to association, and there are too many records on that associated table to be usable in a dropdown, admin_assistant renders an autocompleter instead."><img src="./img/screen6-thumb.png"></a>
16
+ <a href="/admin_assistant/img/screen6.png" rel="lightbox[screens]" class="thumb" title="If the model has a belongs-to association, and there are too many records on that associated table to be usable in a dropdown, admin_assistant renders an autocompleter instead."><img src="/admin_assistant/img/screen6-thumb.png"></a>
17
17
 
18
- <a href="./img/screen7.png" rel="lightbox[screens]" class="thumb" title="On the form, individual column inputs on the form can be overridden with custom logic. On this admin controller for the Product model, the column &quot;price&quot; is being rendered with the ERB template _price_input.html.erb. The submitted parameters are then pre-processed with a protected controller method called price_from_form."><img src="./img/screen7-thumb.png"></a>
18
+ <a href="/admin_assistant/img/screen7.png" rel="lightbox[screens]" class="thumb" title="On the form, individual column inputs on the form can be overridden with custom logic. On this admin controller for the Product model, the column &quot;price&quot; is being rendered with the ERB template _price_input.html.erb. The submitted parameters are then pre-processed with a protected controller method called price_from_form."><img src="/admin_assistant/img/screen7-thumb.png"></a>
19
19
 
20
- <a href="./img/screen8.png" rel="lightbox[screens]" class="thumb" title="A customized search form can give you searching by specific columns. The user can choose to match all or any of the conditions. Also, numerical fields include comparators by default, so, for example, you can search for all products costing greater than $100."><img src="./img/screen8-thumb.png"></a>
20
+ <a href="/admin_assistant/img/screen8.png" rel="lightbox[screens]" class="thumb" title="A customized search form can give you searching by specific columns. The user can choose to match all or any of the conditions. Also, numerical fields include comparators by default, so, for example, you can search for all products costing greater than $100."><img src="/admin_assistant/img/screen8-thumb.png"></a>
21
21
 
22
- <a href="./img/screen9.png" rel="lightbox[screens]" class="thumb" title="The same autocompleting for belongs-to associations is also available in the search form. In this example, the user is searching for blog posts by author."><img src="./img/screen9-thumb.png"></a>
22
+ <a href="/admin_assistant/img/screen9.png" rel="lightbox[screens]" class="thumb" title="The same autocompleting for belongs-to associations is also available in the search form. In this example, the user is searching for blog posts by author."><img src="/admin_assistant/img/screen9-thumb.png"></a>
23
23
 
24
- <a href="./img/screen10.png" rel="lightbox[screens]" class="thumb" title="There is an optional theme that mimics ActiveScaffold, which may come in handy if you're in the process of transitioning away from ActiveScaffold. admin_assistant does not conflict with ActiveScaffold; you can use the two in different controllers of the same Rails app."><img src="./img/screen10-thumb.png"></a>
24
+ <a href="/admin_assistant/img/screen10.png" rel="lightbox[screens]" class="thumb" title="There is an optional theme that mimics ActiveScaffold, which may come in handy if you're in the process of transitioning away from ActiveScaffold. admin_assistant does not conflict with ActiveScaffold; you can use the two in different controllers of the same Rails app."><img src="/admin_assistant/img/screen10-thumb.png"></a>
25
25
 
26
- <a href="./img/screen11.png" rel="lightbox[screens]" class="thumb" title="admin_assistant handles images out of the box through either Paperclip or FileColumn."><img src="./img/screen11-thumb.png"></a>
26
+ <a href="/admin_assistant/img/screen11.png" rel="lightbox[screens]" class="thumb" title="admin_assistant handles images out of the box through Paperclip."><img src="/admin_assistant/img/screen11-thumb.png"></a>
27
27
 
@@ -1,35 +1,44 @@
1
1
  ---
2
2
  layout: default
3
- title: Quick start
3
+ title: Tutorial
4
4
  ---
5
5
 
6
- *This document assumes you are a beginning Rails user; if you are very familiar with Rails you might want to check out our [quick start](./quick_start.html).*
6
+ <div class="note">
7
+ This document assumes you are a beginning Rails user; if you are familiar with Rails you might want to check out our <a href="/admin_assistant/quick_start.html">quick start</a>.
8
+ </div>
7
9
 
8
- 1) First, install the plugin from Github.
10
+ 1) Add the gem to `Gemfile` in the root of your Rails project.
9
11
 
10
- ./script/plugin install git://github.com/fhwang/admin_assistant.git
12
+ gem 'admin_assistant'
13
+
14
+ 2) Install the gem locally.
15
+
16
+ $ bundle install
17
+
18
+ 3) admin\_assistant uses jQuery. You may already have jQuery installed for your project, but if not, you can get it like so:
11
19
 
12
- 2) If you don't have the popular will\_paginate gem, you'll need that too. See [http://wiki.github.com/mislav/will_paginate/installation](http://wiki.github.com/mislav/will_paginate/installation) for more info.
20
+ $ curl http://code.jquery.com/jquery-1.6.2.min.js > \
21
+ public/javascripts/jquery-1.6.2.min.js
13
22
 
14
- 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:
23
+ 4) If you don't have any admin controllers in your Rails project yet, you probably need to create a separate admin layout. Create a file called `app/views/layouts/admin.html.erb` like this:
15
24
 
16
25
  <html>
17
26
  <head>
18
- <%= javascript_include_tag("prototype", "effects", "controls") %>
27
+ <%= javascript_include_tag("jquery-1.6.2.min") %>
19
28
  <%= admin_assistant_includes %>
20
29
  </head>
21
30
  <body>
22
- <%=yield %>
31
+ <%= yield %>
23
32
  </body>
24
33
  </html>
25
34
 
26
35
  If you've already created an admin layout, you should add the javascript references, and the call to `admin_assistant_includes`. This includes the standard CSS and Javascript that are packed with admin\_assistant.
27
36
 
28
- 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.
37
+ 5) Create your new admin controller for a pre-existing model. We'll be using a BlogPost as an example but you should be able to use any model in your Rails app.
29
38
 
30
39
  ./script/generate controller admin/blog_posts
31
40
 
32
- 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:
41
+ 6) Open `app/controllers/admin/blog_posts_controller.rb` and set it up to use the admin layout and to use admin\_assistant for the BlogPost model:
33
42
 
34
43
  class Admin::BlogPostsController < ApplicationController
35
44
  layout 'admin'
@@ -37,11 +46,11 @@ If you've already created an admin layout, you should add the javascript referen
37
46
  admin_assistant_for BlogPost
38
47
  end
39
48
 
40
- 6) If you were already running your Rails app with `./script/server` etc, you should restart it.
49
+ 7) If you were already running your Rails app with `./script/server` etc, you should restart it.
41
50
 
42
- 7) Visit `/admin/blog_posts` in your browser and you'll see something like this:
51
+ 8) Visit `/admin/blog_posts` in your browser and you'll see something like this:
43
52
 
44
- ![index](./img/blog_posts-index.png)
53
+ ![index](/admin_assistant/img/blog_posts-index.png)
45
54
 
46
55
  You can now search, paginate, create, and edit blog posts.
47
56
 
@@ -52,5 +61,5 @@ Depending on the model you're using, you might notice a few things:
52
61
  * There is no `destroy` action out of the box. This is intended as a safe default, but you can add it if you like.
53
62
  * If you have more than 10 pages of a given model, the pagination at the bottom includes a jump form to let you automatically jump to a page you enter.
54
63
 
55
- For more, check out the [API reference](./api/).
64
+ For more, check out the [API reference](/admin_assistant/api/).
56
65
 
@@ -0,0 +1,108 @@
1
+ ---
2
+ layout: default
3
+ title: "Version 1 API: Core"
4
+ subtitle: Core
5
+ subnav: api1
6
+ ---
7
+
8
+ ### Includes
9
+
10
+ admin\_assistant comes with its own Javascript and CSS. Call `admin_assistant_includes` in your admin layout to use them:
11
+
12
+ <html>
13
+ <head>
14
+ <%= admin_assistant_includes %>
15
+ </head>
16
+ ...
17
+ </html>
18
+
19
+ You also have the option of making admin\_assistant look very similar to activescaffold CSS-wise, which might come in handy if you're in the process of transition from one to the other:
20
+
21
+ <%= admin_assistant_includes :theme => 'activescaffold' %>
22
+
23
+ Submissions of other themes are welcome.
24
+
25
+ ### Configuring the core builder object
26
+
27
+ <a name="builder_actions"> </a>
28
+ #### actions
29
+
30
+ admin\_assistant uses the old-fashioned seven Rails actions: index, show, new/create, edit/update, and destroy. By default, you get all of them except destroy. To add destroy, you can simply append it to the `actions` method:
31
+
32
+ admin_assistant_for User do |aa|
33
+ aa.actions << :destroy
34
+ end
35
+
36
+ You can also send `actions` a list of actions and it will only allow those:
37
+
38
+ # I only want to create or index images, not edit, show or destroy
39
+ admin_assistant_for Image do |aa|
40
+ aa.actions :create, :index
41
+ end
42
+
43
+ ### model\_class\_name
44
+
45
+ Use this to override what the model is named in the interface, in links like "New blog post" or "50 blog posts found". The string passed in should be lowercase.
46
+
47
+ aa.model_class_name = 'post'
48
+
49
+
50
+ ### Column config options
51
+
52
+ #### boolean\_labels
53
+
54
+ aa[:textile].boolean_labels = %w(Yes No)
55
+
56
+ For a boolean fields, will change how the values get displayed, instead of simply "true" and "false".
57
+
58
+ #### label
59
+
60
+ aa[:user].label = 'Author'
61
+
62
+
63
+ Overrides the default label for that column in index, search, and form views.
64
+
65
+ #### polymorphic\_types
66
+
67
+ aa[:bookmarkable].polymorphic_types = [BlogPost, Comment, Product, User]
68
+
69
+ If a column is a polymorphic association, admin\_assistant will offer specific widgets for searching and editing this column. With `polymorphic_types` you can tell it what possible types the association can be set to.
70
+
71
+ #### strftime\_format
72
+
73
+ aa[:published_at].strftime_format = "%b %d, %Y %H:%M:%S"
74
+
75
+ If the column is a date or time, this will use the given strftime format for displaying the column in index and shows views.
76
+
77
+ ### Helper methods
78
+
79
+ #### \[column\]\_value
80
+
81
+ Determines what value is passed to form inputs, index views, etc, for the individual column. This is most useful for a virtual column.
82
+
83
+
84
+
85
+ ### Model methods
86
+
87
+ #### name\_for\_admin\_assistant
88
+
89
+ When dealing with associations, admin\_assistant needs a convenient way to display a given record. By default, it will look for a method with the name `name`, `title`, `login`, or `username`. If you'd like to provide custom functionality across all admin\_assistant controllers, define the method `name_for_admin_assistant` on the model.
90
+
91
+ For example, let's say you have a ProductCategory class with a field `category_name`. With the code below, any time a product category is referred to through an association, admin\_assistant will display the `category_name`, in index views, form selects, etc.
92
+
93
+ class ProductCategory < ActiveRecord::Base
94
+ def name_for_admin_assistant
95
+ self.category_name
96
+ end
97
+ end
98
+
99
+ #### sort\_value\_for\_admin\_assistant
100
+
101
+ When showing associated records, admin\_assistant will sort by the method `sort_value_for_admin_assistant` if it's defined on the model. This comes in handy if you want to specify sorting on form drop-downs for belongs-to associations.
102
+
103
+ class Appointment < ActiveRecord::Base
104
+ def sort_value_for_admin_assistant
105
+ self.time
106
+ end
107
+ end
108
+
@@ -0,0 +1,27 @@
1
+ ---
2
+ layout: default
3
+ title: "Version 1 API: Destroy"
4
+ subtitle: Destroy
5
+ subnav: api1
6
+ ---
7
+
8
+ Note that the `destroy` action is turned off by default. To turn it on, use the core [actions](/admin_assistant/v1/api/core.html#builder_actions) method.
9
+
10
+ By default, `destroy` simply retrieves the model instance, and calls `ActiveRecord::Base#destroy`. If you'd like to define your own custom deletion semantics, you can set a block that will be called instead of the model's built-in `destroy` method:
11
+
12
+ admin_assistant_for Product do |a|
13
+ a.actions << :destroy
14
+ a.destroy do |product|
15
+ product.update_attribute :deleted, true
16
+ product.notify_admins_of_deletion
17
+ end
18
+ end
19
+
20
+ You may also find plugins such as [as\_paranoid] or [acts\_as\_paranoid] useful here. If you're using a plugin such as that, which changes the behavior of `ActiveRecord::Base#destroy`, it means that you will probably not need to customize admin\_assistant in this way.
21
+
22
+
23
+
24
+
25
+ [acts_as_paranoid]: http://ar-paranoid.rubyforge.org/
26
+ [as_paranoid]: http://github.com/semanticart/is_paranoid/tree/master
27
+
@@ -0,0 +1,293 @@
1
+ ---
2
+ layout: default
3
+ title: "Version 1 API: Form"
4
+ subtitle: Form
5
+ subnav: api1
6
+ ---
7
+
8
+ ![form](/admin_assistant/img/user-form.png)
9
+
10
+ Form configuration affects both creating new records and updating existing records. Most of its customization happens through the form builder object:
11
+
12
+
13
+ class Admin::BlogPostsController < ApplicationController
14
+ admin_assistant_for BlogPost do |a|
15
+ a.form do |form|
16
+ form.columns :user, :title, :body
17
+ end
18
+ end
19
+ end
20
+
21
+ ### Form config options
22
+
23
+ #### columns
24
+
25
+ form.columns :user, :title, :body
26
+
27
+ Shows only these columns in the form.
28
+
29
+ #### columns\_for\_edit
30
+
31
+ form.columns_for_edit :title, :user, :published_at, :body, :merged_into
32
+
33
+ Shows only these columns in the edit action.
34
+
35
+
36
+ #### columns\_for\_new
37
+
38
+ form.columns_for_new :title, :user, :published_at
39
+
40
+ Shows only these columns in the new action.
41
+
42
+
43
+ #### multi
44
+
45
+ form.multi = true
46
+
47
+ Set this to true to enable multi-record creation in your form. Validation errors will be shown on top of the individual row that caused the error, and if any of the records has a validation error, none of the records will be created.
48
+
49
+ Please note that this feature is alpha and may change significantly in the near future. As always, input is appreciated.
50
+
51
+
52
+ #### submit\_buttons
53
+
54
+ form.submit_buttons << 'Preview'
55
+
56
+
57
+ By default, there is one button at the bottom of the form, saying either "Create" or "Update". By appending to this array you can specify other buttons, and then check if those buttons were clicked in `destination_after_save`, below.
58
+
59
+ ### Column config options
60
+
61
+ #### datetime\_select\_options
62
+
63
+ form[:published_at].datetime_select_options =
64
+ {:include_blank => false, :start_year => 2009}
65
+
66
+ Passes through these options to the datetime select for this column. By default this is set to `{:include_blank => true}`.
67
+
68
+ #### default
69
+
70
+ form[:published_at].default do |controller|
71
+ controller.default_published_at
72
+ end
73
+
74
+ Sets a default value for the column when rendering the new form.
75
+
76
+
77
+ #### description
78
+
79
+ form[:publish].description = "Click this check box to publish this blog post."
80
+
81
+ Sets descriptive text that will appear next to the column's input.
82
+
83
+ #### image\_size
84
+
85
+ form[:image].image_size = '300x500'
86
+
87
+ By default, [Paperclip] and [FileColumn] image files are rendered at full-size in the form. To restrict their size, pass a size string to `image_size`.
88
+
89
+ #### input
90
+
91
+ form[:publish].input = :check_box
92
+
93
+ Currently supports `:check_box`, `:select`, `:text_area`, and `:us_state`. `:us_state` will render a drop-down with U.S. states.
94
+
95
+ #### nilify\_link
96
+
97
+ Date and datetime fields come with a javascript link the clears the value in the date or datetime selects. The text of this link is "Set \[column name\] to nil" by default, but you may want to customize this text:
98
+
99
+ form[:sale_starts_at].nilify_link = 'Not on sale'
100
+
101
+
102
+ #### read\_only
103
+
104
+ a.form[:comment].read_only
105
+
106
+ If this is set, the given column will only be displayed, and not editable.
107
+
108
+
109
+ #### select\_choices
110
+
111
+ form[:admin_level].select_choices = %w(normal admin superuser)
112
+
113
+ Uses this with select inputs to set or override what is passed to Rails' `select` method as its `choices` argument.
114
+
115
+
116
+ #### select\_options
117
+
118
+ form[:user].select_options = {:include_blank => false}
119
+
120
+ Use this with belongs-to associations to tell admin\_assistant how to configure the `select` dropdown for the associated field. By default, this is set to `{:include_blank => true}`.
121
+
122
+ #### text\_area\_options
123
+
124
+ form[:body].text_area_options = {:cols => 20, :rows => 40}
125
+
126
+ Sets options to pass through to the text area that will be rendered for this column.
127
+
128
+ #### write\_once
129
+
130
+ form[:body].write_once
131
+
132
+ If this is set, the given column will only be editable on the new page, not on the edit page.
133
+
134
+
135
+ ### Controller methods
136
+
137
+ #### after\_save
138
+
139
+ Runs after the record is saved.
140
+
141
+ #### before\_create
142
+
143
+ Runs before the record is created.
144
+
145
+ #### before\_save
146
+
147
+ def before_save(blog_post)
148
+ if params[:blog_post][:publish] && blog_post.published_at.nil?
149
+ blog_post.published_at = Time.now.utc
150
+ end
151
+ end
152
+
153
+ Runs before the record is saved.
154
+
155
+ #### before\_update
156
+
157
+ Runs before the record is updated.
158
+
159
+
160
+ #### before\_validation
161
+
162
+ Runs before the record is validated.
163
+
164
+
165
+ #### \[column\]\_exists?
166
+
167
+ Used for image fields in generating form pages. If this method exists on the controller, it will be called to see if the image exists. You'll probably use this in conjunction with `[column]_url` and `destroy_[column]_in_attributes`.
168
+
169
+ def tmp_avatar_exists?(user)
170
+ user.has_avatar?
171
+ end
172
+
173
+ #### \[column\]\_url
174
+
175
+ Used for image fields in generating form pages. If the existing record has an image, and this method exists on the controller, it will be called to get the URL that should be rendered. You'll probably use this in conjunction with `[column]_exists?` and `destroy_[column]_in_attributes`.
176
+
177
+ def tmp_avatar_url(user)
178
+ "http://my-image-server.com/users/#{user.id}.jpg?v=#{user.avatar_version}"
179
+ end
180
+
181
+
182
+
183
+ #### \[column\]\_from\_form
184
+
185
+ def tags_from_form(tags_strings)
186
+ tags_strings.split(/\s+/).map { |tag_str|
187
+ Tag.find_by_tag(tag_str) || Tag.create(:tag => tag_str)
188
+ }
189
+ end
190
+
191
+ Should return a value suitable for assignment. In the above example, a BlogPost has-many tags, and the method tags\_from\_form will turn the string `"funny, video, lolcat"` into an array of three Tag model records, so admin\_assistant can set BlogPost#tags to that array.
192
+
193
+ If you need to return a value from another parameter, you can accept a second argument, which will be the params hash for the record.
194
+
195
+ def title_from_form(title_str, record_params)
196
+ if title_str.blank?
197
+ record_params[:title_alt]
198
+ else
199
+ title_str
200
+ end
201
+ end
202
+
203
+ If the value being returned is meant to be assigned through an association, you may find it useful to return custom errors to work around the strangeness of ActiveRecord's association-assignment error-handling. So admin\_assistant lets you optionally take a 3rd errors argument, which you can use to attach errors to the core model. This error object isn't returned, but changes to it will persist outside the body of the method.
204
+
205
+ def tags_from_form(tags_string, record_params, errors)
206
+ tags = tags_string.split(/\s+/).map { |tag_str|
207
+ Tag.find_by_tag(tag_str) || Tag.create(:tag => tag_str)
208
+ }
209
+ if tags.any? { |t| !t.valid? }
210
+ errors.add(:tags, "One or more tags was invalid")
211
+ end
212
+ tags
213
+ end
214
+
215
+
216
+
217
+
218
+ #### destination\_after\_save
219
+
220
+ def destination_after_save(blog_post, params)
221
+ if params[:commit] == 'Preview'
222
+ {:action => 'edit', :id => blog_post.id, :preview => '1'}
223
+ end
224
+ end
225
+
226
+ This method should return a hash to redirect to after a successful save. If it returns nil, the default is to return to the index page.
227
+
228
+ #### destroy\_\[column\]\_in\_attributes
229
+
230
+ Used for image fields. If a file field already exists, and the user clicks on the checkbox to delete this file, this method will be called if it's defined. You'll probably use this in conjunction with `[column]_exists?` and `[column]_exists?`.
231
+
232
+ def destroy_tmp_avatar_in_attributes(attributes)
233
+ attributes[:has_avatar] = false
234
+ end
235
+
236
+
237
+ #### validate
238
+
239
+ Runs after the model's built-in validation, before admin\_assistant tries to save the model.
240
+
241
+
242
+ ### Helper methods
243
+
244
+ #### after\_\[column\]\_input
245
+
246
+ If this helper method is present, whatever text it returns will be rendered after the default input for the column in the form. Takes the record as its only argument. You can also create a partial named `_after_[column]_input.html.erb`.
247
+
248
+ def after_password_input(user)
249
+ if user.id
250
+ "Reset #{check_box_tag('reset_password')}"
251
+ end
252
+ end
253
+
254
+ #### \[column\]\_input
255
+
256
+ If this helper method is present, whatever text it returns will be rendered instead of the default input for the column in the form. If it returns nil, the default input will be rendered instead. Takes the record as its only argument.
257
+
258
+ def password_input(user)
259
+ if !user.id
260
+ "(autogenerated)"
261
+ end
262
+ end
263
+
264
+ You can also create a partial named `_[column]_input.html.erb`.
265
+
266
+ #### \[column\]\_string
267
+
268
+ If this helper method is present, its returned string will be rendered within a text field. Odds are you'll use this with the controller method `[column]_from_form`, above.
269
+
270
+ def tags_string(blog_post)
271
+ blog_post.tags.map { |tag| tag.tag }.join ' '
272
+ end
273
+
274
+
275
+ ### Partials
276
+
277
+ #### \_\[column\]\_input.html.erb
278
+
279
+ If this partial is present, it will be rendered instead of the default input for the column.
280
+
281
+ #### \_after\_\[column\]\_input.html.erb
282
+
283
+
284
+ If this partial is present, it will be rendered after the default input for the column. You can also use the helper method `after_[column]_input`.
285
+
286
+ #### \_after\_form.html.erb
287
+
288
+ If this partial is present in the controller's views directory, it will be rendered after the normal form.
289
+
290
+
291
+ [FileColumn]: http://www.kanthak.net/opensource/file_column/
292
+ [Paperclip]: http://thoughtbot.com/projects/paperclip
293
+