community_engine 2.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (737) hide show
  1. data/.gitignore +15 -0
  2. data/.gitmodules +0 -0
  3. data/.travis.yml +9 -0
  4. data/CHANGELOG +118 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +30 -0
  7. data/README.markdown +188 -0
  8. data/Rakefile +54 -0
  9. data/UPGRADING.markdown +93 -0
  10. data/about.yml +7 -0
  11. data/app/assets/images/auth/facebook_32.png +0 -0
  12. data/app/assets/images/auth/facebook_64.png +0 -0
  13. data/app/assets/images/auth/google_32.png +0 -0
  14. data/app/assets/images/auth/google_64.png +0 -0
  15. data/app/assets/images/auth/linked_in_32.png +0 -0
  16. data/app/assets/images/auth/linked_in_64.png +0 -0
  17. data/app/assets/images/auth/open_id_32.png +0 -0
  18. data/app/assets/images/auth/remove.png +0 -0
  19. data/app/assets/images/auth/twitter_32.png +0 -0
  20. data/app/assets/images/auth/twitter_64.png +0 -0
  21. data/app/assets/images/bg_h6btn.gif +0 -0
  22. data/app/assets/images/bg_navbar.gif +0 -0
  23. data/app/assets/images/clearbits/bg_rounded.gif +0 -0
  24. data/app/assets/images/clearbits/comment.gif +0 -0
  25. data/app/assets/images/clearbits/lock.gif +0 -0
  26. data/app/assets/images/clearbits/smile.gif +0 -0
  27. data/app/assets/images/close.gif +0 -0
  28. data/app/assets/images/cropper/marqueeHoriz.gif +0 -0
  29. data/app/assets/images/cropper/marqueeVert.gif +0 -0
  30. data/app/assets/images/feed.png +0 -0
  31. data/app/assets/images/icon_missing_medium.gif +0 -0
  32. data/app/assets/images/icon_missing_thumb.gif +0 -0
  33. data/app/assets/images/icons/31.png +0 -0
  34. data/app/assets/images/icons/52.png +0 -0
  35. data/app/assets/images/icons/accept.png +0 -0
  36. data/app/assets/images/icons/activity_default.png +0 -0
  37. data/app/assets/images/icons/add.png +0 -0
  38. data/app/assets/images/icons/book.png +0 -0
  39. data/app/assets/images/icons/bullet_arrow_down.png +0 -0
  40. data/app/assets/images/icons/bullet_arrow_down_50.png +0 -0
  41. data/app/assets/images/icons/clipping.png +0 -0
  42. data/app/assets/images/icons/comment.png +0 -0
  43. data/app/assets/images/icons/comments.png +0 -0
  44. data/app/assets/images/icons/date.png +0 -0
  45. data/app/assets/images/icons/delete.png +0 -0
  46. data/app/assets/images/icons/email.png +0 -0
  47. data/app/assets/images/icons/email_edit.png +0 -0
  48. data/app/assets/images/icons/email_go.png +0 -0
  49. data/app/assets/images/icons/email_open.png +0 -0
  50. data/app/assets/images/icons/group_go.png +0 -0
  51. data/app/assets/images/icons/heart.png +0 -0
  52. data/app/assets/images/icons/heart_add.png +0 -0
  53. data/app/assets/images/icons/heart_off.png +0 -0
  54. data/app/assets/images/icons/ical.gif +0 -0
  55. data/app/assets/images/icons/page_white.png +0 -0
  56. data/app/assets/images/icons/page_white_magnify.png +0 -0
  57. data/app/assets/images/icons/picture.png +0 -0
  58. data/app/assets/images/icons/poll.png +0 -0
  59. data/app/assets/images/icons/post.png +0 -0
  60. data/app/assets/images/icons/printer.png +0 -0
  61. data/app/assets/images/icons/rss.png +0 -0
  62. data/app/assets/images/icons/slides.png +0 -0
  63. data/app/assets/images/icons/tag_blue.png +0 -0
  64. data/app/assets/images/icons/user.png +0 -0
  65. data/app/assets/images/icons/user_add.png +0 -0
  66. data/app/assets/images/icons/user_edit.png +0 -0
  67. data/app/assets/images/icons/user_go.png +0 -0
  68. data/app/assets/images/icons/vote.png +0 -0
  69. data/app/assets/images/icons/world.png +0 -0
  70. data/app/assets/images/icons/wrench.png +0 -0
  71. data/app/assets/images/logo.gif +0 -0
  72. data/app/assets/images/reply_background.png +0 -0
  73. data/app/assets/images/search.gif +0 -0
  74. data/app/assets/images/spinner.gif +0 -0
  75. data/app/assets/images/spinner_black.gif +0 -0
  76. data/app/assets/images/spinner_bounce.gif +0 -0
  77. data/app/assets/images/swf/choose.png +0 -0
  78. data/app/assets/images/swf/line_grapher.swf +0 -0
  79. data/app/assets/images/swf/swfupload.swf +0 -0
  80. data/app/assets/images/thumb.gif +0 -0
  81. data/app/assets/javascripts/builder.js +136 -0
  82. data/app/assets/javascripts/calendarview.js +839 -0
  83. data/app/assets/javascripts/community_engine.js +20 -0
  84. data/app/assets/javascripts/cropper.css +182 -0
  85. data/app/assets/javascripts/cropper.js +566 -0
  86. data/app/assets/javascripts/forum.js +73 -0
  87. data/app/assets/javascripts/lightbox.js +151 -0
  88. data/app/assets/javascripts/prototip-min.js +27 -0
  89. data/app/assets/javascripts/rails.js +202 -0
  90. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/css/advimage.css +84 -0
  91. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/editor_plugin.js +52 -0
  92. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/editor_plugin_src.js +45 -0
  93. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/image.htm +180 -0
  94. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/img/sample.gif +0 -0
  95. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/js/functions.js +508 -0
  96. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/langs/en.js +3 -0
  97. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/langs/en_dlg.js +43 -0
  98. data/app/assets/stylesheets/community_engine.css +6 -0
  99. data/app/assets/stylesheets/forum.css +605 -0
  100. data/app/assets/stylesheets/lightbox.css +38 -0
  101. data/app/assets/stylesheets/prototip.css +73 -0
  102. data/app/assets/stylesheets/reset-fonts-grids.css +8 -0
  103. data/app/assets/stylesheets/screen.css +977 -0
  104. data/app/controllers/activities_controller.rb +38 -0
  105. data/app/controllers/admin_controller.rb +80 -0
  106. data/app/controllers/ads_controller.rb +85 -0
  107. data/app/controllers/albums_controller.rb +106 -0
  108. data/app/controllers/authorizations_controller.rb +41 -0
  109. data/app/controllers/base_controller.rb +151 -0
  110. data/app/controllers/categories_controller.rb +118 -0
  111. data/app/controllers/clippings_controller.rb +192 -0
  112. data/app/controllers/comment_sweeper.rb +35 -0
  113. data/app/controllers/comments_controller.rb +179 -0
  114. data/app/controllers/event_sweeper.rb +24 -0
  115. data/app/controllers/events_controller.rb +173 -0
  116. data/app/controllers/favorite_sweeper.rb +29 -0
  117. data/app/controllers/favorites_controller.rb +36 -0
  118. data/app/controllers/forums_controller.rb +71 -0
  119. data/app/controllers/friendships_controller.rb +126 -0
  120. data/app/controllers/homepage_features_controller.rb +68 -0
  121. data/app/controllers/invitations_controller.rb +46 -0
  122. data/app/controllers/messages_controller.rb +95 -0
  123. data/app/controllers/metro_areas_controller.rb +68 -0
  124. data/app/controllers/moderators_controller.rb +26 -0
  125. data/app/controllers/monitorships_controller.rb +20 -0
  126. data/app/controllers/page_sweeper.rb +33 -0
  127. data/app/controllers/pages_controller.rb +70 -0
  128. data/app/controllers/password_resets_controller.rb +52 -0
  129. data/app/controllers/photo_manager_controller.rb +11 -0
  130. data/app/controllers/photos_controller.rb +189 -0
  131. data/app/controllers/post_sweeper.rb +36 -0
  132. data/app/controllers/posts_controller.rb +252 -0
  133. data/app/controllers/rsvps_controller.rb +77 -0
  134. data/app/controllers/sb_posts_controller.rb +149 -0
  135. data/app/controllers/sessions_controller.rb +34 -0
  136. data/app/controllers/sitemap_controller.rb +21 -0
  137. data/app/controllers/statistics_controller.rb +34 -0
  138. data/app/controllers/taggable_sweeper.rb +38 -0
  139. data/app/controllers/tags_controller.rb +104 -0
  140. data/app/controllers/theme_controller.rb +60 -0
  141. data/app/controllers/topics_controller.rb +122 -0
  142. data/app/controllers/users_controller.rb +426 -0
  143. data/app/controllers/vote_sweeper.rb +16 -0
  144. data/app/controllers/votes_controller.rb +24 -0
  145. data/app/helpers/base_helper.rb +290 -0
  146. data/app/helpers/forums_helper.rb +31 -0
  147. data/app/helpers/friendships_helper.rb +16 -0
  148. data/app/helpers/monitorships_helper.rb +2 -0
  149. data/app/helpers/posts_helper.rb +17 -0
  150. data/app/helpers/sitemap_helper.rb +7 -0
  151. data/app/helpers/users_helper.rb +6 -0
  152. data/app/models/ad.rb +43 -0
  153. data/app/models/album.rb +12 -0
  154. data/app/models/asset.rb +3 -0
  155. data/app/models/authorization.rb +60 -0
  156. data/app/models/category.rb +20 -0
  157. data/app/models/choice.rb +13 -0
  158. data/app/models/clipping.rb +78 -0
  159. data/app/models/clipping_image.rb +9 -0
  160. data/app/models/comment.rb +122 -0
  161. data/app/models/country.rb +24 -0
  162. data/app/models/event.rb +61 -0
  163. data/app/models/facebook_profile.rb +32 -0
  164. data/app/models/facebook_publisher.rb +45 -0
  165. data/app/models/favorite.rb +47 -0
  166. data/app/models/forum.rb +22 -0
  167. data/app/models/friendship.rb +64 -0
  168. data/app/models/friendship_status.rb +3 -0
  169. data/app/models/homepage_feature.rb +15 -0
  170. data/app/models/invitation.rb +36 -0
  171. data/app/models/message.rb +84 -0
  172. data/app/models/message_thread.rb +33 -0
  173. data/app/models/metro_area.rb +16 -0
  174. data/app/models/moderatorship.rb +8 -0
  175. data/app/models/monitorship.rb +6 -0
  176. data/app/models/page.rb +8 -0
  177. data/app/models/photo.rb +83 -0
  178. data/app/models/poll.rb +39 -0
  179. data/app/models/post.rb +201 -0
  180. data/app/models/role.rb +5 -0
  181. data/app/models/rsvp.rb +24 -0
  182. data/app/models/sb_post.rb +67 -0
  183. data/app/models/state.rb +4 -0
  184. data/app/models/topic.rb +72 -0
  185. data/app/models/twitter_profile.rb +20 -0
  186. data/app/models/user.rb +483 -0
  187. data/app/models/user_notifier.rb +140 -0
  188. data/app/models/user_session.rb +14 -0
  189. data/app/models/vote.rb +19 -0
  190. data/app/views/activities/_activity.html.haml +56 -0
  191. data/app/views/activities/_icon.html.haml +14 -0
  192. data/app/views/activities/_unhandled_item.html.haml +1 -0
  193. data/app/views/activities/destroy.js.rjs +1 -0
  194. data/app/views/activities/index.html.haml +16 -0
  195. data/app/views/activities/network.html.haml +14 -0
  196. data/app/views/admin/comments.html.haml +71 -0
  197. data/app/views/admin/events.html.haml +33 -0
  198. data/app/views/admin/messages.html.haml +4 -0
  199. data/app/views/admin/users.html.haml +69 -0
  200. data/app/views/ads/edit.html.haml +46 -0
  201. data/app/views/ads/index.html.haml +43 -0
  202. data/app/views/ads/new.html.haml +44 -0
  203. data/app/views/ads/show.html.haml +36 -0
  204. data/app/views/albums/_form.html.haml +14 -0
  205. data/app/views/albums/edit.html.haml +16 -0
  206. data/app/views/albums/new.html.haml +15 -0
  207. data/app/views/albums/show.html.haml +32 -0
  208. data/app/views/base/_homepage_banner_message.html.haml +19 -0
  209. data/app/views/base/advertise.html.haml +8 -0
  210. data/app/views/base/plaxo.html.haml +5 -0
  211. data/app/views/base/site_index.html.haml +35 -0
  212. data/app/views/categories/_tips.html.haml +11 -0
  213. data/app/views/categories/edit.html.haml +34 -0
  214. data/app/views/categories/index.html.haml +30 -0
  215. data/app/views/categories/new.html.haml +9 -0
  216. data/app/views/categories/show.html.haml +45 -0
  217. data/app/views/clippings/_clipping.html.haml +18 -0
  218. data/app/views/clippings/_images.html.haml +3 -0
  219. data/app/views/clippings/_meta.html.haml +26 -0
  220. data/app/views/clippings/edit.html.haml +26 -0
  221. data/app/views/clippings/index.html.haml +35 -0
  222. data/app/views/clippings/load_images_from_uri.js.rjs +1 -0
  223. data/app/views/clippings/new.html.haml +29 -0
  224. data/app/views/clippings/new_clipping.html.haml +91 -0
  225. data/app/views/clippings/show.html.haml +56 -0
  226. data/app/views/clippings/site_index.html.haml +34 -0
  227. data/app/views/comments/_comment.html.haml +42 -0
  228. data/app/views/comments/_comment_form.html.haml +50 -0
  229. data/app/views/comments/_edit_form.html.haml +29 -0
  230. data/app/views/comments/create.js.rjs +20 -0
  231. data/app/views/comments/edit.js.rjs +7 -0
  232. data/app/views/comments/index.html.haml +23 -0
  233. data/app/views/comments/update.js.rjs +9 -0
  234. data/app/views/events/_event.html.haml +32 -0
  235. data/app/views/events/_subscribe.html.haml +7 -0
  236. data/app/views/events/edit.html.haml +34 -0
  237. data/app/views/events/index.html.haml +22 -0
  238. data/app/views/events/new.html.haml +32 -0
  239. data/app/views/events/show.html.haml +29 -0
  240. data/app/views/facebook/_fb_require.html.haml +11 -0
  241. data/app/views/favorites/_favorite.html.haml +5 -0
  242. data/app/views/favorites/create.js.rjs +17 -0
  243. data/app/views/favorites/destroy.js.rjs +14 -0
  244. data/app/views/favorites/index.html.haml +10 -0
  245. data/app/views/favorites/show.html.haml +13 -0
  246. data/app/views/forums/_form.html.haml +21 -0
  247. data/app/views/forums/edit.html.haml +11 -0
  248. data/app/views/forums/index.html.haml +70 -0
  249. data/app/views/forums/new.html.haml +9 -0
  250. data/app/views/forums/show.html.haml +85 -0
  251. data/app/views/friendships/_friendship.html.haml +16 -0
  252. data/app/views/friendships/_friendships.html.erb +14 -0
  253. data/app/views/friendships/accepted.html.haml +13 -0
  254. data/app/views/friendships/denied.html.haml +8 -0
  255. data/app/views/friendships/index.html.erb +3 -0
  256. data/app/views/friendships/index.xml.builder +29 -0
  257. data/app/views/friendships/pending.html.haml +7 -0
  258. data/app/views/friendships/show.html.haml +12 -0
  259. data/app/views/homepage_features/edit.html.haml +31 -0
  260. data/app/views/homepage_features/index.html.haml +30 -0
  261. data/app/views/homepage_features/new.html.haml +30 -0
  262. data/app/views/homepage_features/show.html.haml +29 -0
  263. data/app/views/invitations/index.html.erb +16 -0
  264. data/app/views/invitations/new.html.haml +33 -0
  265. data/app/views/layouts/application.html.haml +59 -0
  266. data/app/views/messages/_form.html.haml +24 -0
  267. data/app/views/messages/_inbox.html.haml +41 -0
  268. data/app/views/messages/_sent.html.haml +34 -0
  269. data/app/views/messages/_sidebar_nav.html.haml +9 -0
  270. data/app/views/messages/index.html.haml +8 -0
  271. data/app/views/messages/new.html.haml +10 -0
  272. data/app/views/messages/show.html.haml +40 -0
  273. data/app/views/metro_areas/edit.html.haml +16 -0
  274. data/app/views/metro_areas/index.html.haml +28 -0
  275. data/app/views/metro_areas/new.html.haml +16 -0
  276. data/app/views/metro_areas/show.html.haml +22 -0
  277. data/app/views/moderators/_toggle.html.erb +14 -0
  278. data/app/views/moderators/create.js.rjs +5 -0
  279. data/app/views/moderators/destroy.js.rjs +1 -0
  280. data/app/views/monitorships/create.js.rjs +4 -0
  281. data/app/views/monitorships/destroy.js.rjs +4 -0
  282. data/app/views/pages/_form.html.haml +25 -0
  283. data/app/views/pages/edit.html.haml +16 -0
  284. data/app/views/pages/edit.html.haml~ +16 -0
  285. data/app/views/pages/index.html.haml +34 -0
  286. data/app/views/pages/index.html.haml~ +28 -0
  287. data/app/views/pages/new.html.haml +14 -0
  288. data/app/views/pages/show.html.haml +8 -0
  289. data/app/views/pages/show.html.haml~ +6 -0
  290. data/app/views/password_resets/edit.html.haml +16 -0
  291. data/app/views/password_resets/new.html.haml +13 -0
  292. data/app/views/photo_manager/index.html.haml +49 -0
  293. data/app/views/photos/_manage_photos.html.haml +14 -0
  294. data/app/views/photos/_show_image_list.html.haml +24 -0
  295. data/app/views/photos/edit.html.haml +39 -0
  296. data/app/views/photos/index.html.haml +28 -0
  297. data/app/views/photos/index.xml.builder +9 -0
  298. data/app/views/photos/manage_photos.js.rjs +5 -0
  299. data/app/views/photos/new.html.haml +51 -0
  300. data/app/views/photos/recent.html.haml +8 -0
  301. data/app/views/photos/show.html.haml +53 -0
  302. data/app/views/polls/_edit.html.haml +15 -0
  303. data/app/views/polls/_excerpt.html.haml +4 -0
  304. data/app/views/polls/_new.html.haml +10 -0
  305. data/app/views/polls/_poll_ui.html.haml +37 -0
  306. data/app/views/polls/_polls_sidebar.html.haml +8 -0
  307. data/app/views/posts/_author_profile.html.haml +21 -0
  308. data/app/views/posts/_favorited_post.html.haml +10 -0
  309. data/app/views/posts/_post.html.haml +29 -0
  310. data/app/views/posts/_send_to_friend.html.erb +29 -0
  311. data/app/views/posts/_sidebar_post.html.haml +1 -0
  312. data/app/views/posts/edit.html.haml +48 -0
  313. data/app/views/posts/featured.html.haml +19 -0
  314. data/app/views/posts/index.html.haml +23 -0
  315. data/app/views/posts/manage.html.haml +66 -0
  316. data/app/views/posts/new.html.haml +67 -0
  317. data/app/views/posts/popular.html.haml +35 -0
  318. data/app/views/posts/preview.html.haml +27 -0
  319. data/app/views/posts/recent.html.haml +29 -0
  320. data/app/views/posts/show.html.haml +85 -0
  321. data/app/views/rsvps/edit.html.haml +9 -0
  322. data/app/views/rsvps/new.html.haml +9 -0
  323. data/app/views/sb_posts/_dummy_forum_post.html.erb +13 -0
  324. data/app/views/sb_posts/_edit.html.erb +31 -0
  325. data/app/views/sb_posts/_post.xml.builder +10 -0
  326. data/app/views/sb_posts/_reply_form.html.haml +37 -0
  327. data/app/views/sb_posts/_sb_post.html.haml +34 -0
  328. data/app/views/sb_posts/create.js.rjs +16 -0
  329. data/app/views/sb_posts/edit.html.erb +13 -0
  330. data/app/views/sb_posts/edit.js.rjs +6 -0
  331. data/app/views/sb_posts/index.html.haml +55 -0
  332. data/app/views/sb_posts/index.xml.builder +20 -0
  333. data/app/views/sb_posts/monitored.html.erb +55 -0
  334. data/app/views/sb_posts/monitored.xml.builder +15 -0
  335. data/app/views/sb_posts/update.js.rjs +5 -0
  336. data/app/views/sessions/new.html.haml +27 -0
  337. data/app/views/shared/_admin_nav.html.haml +19 -0
  338. data/app/views/shared/_bio_help.html.haml +4 -0
  339. data/app/views/shared/_box.html.haml +3 -0
  340. data/app/views/shared/_contact.html.haml +5 -0
  341. data/app/views/shared/_explore.html.haml +9 -0
  342. data/app/views/shared/_footer_content.html.haml +13 -0
  343. data/app/views/shared/_header.html.haml +42 -0
  344. data/app/views/shared/_location_chooser.html.haml +21 -0
  345. data/app/views/shared/_login_sidebar.html.haml +14 -0
  346. data/app/views/shared/_messages.html.haml +8 -0
  347. data/app/views/shared/_scripts_and_styles.html.haml +12 -0
  348. data/app/views/shared/_user_menu.html.haml +21 -0
  349. data/app/views/sitemap/index.html.haml +21 -0
  350. data/app/views/sitemap/index.xml.builder +28 -0
  351. data/app/views/statistics/activities.xml.builder +33 -0
  352. data/app/views/statistics/index.html.haml +56 -0
  353. data/app/views/tags/edit.html.haml +19 -0
  354. data/app/views/tags/index.html.haml +25 -0
  355. data/app/views/tags/manage.html.haml +37 -0
  356. data/app/views/tags/show.html.haml +65 -0
  357. data/app/views/topics/_form.html.haml +28 -0
  358. data/app/views/topics/_recent_topics_sidebar.haml +22 -0
  359. data/app/views/topics/edit.html.haml +10 -0
  360. data/app/views/topics/new.html.haml +21 -0
  361. data/app/views/topics/show.html.haml +107 -0
  362. data/app/views/topics/show.xml.builder +15 -0
  363. data/app/views/user_notifier/activation.text.erb +11 -0
  364. data/app/views/user_notifier/comment_notice.text.erb +8 -0
  365. data/app/views/user_notifier/follow_up_comment_notice.text.erb +15 -0
  366. data/app/views/user_notifier/follow_up_comment_notice_anonymous.text.erb +18 -0
  367. data/app/views/user_notifier/forgot_username.text.erb +8 -0
  368. data/app/views/user_notifier/friendship_accepted.text.erb +8 -0
  369. data/app/views/user_notifier/friendship_request.text.erb +8 -0
  370. data/app/views/user_notifier/message_notification.text.erb +14 -0
  371. data/app/views/user_notifier/new_forum_post_notice.text.erb +14 -0
  372. data/app/views/user_notifier/password_reset_instructions.text.erb +10 -0
  373. data/app/views/user_notifier/post_recommendation.text.erb +32 -0
  374. data/app/views/user_notifier/signup_invitation.text.erb +14 -0
  375. data/app/views/user_notifier/signup_notification.text.erb +16 -0
  376. data/app/views/users/_dashboard_nav.html.haml +40 -0
  377. data/app/views/users/_omniauth_connect.html.haml +21 -0
  378. data/app/views/users/_profile_completeness.html.haml +21 -0
  379. data/app/views/users/_profile_user_info_sidebar.html.haml +50 -0
  380. data/app/views/users/_search_options.html.haml +10 -0
  381. data/app/views/users/_sidebar_user.html.haml +8 -0
  382. data/app/views/users/_user.html.haml +31 -0
  383. data/app/views/users/crop_profile_photo.html.haml +40 -0
  384. data/app/views/users/dashboard.html.haml +44 -0
  385. data/app/views/users/edit.html.haml +75 -0
  386. data/app/views/users/edit_account.html.haml +64 -0
  387. data/app/views/users/forgot_username.html.haml +13 -0
  388. data/app/views/users/index.html.haml +18 -0
  389. data/app/views/users/invite.html.haml +31 -0
  390. data/app/views/users/new.html.haml +54 -0
  391. data/app/views/users/resend_activation.html.haml +13 -0
  392. data/app/views/users/show.html.haml +103 -0
  393. data/app/views/users/signup_completed.html.haml +8 -0
  394. data/app/views/users/statistics.html.haml +28 -0
  395. data/app/views/users/upload_profile_photo.html.haml +15 -0
  396. data/app/views/users/welcome_about.html.haml +66 -0
  397. data/app/views/users/welcome_invite.html.haml +33 -0
  398. data/app/views/users/welcome_photo.html.haml +29 -0
  399. data/app/views/votes/create.js.rjs +6 -0
  400. data/community_engine.gemspec +55 -0
  401. data/config/application_config.rb +162 -0
  402. data/config/initializers/cropper.rb +19 -0
  403. data/config/initializers/mce_options.rb +40 -0
  404. data/config/initializers/recaptcha_constants.rb +6 -0
  405. data/config/initializers/white_list.rb +7 -0
  406. data/config/locales/de-DE.yml +1271 -0
  407. data/config/locales/en.yml +1658 -0
  408. data/config/locales/es-AR.yml +758 -0
  409. data/config/locales/es-ES.yml +340 -0
  410. data/config/locales/es-MX.yml +672 -0
  411. data/config/locales/fr-FR.yml +1509 -0
  412. data/config/locales/ja-JP.yml +1321 -0
  413. data/config/locales/ru-RU.yml +97 -0
  414. data/config/locales/sr-CP.yml +89 -0
  415. data/config/locales/sv-SE.yml +1320 -0
  416. data/config/routes.rb +242 -0
  417. data/db/migrate/001_create_users.rb +26 -0
  418. data/db/migrate/002_add_activation_code_to_user.rb +11 -0
  419. data/db/migrate/003_create_photos.rb +22 -0
  420. data/db/migrate/004_add_tag_support.rb +21 -0
  421. data/db/migrate/005_create_friendships.rb +14 -0
  422. data/db/migrate/006_add_comments_tables.rb +18 -0
  423. data/db/migrate/007_create_friendship_statuses.rb +13 -0
  424. data/db/migrate/008_add_friendship_statuses.rb +14 -0
  425. data/db/migrate/009_create_clippings.rb +16 -0
  426. data/db/migrate/010_create_invitations.rb +14 -0
  427. data/db/migrate/011_create_homepage_features.rb +22 -0
  428. data/db/migrate/012_create_posts.rb +19 -0
  429. data/db/migrate/013_create_states.rb +13 -0
  430. data/db/migrate/014_add_states.rb +11 -0
  431. data/db/migrate/015_create_metro_areas.rb +15 -0
  432. data/db/migrate/016_add_metro_areas.rb +295 -0
  433. data/db/migrate/017_add_sessions_table.rb +20 -0
  434. data/db/migrate/018_create_categories.rb +11 -0
  435. data/db/migrate/019_change_comment_to_text_field.rb +10 -0
  436. data/db/migrate/020_create_login_slug.rb +9 -0
  437. data/db/migrate/021_add_category_names.rb +8 -0
  438. data/db/migrate/023_add_denied_friendship_status.rb +13 -0
  439. data/db/migrate/024_add_notification_preferences.rb +13 -0
  440. data/db/migrate/025_create_countries.rb +11 -0
  441. data/db/migrate/026_add_countries.rb +230 -0
  442. data/db/migrate/027_add_us_to_existing_metro_areas.rb +9 -0
  443. data/db/migrate/028_add_country_id_to_users.rb +9 -0
  444. data/db/migrate/029_add_us_to_users_with_states.rb +14 -0
  445. data/db/migrate/030_add_users_counter_cache.rb +9 -0
  446. data/db/migrate/031_news_to_talk.rb +10 -0
  447. data/db/migrate/033_featured_users.rb +9 -0
  448. data/db/migrate/034_add_last_login.rb +9 -0
  449. data/db/migrate/035_track_emailed.rb +9 -0
  450. data/db/migrate/036_create_skills.rb +11 -0
  451. data/db/migrate/037_create_offerings.rb +12 -0
  452. data/db/migrate/038_add_zag_to_users.rb +13 -0
  453. data/db/migrate/039_create_activities_table.rb +17 -0
  454. data/db/migrate/040_add_category_tips.rb +9 -0
  455. data/db/migrate/041_create_events_table.rb +19 -0
  456. data/db/migrate/042_add_privacy_to_users.rb +10 -0
  457. data/db/migrate/043_sql_session_store_setup.rb +39 -0
  458. data/db/migrate/044_category_improvements.rb +11 -0
  459. data/db/migrate/045_adding_indexes.rb +39 -0
  460. data/db/migrate/046_adding_ads.rb +20 -0
  461. data/db/migrate/047_add_polls.rb +30 -0
  462. data/db/migrate/049_add_activities_count.rb +9 -0
  463. data/db/migrate/050_create_initial_schema.rb +73 -0
  464. data/db/migrate/051_add_audience_limitation_to_ads.rb +9 -0
  465. data/db/migrate/052_create_assets.rb +21 -0
  466. data/db/migrate/053_create_favoritables.rb +23 -0
  467. data/db/migrate/054_add_published_as_to_posts.rb +13 -0
  468. data/db/migrate/055_add_published_at_to_posts.rb +15 -0
  469. data/db/migrate/056_create_roles.rb +28 -0
  470. data/db/migrate/057_add_more_indexes.rb +19 -0
  471. data/db/migrate/058_add_anonymous_commenting_fields.rb +15 -0
  472. data/db/migrate/059_create_messages.rb +16 -0
  473. data/db/migrate/060_still_more_indexes.rb +19 -0
  474. data/db/migrate/061_postgres_compatibility_changes.rb +9 -0
  475. data/db/migrate/062_add_notify_to_comments.rb +11 -0
  476. data/db/migrate/063_create_albums.rb +15 -0
  477. data/db/migrate/064_add_album_id_to_photos.rb +9 -0
  478. data/db/migrate/065_add_view_count_to_albums.rb +9 -0
  479. data/db/migrate/066_add_view_count_to_photos.rb +9 -0
  480. data/db/migrate/067_create_static_pages.rb +22 -0
  481. data/db/migrate/068_create_rsvps.rb +13 -0
  482. data/db/migrate/069_create_pages.rb +29 -0
  483. data/db/migrate/070_add_pages.rb +11 -0
  484. data/db/migrate/071_authlogic_compatibility_changes.rb +43 -0
  485. data/db/migrate/072_add_allow_rsvp_to_events.rb +9 -0
  486. data/db/migrate/073_add_taggings_count_to_tags.rb +9 -0
  487. data/db/migrate/074_add_threading_to_messages.rb +19 -0
  488. data/db/migrate/075_add_anonymous_forum_posting.rb +16 -0
  489. data/db/migrate/076_add_comment_notification_toggle.rb +9 -0
  490. data/db/migrate/077_paperclip_changes.rb +36 -0
  491. data/db/migrate/078_create_authorizations.rb +20 -0
  492. data/db/migrate/079_create_slugs.rb +18 -0
  493. data/db/sample/users.rb +55 -0
  494. data/generators/ce_plugin/USAGE +7 -0
  495. data/generators/ce_plugin/ce_plugin_generator.rb +25 -0
  496. data/generators/ce_plugin/templates/README +13 -0
  497. data/generators/ce_plugin/templates/desert_routes.rb +3 -0
  498. data/generators/ce_plugin/templates/init.rb +8 -0
  499. data/generators/ce_plugin/templates/plugin.rb +1 -0
  500. data/generators/plugin_migration/plugin_migration_generator.rb +101 -0
  501. data/generators/plugin_migration/templates/plugin_migration.erb +13 -0
  502. data/lang/TRANSLATION.markdown +32 -0
  503. data/lib/community_engine/authenticated_system.rb +167 -0
  504. data/lib/community_engine/authenticated_test_helper.rb +113 -0
  505. data/lib/community_engine/community_engine_sha1_crypto_method.rb +12 -0
  506. data/lib/community_engine/engine.rb +39 -0
  507. data/lib/community_engine/engines_extensions.rb +7 -0
  508. data/lib/community_engine/i18n_extensions.rb +31 -0
  509. data/lib/community_engine/localized_application.rb +83 -0
  510. data/lib/community_engine/rails_asset_extensions.rb +131 -0
  511. data/lib/community_engine/url_upload.rb +15 -0
  512. data/lib/community_engine/version.rb +10 -0
  513. data/lib/community_engine/viewable.rb +12 -0
  514. data/lib/community_engine.rb +34 -0
  515. data/lib/tag_hacks.rb +24 -0
  516. data/lib/tasks/community_engine_tasks.rake +87 -0
  517. data/public/favicon.ico +0 -0
  518. data/sample_files/s3.yml +17 -0
  519. data/test/fixtures/ads.yml +13 -0
  520. data/test/fixtures/albums.yml +16 -0
  521. data/test/fixtures/categories.yml +16 -0
  522. data/test/fixtures/clippings.yml +15 -0
  523. data/test/fixtures/comments.yml +55 -0
  524. data/test/fixtures/countries.yml +13 -0
  525. data/test/fixtures/events.yml +61 -0
  526. data/test/fixtures/files/Granite.bmp +0 -0
  527. data/test/fixtures/files/library.jpg +0 -0
  528. data/test/fixtures/forums.yml +10 -0
  529. data/test/fixtures/friendship_statuses.yml +10 -0
  530. data/test/fixtures/friendships.yml +15 -0
  531. data/test/fixtures/homepage_features.yml +13 -0
  532. data/test/fixtures/invitations.yml +5 -0
  533. data/test/fixtures/messages.yml +24 -0
  534. data/test/fixtures/metro_areas.yml +24 -0
  535. data/test/fixtures/moderatorships.yml +4 -0
  536. data/test/fixtures/monitorships.yml +10 -0
  537. data/test/fixtures/pages.yml +26 -0
  538. data/test/fixtures/photos.yml +29 -0
  539. data/test/fixtures/posts.yml +49 -0
  540. data/test/fixtures/roles.yml +9 -0
  541. data/test/fixtures/rsvps.yml +7 -0
  542. data/test/fixtures/sb_posts.yml +90 -0
  543. data/test/fixtures/states.yml +7 -0
  544. data/test/fixtures/taggings.yml +15 -0
  545. data/test/fixtures/tags.yml +11 -0
  546. data/test/fixtures/topics.yml +63 -0
  547. data/test/fixtures/users.yml +222 -0
  548. data/test/functional/activities_controller_test.rb +62 -0
  549. data/test/functional/admin_controller_test.rb +60 -0
  550. data/test/functional/ads_controller_test.rb +51 -0
  551. data/test/functional/albums_controller_test.rb +120 -0
  552. data/test/functional/base_controller_test.rb +27 -0
  553. data/test/functional/categories_controller_test.rb +51 -0
  554. data/test/functional/clippings_controller_test.rb +123 -0
  555. data/test/functional/comments_controller_test.rb +215 -0
  556. data/test/functional/events_controller_test.rb +104 -0
  557. data/test/functional/favorites_controller_test.rb +53 -0
  558. data/test/functional/forums_controller_test.rb +95 -0
  559. data/test/functional/friendships_controller_test.rb +98 -0
  560. data/test/functional/homepage_features_controller_test.rb +69 -0
  561. data/test/functional/invitations_controller_test.rb +45 -0
  562. data/test/functional/messages_controller_test.rb +154 -0
  563. data/test/functional/metro_areas_controller_test.rb +63 -0
  564. data/test/functional/moderators_controller_test.rb +22 -0
  565. data/test/functional/monitorships_controller_test.rb +72 -0
  566. data/test/functional/pages_controller_test.rb +95 -0
  567. data/test/functional/password_reset_controller_test.rb +34 -0
  568. data/test/functional/photo_manager_controller_test.rb +21 -0
  569. data/test/functional/photos_controller_test.rb +203 -0
  570. data/test/functional/posts_controller_test.rb +224 -0
  571. data/test/functional/rsvps_controller_test.rb +92 -0
  572. data/test/functional/sb_posts_controller_test.rb +193 -0
  573. data/test/functional/sessions_controller_test.rb +55 -0
  574. data/test/functional/sitemap_controller_test.rb +9 -0
  575. data/test/functional/statistics_controller_test.rb +18 -0
  576. data/test/functional/tags_controller_test.rb +52 -0
  577. data/test/functional/theme_controller_test.rb +11 -0
  578. data/test/functional/topics_controller_test.rb +201 -0
  579. data/test/functional/users_controller_test.rb +460 -0
  580. data/test/functional/votes_controller_test.rb +27 -0
  581. data/test/test_helper.rb +103 -0
  582. data/test/testapp/.gitignore +4 -0
  583. data/test/testapp/README +256 -0
  584. data/test/testapp/Rakefile +7 -0
  585. data/test/testapp/app/controllers/application_controller.rb +3 -0
  586. data/test/testapp/app/helpers/application_helper.rb +2 -0
  587. data/test/testapp/config/application.rb +45 -0
  588. data/test/testapp/config/application_config.rb +1 -0
  589. data/test/testapp/config/boot.rb +10 -0
  590. data/test/testapp/config/database.yml +22 -0
  591. data/test/testapp/config/environment.rb +6 -0
  592. data/test/testapp/config/environments/development.rb +25 -0
  593. data/test/testapp/config/environments/production.rb +49 -0
  594. data/test/testapp/config/environments/test.rb +35 -0
  595. data/test/testapp/config/initializers/backtrace_silencers.rb +7 -0
  596. data/test/testapp/config/initializers/inflections.rb +10 -0
  597. data/test/testapp/config/initializers/mime_types.rb +5 -0
  598. data/test/testapp/config/initializers/secret_token.rb +7 -0
  599. data/test/testapp/config/initializers/session_store.rb +8 -0
  600. data/test/testapp/config/locales/en.yml +5 -0
  601. data/test/testapp/config/routes.rb +3 -0
  602. data/test/testapp/config.ru +4 -0
  603. data/test/testapp/db/schema.rb +456 -0
  604. data/test/testapp/db/seeds.rb +7 -0
  605. data/test/testapp/doc/README_FOR_APP +2 -0
  606. data/test/testapp/lib/tasks/.gitkeep +0 -0
  607. data/test/testapp/public/404.html +26 -0
  608. data/test/testapp/public/422.html +26 -0
  609. data/test/testapp/public/500.html +26 -0
  610. data/test/testapp/public/favicon.ico +0 -0
  611. data/test/testapp/public/images/rails.png +0 -0
  612. data/test/testapp/public/robots.txt +5 -0
  613. data/test/testapp/script/rails +6 -0
  614. data/test/testapp/test/performance/browsing_test.rb +9 -0
  615. data/test/testapp/test/test_helper.rb +13 -0
  616. data/test/testapp/vendor/plugins/.gitkeep +0 -0
  617. data/test/unit/ad_test.rb +34 -0
  618. data/test/unit/asset_test.rb +15 -0
  619. data/test/unit/authorization_test.rb +55 -0
  620. data/test/unit/category_test.rb +22 -0
  621. data/test/unit/choice_test.rb +9 -0
  622. data/test/unit/clipping_image_test.rb +17 -0
  623. data/test/unit/clipping_test.rb +52 -0
  624. data/test/unit/comment_test.rb +107 -0
  625. data/test/unit/country_test.rb +15 -0
  626. data/test/unit/event_test.rb +75 -0
  627. data/test/unit/favorite_test.rb +71 -0
  628. data/test/unit/forum_test.rb +23 -0
  629. data/test/unit/friendship_status_test.rb +10 -0
  630. data/test/unit/friendship_test.rb +38 -0
  631. data/test/unit/homepage_feature_test.rb +10 -0
  632. data/test/unit/invitation_test.rb +27 -0
  633. data/test/unit/message_test.rb +49 -0
  634. data/test/unit/message_thread_test.rb +80 -0
  635. data/test/unit/metro_area_test.rb +10 -0
  636. data/test/unit/moderatorship_test.rb +30 -0
  637. data/test/unit/monitorships_test.rb +38 -0
  638. data/test/unit/page_test.rb +25 -0
  639. data/test/unit/photo_test.rb +42 -0
  640. data/test/unit/poll_test.rb +25 -0
  641. data/test/unit/post_test.rb +212 -0
  642. data/test/unit/rsvp_test.rb +33 -0
  643. data/test/unit/sb_post_test.rb +152 -0
  644. data/test/unit/state_test.rb +10 -0
  645. data/test/unit/tag_test.rb +22 -0
  646. data/test/unit/topic_test.rb +111 -0
  647. data/test/unit/user_notifier_test.rb +108 -0
  648. data/test/unit/user_test.rb +259 -0
  649. data/test/unit/vote_test.rb +9 -0
  650. data/vendor/plugins/activity_tracker/README +4 -0
  651. data/vendor/plugins/activity_tracker/Rakefile +22 -0
  652. data/vendor/plugins/activity_tracker/generators/activity_migration/USAGE +13 -0
  653. data/vendor/plugins/activity_tracker/generators/activity_migration/activity_migration_generator.rb +11 -0
  654. data/vendor/plugins/activity_tracker/generators/activity_migration/templates/migration.rb +17 -0
  655. data/vendor/plugins/activity_tracker/init.rb +1 -0
  656. data/vendor/plugins/activity_tracker/install.rb +1 -0
  657. data/vendor/plugins/activity_tracker/lib/activity.rb +40 -0
  658. data/vendor/plugins/activity_tracker/lib/activity_tracker.rb +80 -0
  659. data/vendor/plugins/activity_tracker/tasks/activity_tracker_tasks.rake +4 -0
  660. data/vendor/plugins/activity_tracker/test/abstract_unit.rb +47 -0
  661. data/vendor/plugins/activity_tracker/test/activity_tracker_test.rb +48 -0
  662. data/vendor/plugins/activity_tracker/test/database.yml +18 -0
  663. data/vendor/plugins/activity_tracker/test/debug.log +3329 -0
  664. data/vendor/plugins/activity_tracker/test/fixtures/test_post.rb +5 -0
  665. data/vendor/plugins/activity_tracker/test/fixtures/test_posts.yml +3 -0
  666. data/vendor/plugins/activity_tracker/test/fixtures/test_user.rb +4 -0
  667. data/vendor/plugins/activity_tracker/test/fixtures/test_users.yml +6 -0
  668. data/vendor/plugins/activity_tracker/test/schema.rb +21 -0
  669. data/vendor/plugins/activity_tracker/uninstall.rb +1 -0
  670. data/vendor/plugins/acts_as_list/README +23 -0
  671. data/vendor/plugins/acts_as_list/init.rb +3 -0
  672. data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
  673. data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
  674. data/vendor/plugins/acts_as_publishable/README +3 -0
  675. data/vendor/plugins/acts_as_publishable/Rakefile +22 -0
  676. data/vendor/plugins/acts_as_publishable/generators/publishing/publishing_generator.rb +34 -0
  677. data/vendor/plugins/acts_as_publishable/generators/publishing/templates/migration.rb +13 -0
  678. data/vendor/plugins/acts_as_publishable/init.rb +3 -0
  679. data/vendor/plugins/acts_as_publishable/install.rb +3 -0
  680. data/vendor/plugins/acts_as_publishable/lib/acts_as_publishable.rb +81 -0
  681. data/vendor/plugins/acts_as_publishable/test/acts_as_publishable_test.rb +8 -0
  682. data/vendor/plugins/acts_as_publishable/uninstall.rb +1 -0
  683. data/vendor/plugins/auto_complete/README +23 -0
  684. data/vendor/plugins/auto_complete/Rakefile +22 -0
  685. data/vendor/plugins/auto_complete/init.rb +2 -0
  686. data/vendor/plugins/auto_complete/lib/auto_complete.rb +47 -0
  687. data/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb +143 -0
  688. data/vendor/plugins/auto_complete/test/auto_complete_test.rb +67 -0
  689. data/vendor/plugins/enumerations_mixin/LICENSE +20 -0
  690. data/vendor/plugins/enumerations_mixin/README_ENUMERATIONS +163 -0
  691. data/vendor/plugins/enumerations_mixin/init.rb +21 -0
  692. data/vendor/plugins/enumerations_mixin/lib/active_record/acts/enumerated.rb +177 -0
  693. data/vendor/plugins/enumerations_mixin/lib/active_record/aggregations/has_enumerated.rb +60 -0
  694. data/vendor/plugins/enumerations_mixin/lib/active_record/virtual_enumerations.rb +68 -0
  695. data/vendor/plugins/enumerations_mixin/virtual_enumerations_sample.rb +76 -0
  696. data/vendor/plugins/prototype_legacy_helper/README.markdown +13 -0
  697. data/vendor/plugins/prototype_legacy_helper/init.rb +1 -0
  698. data/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +432 -0
  699. data/vendor/plugins/prototype_legacy_helper/test/test_prototype_helper.rb +297 -0
  700. data/vendor/plugins/resource_feeder/README +4 -0
  701. data/vendor/plugins/resource_feeder/Rakefile +22 -0
  702. data/vendor/plugins/resource_feeder/init.rb +2 -0
  703. data/vendor/plugins/resource_feeder/lib/resource_feeder/atom.rb +71 -0
  704. data/vendor/plugins/resource_feeder/lib/resource_feeder/rss.rb +71 -0
  705. data/vendor/plugins/resource_feeder/lib/resource_feeder.rb +2 -0
  706. data/vendor/plugins/resource_feeder/test/atom_feed_test.rb +85 -0
  707. data/vendor/plugins/resource_feeder/test/rss_feed_test.rb +61 -0
  708. data/vendor/plugins/resource_feeder/test/test_helper.rb +60 -0
  709. data/vendor/plugins/respond_to_parent/MIT-LICENSE +20 -0
  710. data/vendor/plugins/respond_to_parent/README +47 -0
  711. data/vendor/plugins/respond_to_parent/Rakefile +22 -0
  712. data/vendor/plugins/respond_to_parent/init.rb +1 -0
  713. data/vendor/plugins/respond_to_parent/install.rb +1 -0
  714. data/vendor/plugins/respond_to_parent/lib/responds_to_parent.rb +70 -0
  715. data/vendor/plugins/respond_to_parent/test/responds_to_parent_test.rb +10 -0
  716. data/vendor/plugins/respond_to_parent/test/test_helper.rb +6 -0
  717. data/vendor/plugins/respond_to_parent/uninstall.rb +1 -0
  718. data/vendor/plugins/tiny_mce/CHANGELOG_PLUGIN.rdoc +91 -0
  719. data/vendor/plugins/tiny_mce/CHANGELOG_TINYMCE +1226 -0
  720. data/vendor/plugins/tiny_mce/DEV_UPGRADE_NOTES.rdoc +12 -0
  721. data/vendor/plugins/tiny_mce/init.rb +2 -0
  722. data/vendor/plugins/tiny_mce/install.rb +18 -0
  723. data/vendor/plugins/tiny_mce/lib/tiny_mce/base.rb +33 -0
  724. data/vendor/plugins/tiny_mce/lib/tiny_mce/configuration.rb +114 -0
  725. data/vendor/plugins/tiny_mce/lib/tiny_mce/exceptions.rb +14 -0
  726. data/vendor/plugins/tiny_mce/lib/tiny_mce/helpers.rb +43 -0
  727. data/vendor/plugins/tiny_mce/lib/tiny_mce/railtie.rb +13 -0
  728. data/vendor/plugins/tiny_mce/lib/tiny_mce/spell_checker.rb +67 -0
  729. data/vendor/plugins/tiny_mce/lib/tiny_mce/valid_tinymce_langs.yml +25 -0
  730. data/vendor/plugins/tiny_mce/lib/tiny_mce/valid_tinymce_options.yml +167 -0
  731. data/vendor/plugins/tiny_mce/lib/tiny_mce.rb +24 -0
  732. data/vendor/plugins/white_list/README +35 -0
  733. data/vendor/plugins/white_list/Rakefile +22 -0
  734. data/vendor/plugins/white_list/init.rb +35 -0
  735. data/vendor/plugins/white_list/lib/white_list_helper.rb +61 -0
  736. data/vendor/plugins/white_list/test/white_list_test.rb +120 -0
  737. metadata +1073 -0
@@ -0,0 +1,5 @@
1
+ class TestPost < ActiveRecord::Base
2
+ belongs_to :test_user
3
+ acts_as_activity :test_user, :if => Proc.new{|record| record.test_user and !record.test_user.login.eql?('elvis') }
4
+
5
+ end
@@ -0,0 +1,3 @@
1
+ bruno_post:
2
+ id: 1
3
+ title: How To Track Activities
@@ -0,0 +1,4 @@
1
+ class TestUser < ActiveRecord::Base
2
+ has_many :test_posts
3
+ tracks_unlinked_activities [:logged_in]
4
+ end
@@ -0,0 +1,6 @@
1
+ bruno:
2
+ id: 1
3
+ login: bruno
4
+ elvis:
5
+ id: 2
6
+ login: elvis
@@ -0,0 +1,21 @@
1
+ ActiveRecord::Schema.define(:version => 0) do
2
+
3
+ create_table :activities, :force => true do |t|
4
+ t.column :user_id, :integer, :limit => 10
5
+ t.column :action, :string, :limit => 50
6
+ t.column :item_id, :integer, :limit => 10
7
+ t.column :item_type, :string
8
+ t.column :created_at, :datetime
9
+ end
10
+
11
+ create_table :test_users, :force => true do |t|
12
+ t.column :login, :string
13
+ end
14
+
15
+ create_table :test_posts, :force => true do |t|
16
+ t.column :title, :string
17
+ t.column :test_user_id, :integer
18
+ end
19
+
20
+
21
+ end
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
@@ -0,0 +1,23 @@
1
+ ActsAsList
2
+ ==========
3
+
4
+ This acts_as extension provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a +position+ column defined as an integer on the mapped database table.
5
+
6
+
7
+ Example
8
+ =======
9
+
10
+ class TodoList < ActiveRecord::Base
11
+ has_many :todo_items, :order => "position"
12
+ end
13
+
14
+ class TodoItem < ActiveRecord::Base
15
+ belongs_to :todo_list
16
+ acts_as_list :scope => :todo_list
17
+ end
18
+
19
+ todo_list.first.move_to_bottom
20
+ todo_list.last.move_higher
21
+
22
+
23
+ Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
@@ -0,0 +1,3 @@
1
+ $:.unshift "#{File.dirname(__FILE__)}/lib"
2
+ require 'active_record/acts/list'
3
+ ActiveRecord::Base.class_eval { include ActiveRecord::Acts::List }
@@ -0,0 +1,256 @@
1
+ module ActiveRecord
2
+ module Acts #:nodoc:
3
+ module List #:nodoc:
4
+ def self.included(base)
5
+ base.extend(ClassMethods)
6
+ end
7
+
8
+ # This +acts_as+ extension provides the capabilities for sorting and reordering a number of objects in a list.
9
+ # The class that has this specified needs to have a +position+ column defined as an integer on
10
+ # the mapped database table.
11
+ #
12
+ # Todo list example:
13
+ #
14
+ # class TodoList < ActiveRecord::Base
15
+ # has_many :todo_items, :order => "position"
16
+ # end
17
+ #
18
+ # class TodoItem < ActiveRecord::Base
19
+ # belongs_to :todo_list
20
+ # acts_as_list :scope => :todo_list
21
+ # end
22
+ #
23
+ # todo_list.first.move_to_bottom
24
+ # todo_list.last.move_higher
25
+ module ClassMethods
26
+ # Configuration options are:
27
+ #
28
+ # * +column+ - specifies the column name to use for keeping the position integer (default: +position+)
29
+ # * +scope+ - restricts what is to be considered a list. Given a symbol, it'll attach <tt>_id</tt>
30
+ # (if it hasn't already been added) and use that as the foreign key restriction. It's also possible
31
+ # to give it an entire string that is interpolated if you need a tighter scope than just a foreign key.
32
+ # Example: <tt>acts_as_list :scope => 'todo_list_id = #{todo_list_id} AND completed = 0'</tt>
33
+ def acts_as_list(options = {})
34
+ configuration = { :column => "position", :scope => "1 = 1" }
35
+ configuration.update(options) if options.is_a?(Hash)
36
+
37
+ configuration[:scope] = "#{configuration[:scope]}_id".intern if configuration[:scope].is_a?(Symbol) && configuration[:scope].to_s !~ /_id$/
38
+
39
+ if configuration[:scope].is_a?(Symbol)
40
+ scope_condition_method = %(
41
+ def scope_condition
42
+ if #{configuration[:scope].to_s}.nil?
43
+ "#{configuration[:scope].to_s} IS NULL"
44
+ else
45
+ "#{configuration[:scope].to_s} = \#{#{configuration[:scope].to_s}}"
46
+ end
47
+ end
48
+ )
49
+ else
50
+ scope_condition_method = "def scope_condition() \"#{configuration[:scope]}\" end"
51
+ end
52
+
53
+ class_eval <<-EOV
54
+ include ActiveRecord::Acts::List::InstanceMethods
55
+
56
+ def acts_as_list_class
57
+ ::#{self.name}
58
+ end
59
+
60
+ def position_column
61
+ '#{configuration[:column]}'
62
+ end
63
+
64
+ #{scope_condition_method}
65
+
66
+ before_destroy :remove_from_list
67
+ before_create :add_to_list_bottom
68
+ EOV
69
+ end
70
+ end
71
+
72
+ # All the methods available to a record that has had <tt>acts_as_list</tt> specified. Each method works
73
+ # by assuming the object to be the item in the list, so <tt>chapter.move_lower</tt> would move that chapter
74
+ # lower in the list of all chapters. Likewise, <tt>chapter.first?</tt> would return +true+ if that chapter is
75
+ # the first in the list of all chapters.
76
+ module InstanceMethods
77
+ # Insert the item at the given position (defaults to the top position of 1).
78
+ def insert_at(position = 1)
79
+ insert_at_position(position)
80
+ end
81
+
82
+ # Swap positions with the next lower item, if one exists.
83
+ def move_lower
84
+ return unless lower_item
85
+
86
+ acts_as_list_class.transaction do
87
+ lower_item.decrement_position
88
+ increment_position
89
+ end
90
+ end
91
+
92
+ # Swap positions with the next higher item, if one exists.
93
+ def move_higher
94
+ return unless higher_item
95
+
96
+ acts_as_list_class.transaction do
97
+ higher_item.increment_position
98
+ decrement_position
99
+ end
100
+ end
101
+
102
+ # Move to the bottom of the list. If the item is already in the list, the items below it have their
103
+ # position adjusted accordingly.
104
+ def move_to_bottom
105
+ return unless in_list?
106
+ acts_as_list_class.transaction do
107
+ decrement_positions_on_lower_items
108
+ assume_bottom_position
109
+ end
110
+ end
111
+
112
+ # Move to the top of the list. If the item is already in the list, the items above it have their
113
+ # position adjusted accordingly.
114
+ def move_to_top
115
+ return unless in_list?
116
+ acts_as_list_class.transaction do
117
+ increment_positions_on_higher_items
118
+ assume_top_position
119
+ end
120
+ end
121
+
122
+ # Removes the item from the list.
123
+ def remove_from_list
124
+ if in_list?
125
+ decrement_positions_on_lower_items
126
+ update_attribute position_column, nil
127
+ end
128
+ end
129
+
130
+ # Increase the position of this item without adjusting the rest of the list.
131
+ def increment_position
132
+ return unless in_list?
133
+ update_attribute position_column, self.send(position_column).to_i + 1
134
+ end
135
+
136
+ # Decrease the position of this item without adjusting the rest of the list.
137
+ def decrement_position
138
+ return unless in_list?
139
+ update_attribute position_column, self.send(position_column).to_i - 1
140
+ end
141
+
142
+ # Return +true+ if this object is the first in the list.
143
+ def first?
144
+ return false unless in_list?
145
+ self.send(position_column) == 1
146
+ end
147
+
148
+ # Return +true+ if this object is the last in the list.
149
+ def last?
150
+ return false unless in_list?
151
+ self.send(position_column) == bottom_position_in_list
152
+ end
153
+
154
+ # Return the next higher item in the list.
155
+ def higher_item
156
+ return nil unless in_list?
157
+ acts_as_list_class.find(:first, :conditions =>
158
+ "#{scope_condition} AND #{position_column} = #{(send(position_column).to_i - 1).to_s}"
159
+ )
160
+ end
161
+
162
+ # Return the next lower item in the list.
163
+ def lower_item
164
+ return nil unless in_list?
165
+ acts_as_list_class.find(:first, :conditions =>
166
+ "#{scope_condition} AND #{position_column} = #{(send(position_column).to_i + 1).to_s}"
167
+ )
168
+ end
169
+
170
+ # Test if this record is in a list
171
+ def in_list?
172
+ !send(position_column).nil?
173
+ end
174
+
175
+ private
176
+ def add_to_list_top
177
+ increment_positions_on_all_items
178
+ end
179
+
180
+ def add_to_list_bottom
181
+ self[position_column] = bottom_position_in_list.to_i + 1
182
+ end
183
+
184
+ # Overwrite this method to define the scope of the list changes
185
+ def scope_condition() "1" end
186
+
187
+ # Returns the bottom position number in the list.
188
+ # bottom_position_in_list # => 2
189
+ def bottom_position_in_list(except = nil)
190
+ item = bottom_item(except)
191
+ item ? item.send(position_column) : 0
192
+ end
193
+
194
+ # Returns the bottom item
195
+ def bottom_item(except = nil)
196
+ conditions = scope_condition
197
+ conditions = "#{conditions} AND #{self.class.primary_key} != #{except.id}" if except
198
+ acts_as_list_class.find(:first, :conditions => conditions, :order => "#{position_column} DESC")
199
+ end
200
+
201
+ # Forces item to assume the bottom position in the list.
202
+ def assume_bottom_position
203
+ update_attribute(position_column, bottom_position_in_list(self).to_i + 1)
204
+ end
205
+
206
+ # Forces item to assume the top position in the list.
207
+ def assume_top_position
208
+ update_attribute(position_column, 1)
209
+ end
210
+
211
+ # This has the effect of moving all the higher items up one.
212
+ def decrement_positions_on_higher_items(position)
213
+ acts_as_list_class.update_all(
214
+ "#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} <= #{position}"
215
+ )
216
+ end
217
+
218
+ # This has the effect of moving all the lower items up one.
219
+ def decrement_positions_on_lower_items
220
+ return unless in_list?
221
+ acts_as_list_class.update_all(
222
+ "#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} > #{send(position_column).to_i}"
223
+ )
224
+ end
225
+
226
+ # This has the effect of moving all the higher items down one.
227
+ def increment_positions_on_higher_items
228
+ return unless in_list?
229
+ acts_as_list_class.update_all(
230
+ "#{position_column} = (#{position_column} + 1)", "#{scope_condition} AND #{position_column} < #{send(position_column).to_i}"
231
+ )
232
+ end
233
+
234
+ # This has the effect of moving all the lower items down one.
235
+ def increment_positions_on_lower_items(position)
236
+ acts_as_list_class.update_all(
237
+ "#{position_column} = (#{position_column} + 1)", "#{scope_condition} AND #{position_column} >= #{position}"
238
+ )
239
+ end
240
+
241
+ # Increments position (<tt>position_column</tt>) of all items in the list.
242
+ def increment_positions_on_all_items
243
+ acts_as_list_class.update_all(
244
+ "#{position_column} = (#{position_column} + 1)", "#{scope_condition}"
245
+ )
246
+ end
247
+
248
+ def insert_at_position(position)
249
+ remove_from_list
250
+ increment_positions_on_lower_items(position)
251
+ self.update_attribute(position_column, position)
252
+ end
253
+ end
254
+ end
255
+ end
256
+ end
@@ -0,0 +1,332 @@
1
+ require 'test/unit'
2
+
3
+ require 'rubygems'
4
+ gem 'activerecord', '>= 1.15.4.7794'
5
+ require 'active_record'
6
+
7
+ require "#{File.dirname(__FILE__)}/../init"
8
+
9
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
10
+
11
+ def setup_db
12
+ ActiveRecord::Schema.define(:version => 1) do
13
+ create_table :mixins do |t|
14
+ t.column :pos, :integer
15
+ t.column :parent_id, :integer
16
+ t.column :created_at, :datetime
17
+ t.column :updated_at, :datetime
18
+ end
19
+ end
20
+ end
21
+
22
+ def teardown_db
23
+ ActiveRecord::Base.connection.tables.each do |table|
24
+ ActiveRecord::Base.connection.drop_table(table)
25
+ end
26
+ end
27
+
28
+ class Mixin < ActiveRecord::Base
29
+ end
30
+
31
+ class ListMixin < Mixin
32
+ acts_as_list :column => "pos", :scope => :parent
33
+
34
+ def self.table_name() "mixins" end
35
+ end
36
+
37
+ class ListMixinSub1 < ListMixin
38
+ end
39
+
40
+ class ListMixinSub2 < ListMixin
41
+ end
42
+
43
+ class ListWithStringScopeMixin < ActiveRecord::Base
44
+ acts_as_list :column => "pos", :scope => 'parent_id = #{parent_id}'
45
+
46
+ def self.table_name() "mixins" end
47
+ end
48
+
49
+
50
+ class ListTest < Test::Unit::TestCase
51
+
52
+ def setup
53
+ setup_db
54
+ (1..4).each { |counter| ListMixin.create! :pos => counter, :parent_id => 5 }
55
+ end
56
+
57
+ def teardown
58
+ teardown_db
59
+ end
60
+
61
+ def test_reordering
62
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
63
+
64
+ ListMixin.find(2).move_lower
65
+ assert_equal [1, 3, 2, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
66
+
67
+ ListMixin.find(2).move_higher
68
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
69
+
70
+ ListMixin.find(1).move_to_bottom
71
+ assert_equal [2, 3, 4, 1], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
72
+
73
+ ListMixin.find(1).move_to_top
74
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
75
+
76
+ ListMixin.find(2).move_to_bottom
77
+ assert_equal [1, 3, 4, 2], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
78
+
79
+ ListMixin.find(4).move_to_top
80
+ assert_equal [4, 1, 3, 2], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
81
+ end
82
+
83
+ def test_move_to_bottom_with_next_to_last_item
84
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
85
+ ListMixin.find(3).move_to_bottom
86
+ assert_equal [1, 2, 4, 3], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
87
+ end
88
+
89
+ def test_next_prev
90
+ assert_equal ListMixin.find(2), ListMixin.find(1).lower_item
91
+ assert_nil ListMixin.find(1).higher_item
92
+ assert_equal ListMixin.find(3), ListMixin.find(4).higher_item
93
+ assert_nil ListMixin.find(4).lower_item
94
+ end
95
+
96
+ def test_injection
97
+ item = ListMixin.new(:parent_id => 1)
98
+ assert_equal "parent_id = 1", item.scope_condition
99
+ assert_equal "pos", item.position_column
100
+ end
101
+
102
+ def test_insert
103
+ new = ListMixin.create(:parent_id => 20)
104
+ assert_equal 1, new.pos
105
+ assert new.first?
106
+ assert new.last?
107
+
108
+ new = ListMixin.create(:parent_id => 20)
109
+ assert_equal 2, new.pos
110
+ assert !new.first?
111
+ assert new.last?
112
+
113
+ new = ListMixin.create(:parent_id => 20)
114
+ assert_equal 3, new.pos
115
+ assert !new.first?
116
+ assert new.last?
117
+
118
+ new = ListMixin.create(:parent_id => 0)
119
+ assert_equal 1, new.pos
120
+ assert new.first?
121
+ assert new.last?
122
+ end
123
+
124
+ def test_insert_at
125
+ new = ListMixin.create(:parent_id => 20)
126
+ assert_equal 1, new.pos
127
+
128
+ new = ListMixin.create(:parent_id => 20)
129
+ assert_equal 2, new.pos
130
+
131
+ new = ListMixin.create(:parent_id => 20)
132
+ assert_equal 3, new.pos
133
+
134
+ new4 = ListMixin.create(:parent_id => 20)
135
+ assert_equal 4, new4.pos
136
+
137
+ new4.insert_at(3)
138
+ assert_equal 3, new4.pos
139
+
140
+ new.reload
141
+ assert_equal 4, new.pos
142
+
143
+ new.insert_at(2)
144
+ assert_equal 2, new.pos
145
+
146
+ new4.reload
147
+ assert_equal 4, new4.pos
148
+
149
+ new5 = ListMixin.create(:parent_id => 20)
150
+ assert_equal 5, new5.pos
151
+
152
+ new5.insert_at(1)
153
+ assert_equal 1, new5.pos
154
+
155
+ new4.reload
156
+ assert_equal 5, new4.pos
157
+ end
158
+
159
+ def test_delete_middle
160
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
161
+
162
+ ListMixin.find(2).destroy
163
+
164
+ assert_equal [1, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
165
+
166
+ assert_equal 1, ListMixin.find(1).pos
167
+ assert_equal 2, ListMixin.find(3).pos
168
+ assert_equal 3, ListMixin.find(4).pos
169
+
170
+ ListMixin.find(1).destroy
171
+
172
+ assert_equal [3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
173
+
174
+ assert_equal 1, ListMixin.find(3).pos
175
+ assert_equal 2, ListMixin.find(4).pos
176
+ end
177
+
178
+ def test_with_string_based_scope
179
+ new = ListWithStringScopeMixin.create(:parent_id => 500)
180
+ assert_equal 1, new.pos
181
+ assert new.first?
182
+ assert new.last?
183
+ end
184
+
185
+ def test_nil_scope
186
+ new1, new2, new3 = ListMixin.create, ListMixin.create, ListMixin.create
187
+ new2.move_higher
188
+ assert_equal [new2, new1, new3], ListMixin.find(:all, :conditions => 'parent_id IS NULL', :order => 'pos')
189
+ end
190
+
191
+
192
+ def test_remove_from_list_should_then_fail_in_list?
193
+ assert_equal true, ListMixin.find(1).in_list?
194
+ ListMixin.find(1).remove_from_list
195
+ assert_equal false, ListMixin.find(1).in_list?
196
+ end
197
+
198
+ def test_remove_from_list_should_set_position_to_nil
199
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
200
+
201
+ ListMixin.find(2).remove_from_list
202
+
203
+ assert_equal [2, 1, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
204
+
205
+ assert_equal 1, ListMixin.find(1).pos
206
+ assert_equal nil, ListMixin.find(2).pos
207
+ assert_equal 2, ListMixin.find(3).pos
208
+ assert_equal 3, ListMixin.find(4).pos
209
+ end
210
+
211
+ def test_remove_before_destroy_does_not_shift_lower_items_twice
212
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
213
+
214
+ ListMixin.find(2).remove_from_list
215
+ ListMixin.find(2).destroy
216
+
217
+ assert_equal [1, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
218
+
219
+ assert_equal 1, ListMixin.find(1).pos
220
+ assert_equal 2, ListMixin.find(3).pos
221
+ assert_equal 3, ListMixin.find(4).pos
222
+ end
223
+
224
+ end
225
+
226
+ class ListSubTest < Test::Unit::TestCase
227
+
228
+ def setup
229
+ setup_db
230
+ (1..4).each { |i| ((i % 2 == 1) ? ListMixinSub1 : ListMixinSub2).create! :pos => i, :parent_id => 5000 }
231
+ end
232
+
233
+ def teardown
234
+ teardown_db
235
+ end
236
+
237
+ def test_reordering
238
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
239
+
240
+ ListMixin.find(2).move_lower
241
+ assert_equal [1, 3, 2, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
242
+
243
+ ListMixin.find(2).move_higher
244
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
245
+
246
+ ListMixin.find(1).move_to_bottom
247
+ assert_equal [2, 3, 4, 1], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
248
+
249
+ ListMixin.find(1).move_to_top
250
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
251
+
252
+ ListMixin.find(2).move_to_bottom
253
+ assert_equal [1, 3, 4, 2], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
254
+
255
+ ListMixin.find(4).move_to_top
256
+ assert_equal [4, 1, 3, 2], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
257
+ end
258
+
259
+ def test_move_to_bottom_with_next_to_last_item
260
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
261
+ ListMixin.find(3).move_to_bottom
262
+ assert_equal [1, 2, 4, 3], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
263
+ end
264
+
265
+ def test_next_prev
266
+ assert_equal ListMixin.find(2), ListMixin.find(1).lower_item
267
+ assert_nil ListMixin.find(1).higher_item
268
+ assert_equal ListMixin.find(3), ListMixin.find(4).higher_item
269
+ assert_nil ListMixin.find(4).lower_item
270
+ end
271
+
272
+ def test_injection
273
+ item = ListMixin.new("parent_id"=>1)
274
+ assert_equal "parent_id = 1", item.scope_condition
275
+ assert_equal "pos", item.position_column
276
+ end
277
+
278
+ def test_insert_at
279
+ new = ListMixin.create("parent_id" => 20)
280
+ assert_equal 1, new.pos
281
+
282
+ new = ListMixinSub1.create("parent_id" => 20)
283
+ assert_equal 2, new.pos
284
+
285
+ new = ListMixinSub2.create("parent_id" => 20)
286
+ assert_equal 3, new.pos
287
+
288
+ new4 = ListMixin.create("parent_id" => 20)
289
+ assert_equal 4, new4.pos
290
+
291
+ new4.insert_at(3)
292
+ assert_equal 3, new4.pos
293
+
294
+ new.reload
295
+ assert_equal 4, new.pos
296
+
297
+ new.insert_at(2)
298
+ assert_equal 2, new.pos
299
+
300
+ new4.reload
301
+ assert_equal 4, new4.pos
302
+
303
+ new5 = ListMixinSub1.create("parent_id" => 20)
304
+ assert_equal 5, new5.pos
305
+
306
+ new5.insert_at(1)
307
+ assert_equal 1, new5.pos
308
+
309
+ new4.reload
310
+ assert_equal 5, new4.pos
311
+ end
312
+
313
+ def test_delete_middle
314
+ assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
315
+
316
+ ListMixin.find(2).destroy
317
+
318
+ assert_equal [1, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
319
+
320
+ assert_equal 1, ListMixin.find(1).pos
321
+ assert_equal 2, ListMixin.find(3).pos
322
+ assert_equal 3, ListMixin.find(4).pos
323
+
324
+ ListMixin.find(1).destroy
325
+
326
+ assert_equal [3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5000', :order => 'pos').map(&:id)
327
+
328
+ assert_equal 1, ListMixin.find(3).pos
329
+ assert_equal 2, ListMixin.find(4).pos
330
+ end
331
+
332
+ end
@@ -0,0 +1,3 @@
1
+ ActsAsPublishable
2
+ =================
3
+
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the acts_as_publishable plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the acts_as_publishable plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'ActsAsPublishable'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end