community_engine 2.3.2 → 3.0.0

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 (580) hide show
  1. checksums.yaml +13 -5
  2. data/.travis.yml +5 -4
  3. data/CHANGELOG +43 -5
  4. data/Gemfile +1 -16
  5. data/README.markdown +22 -19
  6. data/UPGRADING.markdown +10 -0
  7. data/about.yml +1 -1
  8. data/app/assets/javascripts/community_engine.js +187 -18
  9. data/app/assets/javascripts/cropper.js +86 -565
  10. data/app/assets/javascripts/forum.js +26 -71
  11. data/app/assets/javascripts/jquery.migrate.js +521 -0
  12. data/app/assets/stylesheets/_colors.css.scss +100 -0
  13. data/app/assets/stylesheets/_font.css.scss +17 -0
  14. data/app/assets/stylesheets/_forms.css.scss +20 -0
  15. data/app/assets/stylesheets/_forum.css.scss +0 -0
  16. data/app/assets/stylesheets/_grid.css.scss +7 -0
  17. data/app/assets/stylesheets/_layers.css.scss +7 -0
  18. data/app/assets/stylesheets/_layout.css.scss +28 -0
  19. data/app/assets/stylesheets/community_engine.css.scss +18 -0
  20. data/app/assets/stylesheets/cropper.css +6 -182
  21. data/app/controllers/activities_controller.rb +10 -10
  22. data/app/controllers/admin_controller.rb +23 -23
  23. data/app/controllers/ads_controller.rb +16 -5
  24. data/app/controllers/albums_controller.rb +11 -5
  25. data/app/controllers/base_controller.rb +5 -8
  26. data/app/controllers/categories_controller.rb +31 -31
  27. data/app/controllers/clippings_controller.rb +18 -12
  28. data/app/controllers/comments_controller.rb +17 -8
  29. data/app/controllers/events_controller.rb +25 -21
  30. data/app/controllers/favorites_controller.rb +12 -12
  31. data/app/controllers/forums_controller.rb +20 -9
  32. data/app/controllers/friendships_controller.rb +41 -48
  33. data/app/controllers/homepage_features_controller.rb +11 -5
  34. data/app/controllers/invitations_controller.rb +15 -9
  35. data/app/controllers/messages_controller.rb +25 -19
  36. data/app/controllers/metro_areas_controller.rb +9 -3
  37. data/app/controllers/moderators_controller.rb +1 -1
  38. data/app/controllers/monitorships_controller.rb +2 -2
  39. data/app/controllers/pages_controller.rb +16 -4
  40. data/app/controllers/password_resets_controller.rb +0 -1
  41. data/app/controllers/photos_controller.rb +32 -30
  42. data/app/controllers/posts_controller.rb +33 -17
  43. data/app/controllers/rsvps_controller.rb +8 -4
  44. data/app/controllers/sb_posts_controller.rb +22 -18
  45. data/app/controllers/sessions_controller.rb +2 -1
  46. data/app/controllers/sitemap_controller.rb +8 -8
  47. data/app/controllers/statistics_controller.rb +9 -8
  48. data/app/controllers/tags_controller.rb +26 -24
  49. data/app/controllers/topics_controller.rb +10 -6
  50. data/app/controllers/users_controller.rb +63 -34
  51. data/app/helpers/base_helper.rb +119 -29
  52. data/app/helpers/friendships_helper.rb +3 -3
  53. data/app/helpers/posts_helper.rb +5 -7
  54. data/app/models/acts_as_taggable_on/tag.rb +12 -13
  55. data/app/models/ad.rb +2 -5
  56. data/app/models/album.rb +0 -2
  57. data/app/models/category.rb +6 -7
  58. data/app/models/clipping.rb +2 -5
  59. data/app/models/clipping_image.rb +5 -5
  60. data/app/models/comment.rb +4 -5
  61. data/app/models/country.rb +2 -4
  62. data/app/models/event.rb +1 -2
  63. data/app/models/favorite.rb +5 -10
  64. data/app/models/forum.rb +0 -2
  65. data/app/models/friendship.rb +3 -5
  66. data/app/models/friendship_status.rb +0 -2
  67. data/app/models/homepage_feature.rb +4 -6
  68. data/app/models/invitation.rb +6 -8
  69. data/app/models/message.rb +25 -26
  70. data/app/models/message_thread.rb +1 -1
  71. data/app/models/metro_area.rb +0 -2
  72. data/app/models/page.rb +0 -2
  73. data/app/models/photo.rb +8 -8
  74. data/app/models/poll.rb +7 -9
  75. data/app/models/post.rb +11 -15
  76. data/app/models/role.rb +1 -2
  77. data/app/models/rsvp.rb +0 -3
  78. data/app/models/sb_post.rb +14 -9
  79. data/app/models/state.rb +0 -2
  80. data/app/models/topic.rb +5 -6
  81. data/app/models/user.rb +50 -63
  82. data/app/models/vote.rb +1 -1
  83. data/app/views/activities/_activity.html.haml +9 -9
  84. data/app/views/activities/destroy.js.erb +1 -0
  85. data/app/views/activities/index.html.haml +13 -13
  86. data/app/views/activities/network.html.haml +10 -13
  87. data/app/views/admin/comments.html.haml +48 -70
  88. data/app/views/admin/events.html.haml +20 -27
  89. data/app/views/admin/messages.html.haml +2 -3
  90. data/app/views/admin/update.js.erb +1 -0
  91. data/app/views/admin/users.html.haml +51 -66
  92. data/app/views/ads/_form.html.haml +21 -0
  93. data/app/views/ads/edit.html.haml +6 -46
  94. data/app/views/ads/index.html.haml +25 -39
  95. data/app/views/ads/new.html.haml +4 -43
  96. data/app/views/ads/show.html.haml +18 -35
  97. data/app/views/albums/_form.html.haml +17 -12
  98. data/app/views/albums/edit.html.haml +12 -14
  99. data/app/views/albums/new.html.haml +8 -13
  100. data/app/views/albums/show.html.haml +25 -32
  101. data/app/views/base/_homepage_banner_message.html.haml +5 -19
  102. data/app/views/base/advertise.html.haml +5 -8
  103. data/app/views/base/site_index.html.haml +25 -27
  104. data/app/views/categories/_form.html.haml +8 -0
  105. data/app/views/categories/_menu_item.html.haml +13 -0
  106. data/app/views/categories/_tips.html.haml +2 -2
  107. data/app/views/categories/edit.html.haml +3 -33
  108. data/app/views/categories/index.html.haml +18 -28
  109. data/app/views/categories/new.html.haml +3 -8
  110. data/app/views/categories/show.html.haml +33 -36
  111. data/app/views/clippings/_clipping.html.haml +10 -17
  112. data/app/views/clippings/_favorite.html.haml +14 -0
  113. data/app/views/clippings/_form.html.haml +15 -0
  114. data/app/views/clippings/_images.html.haml +1 -1
  115. data/app/views/clippings/_menu_item.html.haml +6 -0
  116. data/app/views/clippings/edit.html.haml +12 -23
  117. data/app/views/clippings/index.html.haml +29 -30
  118. data/app/views/clippings/load_images_from_uri.js.erb +1 -0
  119. data/app/views/clippings/new.html.haml +9 -26
  120. data/app/views/clippings/new_clipping.html.haml +30 -77
  121. data/app/views/clippings/show.html.haml +48 -53
  122. data/app/views/clippings/site_index.html.haml +19 -32
  123. data/app/views/comments/_comment.html.haml +40 -40
  124. data/app/views/comments/_comment_form.html.haml +22 -46
  125. data/app/views/comments/_edit_form.html.haml +13 -28
  126. data/app/views/comments/create.js.erb +25 -0
  127. data/app/views/comments/destroy.js.erb +3 -0
  128. data/app/views/comments/edit.js.erb +11 -0
  129. data/app/views/comments/index.html.haml +12 -22
  130. data/app/views/comments/update.js.erb +14 -0
  131. data/app/views/events/_event.html.haml +26 -24
  132. data/app/views/events/_form.html.haml +18 -0
  133. data/app/views/events/_menu_item.html.haml +6 -0
  134. data/app/views/events/_subscribe.html.haml +1 -1
  135. data/app/views/events/edit.html.haml +7 -32
  136. data/app/views/events/index.html.haml +11 -19
  137. data/app/views/events/new.html.haml +2 -31
  138. data/app/views/events/show.html.haml +54 -24
  139. data/app/views/favorites/create.js.erb +10 -0
  140. data/app/views/favorites/destroy.js.erb +6 -0
  141. data/app/views/favorites/index.html.haml +6 -8
  142. data/app/views/forums/_form.html.haml +10 -20
  143. data/app/views/forums/_menu_item.html.haml +6 -0
  144. data/app/views/forums/edit.html.haml +8 -10
  145. data/app/views/forums/index.html.haml +56 -64
  146. data/app/views/forums/new.html.haml +5 -8
  147. data/app/views/forums/show.html.haml +65 -72
  148. data/app/views/friendships/_friendship.html.haml +14 -16
  149. data/app/views/friendships/accepted.html.haml +7 -11
  150. data/app/views/friendships/create.js.haml +1 -0
  151. data/app/views/friendships/denied.html.haml +4 -8
  152. data/app/views/friendships/pending.html.haml +4 -6
  153. data/app/views/friendships/show.html.haml +10 -11
  154. data/app/views/homepage_features/_form.html.haml +6 -0
  155. data/app/views/homepage_features/edit.html.haml +5 -30
  156. data/app/views/homepage_features/index.html.haml +22 -28
  157. data/app/views/homepage_features/new.html.haml +2 -30
  158. data/app/views/homepage_features/show.html.haml +27 -29
  159. data/app/views/invitations/index.html.haml +8 -0
  160. data/app/views/invitations/new.html.haml +21 -30
  161. data/app/views/kaminari/bootstrap/_first_page.html.erb +13 -0
  162. data/app/views/kaminari/bootstrap/_gap.html.erb +8 -0
  163. data/app/views/kaminari/bootstrap/_last_page.html.erb +13 -0
  164. data/app/views/kaminari/bootstrap/_next_page.html.erb +13 -0
  165. data/app/views/kaminari/bootstrap/_page.html.erb +12 -0
  166. data/app/views/kaminari/bootstrap/_paginator.html.erb +25 -0
  167. data/app/views/kaminari/bootstrap/_prev_page.html.erb +13 -0
  168. data/app/views/layouts/application.html.haml +26 -37
  169. data/app/views/messages/_form.html.haml +6 -12
  170. data/app/views/messages/_inbox.html.haml +34 -39
  171. data/app/views/messages/_menu_item.html.haml +11 -0
  172. data/app/views/messages/_sent.html.haml +22 -33
  173. data/app/views/messages/_sidebar_nav.html.haml +12 -9
  174. data/app/views/messages/index.html.haml +2 -2
  175. data/app/views/messages/new.html.haml +2 -9
  176. data/app/views/messages/show.html.haml +28 -36
  177. data/app/views/metro_areas/_form.html.haml +6 -0
  178. data/app/views/metro_areas/edit.html.haml +6 -14
  179. data/app/views/metro_areas/index.html.haml +19 -26
  180. data/app/views/metro_areas/new.html.haml +4 -14
  181. data/app/views/metro_areas/show.html.haml +13 -21
  182. data/app/views/moderators/_toggle.html.haml +6 -0
  183. data/app/views/moderators/create.js.erb +5 -0
  184. data/app/views/moderators/destroy.js.erb +1 -0
  185. data/app/views/monitorships/create.js.erb +1 -0
  186. data/app/views/monitorships/destroy.js.erb +1 -0
  187. data/app/views/pages/_form.html.haml +16 -23
  188. data/app/views/pages/edit.html.haml +2 -14
  189. data/app/views/pages/index.html.haml +32 -32
  190. data/app/views/pages/new.html.haml +5 -12
  191. data/app/views/pages/show.html.haml +4 -8
  192. data/app/views/password_resets/edit.html.haml +6 -14
  193. data/app/views/password_resets/new.html.haml +7 -11
  194. data/app/views/photo_manager/index.html.haml +45 -43
  195. data/app/views/photos/_form.html.haml +24 -0
  196. data/app/views/photos/_manage_photos.html.haml +14 -6
  197. data/app/views/photos/_show_image_list.html.haml +2 -2
  198. data/app/views/photos/create.js.erb +1 -0
  199. data/app/views/photos/edit.html.haml +10 -38
  200. data/app/views/photos/index.html.haml +20 -20
  201. data/app/views/photos/manage_photos.js.erb +5 -0
  202. data/app/views/photos/new.html.haml +11 -49
  203. data/app/views/photos/recent.html.haml +6 -6
  204. data/app/views/photos/show.html.haml +48 -52
  205. data/app/views/polls/_edit.html.haml +6 -10
  206. data/app/views/polls/_excerpt.html.haml +3 -4
  207. data/app/views/polls/_new.html.haml +10 -9
  208. data/app/views/polls/_poll_ui.html.haml +30 -34
  209. data/app/views/posts/_author_profile.html.haml +12 -11
  210. data/app/views/posts/_favorited_post.html.haml +8 -10
  211. data/app/views/posts/_form.html.haml +40 -0
  212. data/app/views/posts/_menu_item.html.haml +6 -0
  213. data/app/views/posts/_post.html.haml +27 -24
  214. data/app/views/posts/_send_to_friend.html.haml +26 -0
  215. data/app/views/posts/edit.html.haml +11 -48
  216. data/app/views/posts/featured.html.haml +7 -12
  217. data/app/views/posts/index.html.haml +14 -18
  218. data/app/views/posts/manage.html.haml +44 -59
  219. data/app/views/posts/new.html.haml +9 -64
  220. data/app/views/posts/popular.html.haml +25 -30
  221. data/app/views/posts/preview.html.haml +27 -26
  222. data/app/views/posts/recent.html.haml +20 -27
  223. data/app/views/posts/send_to_friend.js.erb +3 -0
  224. data/app/views/posts/show.html.haml +67 -76
  225. data/app/views/rsvps/_form.html.haml +3 -0
  226. data/app/views/rsvps/edit.html.haml +3 -9
  227. data/app/views/rsvps/new.html.haml +3 -9
  228. data/app/views/sb_posts/_dummy_forum_post.html.haml +13 -0
  229. data/app/views/sb_posts/_edit.html.haml +6 -0
  230. data/app/views/sb_posts/_edit_script.js.erb +14 -0
  231. data/app/views/sb_posts/_reply_form.html.haml +14 -35
  232. data/app/views/sb_posts/_reply_script.js.erb +13 -0
  233. data/app/views/sb_posts/_sb_post.html.haml +31 -33
  234. data/app/views/sb_posts/create.js.erb +30 -0
  235. data/app/views/sb_posts/destroy.js.erb +2 -0
  236. data/app/views/sb_posts/edit.html.erb +4 -4
  237. data/app/views/sb_posts/edit.js.erb +14 -0
  238. data/app/views/sb_posts/index.html.haml +3 -16
  239. data/app/views/sb_posts/monitored.html.erb +3 -9
  240. data/app/views/sb_posts/update.js.erb +11 -0
  241. data/app/views/sessions/_menu_item.html.haml +28 -0
  242. data/app/views/sessions/new.html.haml +19 -24
  243. data/app/views/shared/_add_friend_link.html.haml +9 -0
  244. data/app/views/shared/_admin_nav.html.haml +6 -8
  245. data/app/views/shared/_contact.html.haml +1 -1
  246. data/app/views/shared/_end_javascript.html.haml +4 -4
  247. data/app/views/shared/_explore.html.haml +7 -6
  248. data/app/views/shared/_footer_content.html.haml +12 -10
  249. data/app/views/shared/_footer_links.html.haml +18 -0
  250. data/app/views/shared/_friend_link.html.haml +25 -0
  251. data/app/views/shared/_header.html.haml +22 -42
  252. data/app/views/shared/_jumbotron.html.haml +3 -0
  253. data/app/views/shared/_load_tinymce.js.erb +15 -0
  254. data/app/views/shared/_location_chooser.html.haml +26 -17
  255. data/app/views/shared/_login_sidebar.html.haml +6 -5
  256. data/app/views/shared/_messages.html.haml +6 -8
  257. data/app/views/shared/_scripts_and_styles.html.haml +1 -2
  258. data/app/views/shared/_sidebar.html.haml +1 -0
  259. data/app/views/shared/_tag_auto_complete.html.haml +19 -0
  260. data/app/views/shared/_widget.html.haml +3 -0
  261. data/app/views/sitemap/index.html.haml +15 -20
  262. data/app/views/statistics/index.html.haml +32 -40
  263. data/app/views/tags/edit.html.haml +12 -19
  264. data/app/views/tags/index.html.haml +16 -25
  265. data/app/views/tags/manage.html.haml +24 -33
  266. data/app/views/tags/show.html.haml +52 -58
  267. data/app/views/topics/_form.html.haml +23 -25
  268. data/app/views/topics/_recent_topics_sidebar.haml +1 -1
  269. data/app/views/topics/edit.html.haml +7 -9
  270. data/app/views/topics/new.html.haml +6 -21
  271. data/app/views/topics/show.html.haml +48 -106
  272. data/app/views/user_notifier/follow_up_comment_notice.text.erb +1 -1
  273. data/app/views/user_notifier/message_notification.text.erb +1 -1
  274. data/app/views/user_notifier/new_forum_post_notice.text.erb +1 -1
  275. data/app/views/users/_dashboard_nav.html.haml +36 -39
  276. data/app/views/users/_menu_item.html.haml +6 -0
  277. data/app/views/users/_omniauth_connect.html.haml +4 -4
  278. data/app/views/users/_profile_completeness.html.haml +3 -3
  279. data/app/views/users/_profile_user_info_sidebar.html.haml +40 -43
  280. data/app/views/users/_search_options.html.haml +9 -7
  281. data/app/views/users/_sidebar_user.html.haml +1 -1
  282. data/app/views/users/_user.html.haml +27 -28
  283. data/app/views/users/crop_profile_photo.html.haml +30 -37
  284. data/app/views/users/dashboard.html.haml +37 -41
  285. data/app/views/users/edit.html.haml +53 -71
  286. data/app/views/users/edit_account.html.haml +44 -64
  287. data/app/views/users/forgot_username.html.haml +6 -12
  288. data/app/views/users/index.html.haml +4 -14
  289. data/app/views/users/invite.html.haml +14 -25
  290. data/app/views/users/new.html.haml +27 -48
  291. data/app/views/users/resend_activation.html.haml +7 -12
  292. data/app/views/users/show.html.haml +88 -90
  293. data/app/views/users/signup_completed.html.haml +7 -7
  294. data/app/views/users/statistics.html.haml +17 -18
  295. data/app/views/users/update.js.erb +1 -0
  296. data/app/views/users/upload_profile_photo.html.haml +10 -15
  297. data/app/views/users/welcome_about.html.haml +54 -61
  298. data/app/views/users/welcome_invite.html.haml +16 -25
  299. data/app/views/users/welcome_photo.html.haml +18 -27
  300. data/app/views/votes/create.js.erb +5 -0
  301. data/community_engine.gemspec +49 -41
  302. data/config/application_config.rb +13 -16
  303. data/config/initializers/mce_options.rb +9 -32
  304. data/config/initializers/recaptcha_constants.rb +2 -2
  305. data/config/locales/de-DE.yml +1 -17
  306. data/config/locales/en.yml +18 -32
  307. data/config/locales/es-AR.yml +2 -14
  308. data/config/locales/es-ES.yml +0 -6
  309. data/config/locales/es-MX.yml +1 -9
  310. data/config/locales/fr-FR.yml +3 -17
  311. data/config/locales/ja-JP.yml +2 -18
  312. data/config/locales/ru-RU.yml +3 -21
  313. data/config/locales/sr-CP.yml +0 -4
  314. data/config/locales/sv-SE.yml +3 -20
  315. data/config/routes.rb +37 -42
  316. data/db/migrate/016_add_metro_areas.rb +2 -2
  317. data/db/migrate/039_create_activities_table.rb +2 -2
  318. data/db/migrate/056_create_roles.rb +8 -6
  319. data/db/migrate/069_create_pages.rb +3 -3
  320. data/db/migrate/081_upgrade_to_friendly_id_5x.rb +25 -0
  321. data/db/migrate/082_upgrade_to_acts_as_commentable_4x.rb +29 -0
  322. data/lib/activity_tracker.rb +3 -0
  323. data/{vendor/plugins/activity_tracker/lib → lib/activity_tracker}/activity.rb +6 -6
  324. data/{vendor/plugins/activity_tracker/lib → lib/activity_tracker}/activity_tracker.rb +0 -0
  325. data/{vendor/plugins/acts_as_publishable/init.rb → lib/acts_as_publishable.rb} +1 -1
  326. data/{vendor/plugins/acts_as_publishable/lib → lib/acts_as_publishable}/acts_as_publishable.rb +3 -3
  327. data/lib/community_engine.rb +31 -9
  328. data/lib/community_engine/engine.rb +17 -1
  329. data/lib/community_engine/engines_extensions.rb +1 -3
  330. data/lib/community_engine/version.rb +3 -3
  331. data/{config/initializers → lib/paperclip_processors}/cropper.rb +3 -3
  332. data/lib/resource_feeder.rb +3 -0
  333. data/{vendor/plugins/resource_feeder/lib → lib}/resource_feeder/atom.rb +0 -0
  334. data/{vendor/plugins/resource_feeder/lib → lib}/resource_feeder/rss.rb +0 -0
  335. data/{vendor/plugins/white_list/init.rb → lib/white_list.rb} +1 -1
  336. data/{vendor/plugins/white_list/lib → lib/white_list}/white_list_helper.rb +0 -0
  337. data/test/fixtures/messages.yml +2 -2
  338. data/test/functional/admin_controller_test.rb +11 -11
  339. data/test/functional/ads_controller_test.rb +11 -11
  340. data/test/functional/albums_controller_test.rb +4 -4
  341. data/test/functional/categories_controller_test.rb +4 -4
  342. data/test/functional/clippings_controller_test.rb +4 -4
  343. data/test/functional/comments_controller_test.rb +20 -16
  344. data/test/functional/events_controller_test.rb +6 -6
  345. data/test/functional/forums_controller_test.rb +8 -8
  346. data/test/functional/friendships_controller_test.rb +13 -18
  347. data/test/functional/homepage_features_controller_test.rb +5 -5
  348. data/test/functional/messages_controller_test.rb +6 -2
  349. data/test/functional/metro_areas_controller_test.rb +7 -7
  350. data/test/functional/moderators_controller_test.rb +1 -1
  351. data/test/functional/pages_controller_test.rb +2 -2
  352. data/test/functional/password_reset_controller_test.rb +2 -2
  353. data/test/functional/photos_controller_test.rb +16 -15
  354. data/test/functional/posts_controller_test.rb +4 -4
  355. data/test/functional/rsvps_controller_test.rb +6 -6
  356. data/test/functional/sb_posts_controller_test.rb +53 -50
  357. data/test/functional/sessions_controller_test.rb +4 -1
  358. data/test/functional/tags_controller_test.rb +1 -1
  359. data/test/functional/topics_controller_test.rb +10 -10
  360. data/test/functional/users_controller_test.rb +32 -19
  361. data/test/functional/votes_controller_test.rb +1 -1
  362. data/test/test_helper.rb +3 -1
  363. data/test/testapp/config/application.rb +1 -9
  364. data/test/testapp/config/environments/development.rb +1 -2
  365. data/test/testapp/config/environments/production.rb +2 -0
  366. data/test/testapp/config/environments/test.rb +1 -2
  367. data/test/testapp/config/initializers/omniauth.rb +3 -3
  368. data/test/testapp/config/initializers/secret_token.rb +1 -0
  369. data/test/testapp/db/schema.rb +143 -152
  370. data/test/unit/category_test.rb +2 -2
  371. data/test/unit/comment_test.rb +64 -53
  372. data/test/unit/event_test.rb +4 -4
  373. data/test/unit/forum_test.rb +1 -1
  374. data/test/unit/message_test.rb +7 -1
  375. data/test/unit/page_test.rb +2 -2
  376. data/test/unit/post_test.rb +47 -47
  377. data/test/unit/sb_post_test.rb +24 -20
  378. data/test/unit/topic_test.rb +7 -6
  379. data/test/unit/user_test.rb +75 -52
  380. data/vendor/assets/javascripts/.gitkeep +0 -0
  381. data/vendor/assets/javascripts/jcrop/jquery.Jcrop.js +1699 -0
  382. data/vendor/assets/javascripts/jcrop/jquery.color.js +661 -0
  383. data/vendor/assets/javascripts/tag-it/tag-it.js +597 -0
  384. data/vendor/assets/stylesheets/.gitkeep +0 -0
  385. data/vendor/assets/stylesheets/jcrop/Jcrop.gif +0 -0
  386. data/vendor/assets/stylesheets/jcrop/jquery.Jcrop.min.css +28 -0
  387. data/vendor/assets/stylesheets/tag-it/tag-it.css +69 -0
  388. data/vendor/assets/stylesheets/tag-it/tagit.ui-zendesk.css +107 -0
  389. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/README +0 -0
  390. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/Rakefile +0 -0
  391. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/generators/publishing/publishing_generator.rb +0 -0
  392. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/generators/publishing/templates/migration.rb +0 -0
  393. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/install.rb +0 -0
  394. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/acts_as_publishable/test/acts_as_publishable_test.rb +0 -0
  395. data/vendor/{plugins/activity_tracker → converted2.3plugins_to_lib_leftovers/acts_as_publishable}/uninstall.rb +0 -0
  396. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/README +0 -0
  397. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/Rakefile +0 -0
  398. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/test/atom_feed_test.rb +0 -0
  399. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/test/rss_feed_test.rb +0 -0
  400. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/resource_feeder/test/test_helper.rb +0 -0
  401. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/white_list/README +0 -0
  402. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/white_list/Rakefile +0 -0
  403. data/vendor/{plugins → converted2.3plugins_to_lib_leftovers}/white_list/test/white_list_test.rb +0 -0
  404. metadata +348 -302
  405. data/app/assets/images/bg_h6btn.gif +0 -0
  406. data/app/assets/images/bg_navbar.gif +0 -0
  407. data/app/assets/images/clearbits/bg_rounded.gif +0 -0
  408. data/app/assets/images/clearbits/comment.gif +0 -0
  409. data/app/assets/images/clearbits/lock.gif +0 -0
  410. data/app/assets/images/clearbits/smile.gif +0 -0
  411. data/app/assets/images/close.gif +0 -0
  412. data/app/assets/images/cropper/marqueeHoriz.gif +0 -0
  413. data/app/assets/images/cropper/marqueeVert.gif +0 -0
  414. data/app/assets/images/feed.png +0 -0
  415. data/app/assets/images/icons/31.png +0 -0
  416. data/app/assets/images/icons/52.png +0 -0
  417. data/app/assets/images/icons/accept.png +0 -0
  418. data/app/assets/images/icons/activity_default.png +0 -0
  419. data/app/assets/images/icons/add.png +0 -0
  420. data/app/assets/images/icons/book.png +0 -0
  421. data/app/assets/images/icons/bullet_arrow_down.png +0 -0
  422. data/app/assets/images/icons/bullet_arrow_down_50.png +0 -0
  423. data/app/assets/images/icons/clipping.png +0 -0
  424. data/app/assets/images/icons/comment.png +0 -0
  425. data/app/assets/images/icons/comments.png +0 -0
  426. data/app/assets/images/icons/date.png +0 -0
  427. data/app/assets/images/icons/delete.png +0 -0
  428. data/app/assets/images/icons/email.png +0 -0
  429. data/app/assets/images/icons/email_edit.png +0 -0
  430. data/app/assets/images/icons/email_go.png +0 -0
  431. data/app/assets/images/icons/email_open.png +0 -0
  432. data/app/assets/images/icons/group_go.png +0 -0
  433. data/app/assets/images/icons/heart.png +0 -0
  434. data/app/assets/images/icons/heart_add.png +0 -0
  435. data/app/assets/images/icons/heart_off.png +0 -0
  436. data/app/assets/images/icons/page_white.png +0 -0
  437. data/app/assets/images/icons/page_white_magnify.png +0 -0
  438. data/app/assets/images/icons/picture.png +0 -0
  439. data/app/assets/images/icons/poll.png +0 -0
  440. data/app/assets/images/icons/post.png +0 -0
  441. data/app/assets/images/icons/printer.png +0 -0
  442. data/app/assets/images/icons/rss.png +0 -0
  443. data/app/assets/images/icons/slides.png +0 -0
  444. data/app/assets/images/icons/tag_blue.png +0 -0
  445. data/app/assets/images/icons/user.png +0 -0
  446. data/app/assets/images/icons/user_add.png +0 -0
  447. data/app/assets/images/icons/user_edit.png +0 -0
  448. data/app/assets/images/icons/user_go.png +0 -0
  449. data/app/assets/images/icons/vote.png +0 -0
  450. data/app/assets/images/icons/world.png +0 -0
  451. data/app/assets/images/icons/wrench.png +0 -0
  452. data/app/assets/images/logo.gif +0 -0
  453. data/app/assets/images/reply_background.png +0 -0
  454. data/app/assets/images/search.gif +0 -0
  455. data/app/assets/images/thumb.gif +0 -0
  456. data/app/assets/javascripts/builder.js +0 -136
  457. data/app/assets/javascripts/calendarview.js +0 -839
  458. data/app/assets/javascripts/lightbox.js +0 -151
  459. data/app/assets/javascripts/prototip-min.js +0 -27
  460. data/app/assets/javascripts/rails.js +0 -202
  461. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/css/advimage.css +0 -84
  462. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/editor_plugin.js +0 -52
  463. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/editor_plugin_src.js +0 -45
  464. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/image.htm +0 -180
  465. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/img/sample.gif +0 -0
  466. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/js/functions.js +0 -508
  467. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/langs/en.js +0 -3
  468. data/app/assets/javascripts/tinymce/plugins/curblyadvimage/langs/en_dlg.js +0 -43
  469. data/app/assets/javascripts/tinymce/plugins/tinyautosave/editor_plugin.js +0 -8
  470. data/app/assets/javascripts/tinymce/plugins/tinyautosave/editor_plugin_src.js +0 -1001
  471. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress.gif +0 -0
  472. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress10.gif +0 -0
  473. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress11.gif +0 -0
  474. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress12.gif +0 -0
  475. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress2.gif +0 -0
  476. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress3.gif +0 -0
  477. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress4.gif +0 -0
  478. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress5.gif +0 -0
  479. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress6.gif +0 -0
  480. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress7.gif +0 -0
  481. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress8.gif +0 -0
  482. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/progress9.gif +0 -0
  483. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/restore.gif +0 -0
  484. data/app/assets/javascripts/tinymce/plugins/tinyautosave/images/restore.png +0 -0
  485. data/app/assets/javascripts/tinymce/plugins/tinyautosave/langs/da.js +0 -5
  486. data/app/assets/javascripts/tinymce/plugins/tinyautosave/langs/en.js +0 -5
  487. data/app/assets/stylesheets/community_engine.css +0 -6
  488. data/app/assets/stylesheets/forum.css +0 -605
  489. data/app/assets/stylesheets/prototip.css +0 -73
  490. data/app/assets/stylesheets/reset-fonts-grids.css +0 -8
  491. data/app/assets/stylesheets/screen.css +0 -977
  492. data/app/helpers/monitorships_helper.rb +0 -2
  493. data/app/views/activities/_icon.html.haml +0 -14
  494. data/app/views/activities/destroy.js.rjs +0 -1
  495. data/app/views/clippings/_meta.html.haml +0 -26
  496. data/app/views/clippings/load_images_from_uri.js.rjs +0 -1
  497. data/app/views/comments/create.js.rjs +0 -20
  498. data/app/views/comments/edit.js.rjs +0 -7
  499. data/app/views/comments/update.js.rjs +0 -9
  500. data/app/views/favorites/create.js.rjs +0 -17
  501. data/app/views/favorites/destroy.js.rjs +0 -14
  502. data/app/views/favorites/show.html.haml +0 -13
  503. data/app/views/friendships/_friendships.html.erb +0 -14
  504. data/app/views/friendships/index.html.erb +0 -3
  505. data/app/views/friendships/index.xml.builder +0 -29
  506. data/app/views/invitations/index.html.erb +0 -16
  507. data/app/views/moderators/_toggle.html.erb +0 -14
  508. data/app/views/moderators/create.js.rjs +0 -5
  509. data/app/views/moderators/destroy.js.rjs +0 -1
  510. data/app/views/monitorships/create.js.rjs +0 -4
  511. data/app/views/monitorships/destroy.js.rjs +0 -4
  512. data/app/views/photos/manage_photos.js.rjs +0 -5
  513. data/app/views/polls/_polls_sidebar.html.haml +0 -8
  514. data/app/views/posts/_send_to_friend.html.erb +0 -29
  515. data/app/views/sb_posts/_dummy_forum_post.html.erb +0 -13
  516. data/app/views/sb_posts/_edit.html.erb +0 -31
  517. data/app/views/sb_posts/create.js.rjs +0 -16
  518. data/app/views/sb_posts/edit.js.rjs +0 -6
  519. data/app/views/sb_posts/update.js.rjs +0 -5
  520. data/app/views/shared/_user_menu.html.haml +0 -21
  521. data/app/views/votes/create.js.rjs +0 -6
  522. data/db/migrate/090_add_comment_role.rb +0 -15
  523. data/vendor/plugins/activity_tracker/README +0 -4
  524. data/vendor/plugins/activity_tracker/Rakefile +0 -22
  525. data/vendor/plugins/activity_tracker/generators/activity_migration/USAGE +0 -13
  526. data/vendor/plugins/activity_tracker/generators/activity_migration/activity_migration_generator.rb +0 -11
  527. data/vendor/plugins/activity_tracker/generators/activity_migration/templates/migration.rb +0 -17
  528. data/vendor/plugins/activity_tracker/init.rb +0 -1
  529. data/vendor/plugins/activity_tracker/install.rb +0 -1
  530. data/vendor/plugins/activity_tracker/tasks/activity_tracker_tasks.rake +0 -4
  531. data/vendor/plugins/activity_tracker/test/abstract_unit.rb +0 -47
  532. data/vendor/plugins/activity_tracker/test/activity_tracker_test.rb +0 -48
  533. data/vendor/plugins/activity_tracker/test/database.yml +0 -18
  534. data/vendor/plugins/activity_tracker/test/debug.log +0 -3329
  535. data/vendor/plugins/activity_tracker/test/fixtures/test_post.rb +0 -5
  536. data/vendor/plugins/activity_tracker/test/fixtures/test_posts.yml +0 -3
  537. data/vendor/plugins/activity_tracker/test/fixtures/test_user.rb +0 -4
  538. data/vendor/plugins/activity_tracker/test/fixtures/test_users.yml +0 -6
  539. data/vendor/plugins/activity_tracker/test/schema.rb +0 -21
  540. data/vendor/plugins/acts_as_list/README +0 -23
  541. data/vendor/plugins/acts_as_list/init.rb +0 -3
  542. data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +0 -256
  543. data/vendor/plugins/acts_as_list/test/list_test.rb +0 -332
  544. data/vendor/plugins/acts_as_publishable/uninstall.rb +0 -1
  545. data/vendor/plugins/auto_complete/README +0 -23
  546. data/vendor/plugins/auto_complete/Rakefile +0 -22
  547. data/vendor/plugins/auto_complete/init.rb +0 -2
  548. data/vendor/plugins/auto_complete/lib/auto_complete.rb +0 -47
  549. data/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb +0 -143
  550. data/vendor/plugins/auto_complete/test/auto_complete_test.rb +0 -67
  551. data/vendor/plugins/enumerations_mixin/.gitignore +0 -1
  552. data/vendor/plugins/enumerations_mixin/Gemfile +0 -1
  553. data/vendor/plugins/enumerations_mixin/LICENSE +0 -20
  554. data/vendor/plugins/enumerations_mixin/README.md +0 -120
  555. data/vendor/plugins/enumerations_mixin/README_ENUMERATIONS +0 -163
  556. data/vendor/plugins/enumerations_mixin/Rakefile +0 -14
  557. data/vendor/plugins/enumerations_mixin/VERSION +0 -1
  558. data/vendor/plugins/enumerations_mixin/enumerations_mixin.gemspec +0 -44
  559. data/vendor/plugins/enumerations_mixin/examples/virtual_enumerations_sample.rb +0 -76
  560. data/vendor/plugins/enumerations_mixin/init.rb +0 -21
  561. data/vendor/plugins/enumerations_mixin/lib/active_record/acts/enumerated.rb +0 -180
  562. data/vendor/plugins/enumerations_mixin/lib/active_record/aggregations/has_enumerated.rb +0 -60
  563. data/vendor/plugins/enumerations_mixin/lib/active_record/virtual_enumerations.rb +0 -68
  564. data/vendor/plugins/enumerations_mixin/lib/enumerations_mixin.rb +0 -12
  565. data/vendor/plugins/enumerations_mixin/virtual_enumerations_sample.rb +0 -76
  566. data/vendor/plugins/prototype_legacy_helper/README.markdown +0 -13
  567. data/vendor/plugins/prototype_legacy_helper/init.rb +0 -1
  568. data/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +0 -432
  569. data/vendor/plugins/prototype_legacy_helper/test/test_prototype_helper.rb +0 -297
  570. data/vendor/plugins/resource_feeder/init.rb +0 -2
  571. data/vendor/plugins/resource_feeder/lib/resource_feeder.rb +0 -2
  572. data/vendor/plugins/respond_to_parent/MIT-LICENSE +0 -20
  573. data/vendor/plugins/respond_to_parent/README +0 -47
  574. data/vendor/plugins/respond_to_parent/Rakefile +0 -22
  575. data/vendor/plugins/respond_to_parent/init.rb +0 -1
  576. data/vendor/plugins/respond_to_parent/install.rb +0 -1
  577. data/vendor/plugins/respond_to_parent/lib/responds_to_parent.rb +0 -70
  578. data/vendor/plugins/respond_to_parent/test/responds_to_parent_test.rb +0 -10
  579. data/vendor/plugins/respond_to_parent/test/test_helper.rb +0 -6
  580. data/vendor/plugins/respond_to_parent/uninstall.rb +0 -1
@@ -15,7 +15,7 @@ class MessageThread < ActiveRecord::Base
15
15
  end
16
16
 
17
17
  def self.for(message, user)
18
- find(:first, :conditions => {:parent_message_id => (message.parent_id || message.id), :recipient_id => user.id})
18
+ where(:parent_message_id => (message.parent_id || message.id), :recipient_id => user.id).first
19
19
  end
20
20
 
21
21
  def mark_messages_deleted
@@ -3,8 +3,6 @@ class MetroArea < ActiveRecord::Base
3
3
  belongs_to :state
4
4
  belongs_to :country
5
5
 
6
- attr_accessible :name, :state, :country_id, :state_id
7
-
8
6
  #validates_presence_of :state, :if => Proc.new { |user| user.country.eql?(Country.get(:us)) }
9
7
  validates_presence_of :country_id
10
8
  validates_presence_of :name
@@ -2,8 +2,6 @@ class Page < ActiveRecord::Base
2
2
  acts_as_publishable :live, :draft, :members_only, :public
3
3
  validates_presence_of :title, :body
4
4
 
5
- attr_accessible :title, :body, :published_as, :page_public
6
-
7
5
  def to_param
8
6
  id.to_s << "-" << (title ? title.parameterize : '')
9
7
  end
@@ -5,9 +5,9 @@ class Photo < ActiveRecord::Base
5
5
  belongs_to :album
6
6
 
7
7
  has_attached_file :photo, configatron.photo.paperclip_options.to_hash
8
- validates_attachment_presence :photo, :unless => Proc.new{|record| record.photo_remote_url }, :message => :photo_presence_error.l
9
- validates_attachment_content_type :photo, :content_type => configatron.photo.validation_options.content_type, :message => :photo_content_type_error.l
10
- validates_attachment_size :photo, :less_than => configatron.photo.validation_options.max_size.to_i.megabytes, :message => :photo_size_limit_error.l(:count => configatron.photo.validation_options.max_size)
8
+ validates_attachment_presence :photo, :unless => Proc.new{|record| record.photo_remote_url }
9
+ validates_attachment_content_type :photo, :content_type => configatron.photo.validation_options.content_type
10
+ validates_attachment_size :photo, :less_than => configatron.photo.validation_options.max_size.to_i.megabytes
11
11
 
12
12
  attr_accessor :crop_x, :crop_y, :crop_w, :crop_h, :photo_remote_url
13
13
  after_update :reprocess_photo, :if => :cropping?
@@ -22,9 +22,8 @@ class Photo < ActiveRecord::Base
22
22
  has_one :user_as_avatar, :class_name => "User", :foreign_key => "avatar_id", :inverse_of => :avatar
23
23
 
24
24
  #Named scopes
25
- scope :recent, :order => "photos.created_at DESC"
26
- scope :new_this_week, :order => "photos.created_at DESC", :conditions => ["photos.created_at > ?", 7.days.ago.iso8601]
27
- attr_accessible :name, :description, :photo, :photo_remote_url, :crop_x, :crop_y, :crop_w, :crop_h, :user_id, :album_id
25
+ scope :recent, lambda { order("photos.created_at DESC") }
26
+ scope :new_this_week, lambda { order("photos.created_at DESC").where("photos.created_at > ?", 7.days.ago.iso8601) }
28
27
 
29
28
  def display_name
30
29
  (self.name && self.name.length>0) ? self.name : "#{:created_at.l.downcase}: #{I18n.l(self.created_at, :format => :published_date)}"
@@ -56,7 +55,7 @@ class Photo < ActiveRecord::Base
56
55
 
57
56
 
58
57
  def self.find_recent(options = {:limit => 3})
59
- self.new_this_week.find(:all, :limit => options[:limit])
58
+ self.new_this_week.limit(options[:limit])
60
59
  end
61
60
 
62
61
  def self.find_related_to(photo, options = {})
@@ -84,7 +83,8 @@ class Photo < ActiveRecord::Base
84
83
  private
85
84
 
86
85
  def reprocess_photo
87
- photo.reprocess!
86
+ photo.assign(photo)
87
+ photo.save
88
88
  end
89
89
 
90
90
  end
@@ -4,7 +4,6 @@ class Poll < ActiveRecord::Base
4
4
  validates_presence_of :post
5
5
  has_many :votes, :dependent => :destroy
6
6
  belongs_to :post
7
- attr_accessible :question, :post_id, :post
8
7
 
9
8
  def voted?(user)
10
9
  !self.votes.find_by_user_id(user.id).nil?
@@ -19,22 +18,21 @@ class Poll < ActiveRecord::Base
19
18
 
20
19
  def self.find_recent(options = {})
21
20
  options.reverse_merge! :limit => 5
22
- find(:all, :order => "polls.created_at desc", :limit => options[:limit], :include => [:post => :user])
21
+ self.includes(:post => :user).order("polls.created_at desc").limit(options[:limit])
23
22
  end
24
23
 
25
24
  def self.find_popular(options = {})
26
25
  options.reverse_merge! :limit => 5, :since => 10.days.ago
27
-
28
- find(:all, :order => "polls.votes_count desc",
29
- :limit => options[:limit],
30
- :include => [:post => :user],
31
- :conditions => ["polls.created_at > ?", options[:since]]
32
- )
26
+
27
+ self.includes(:post => :user)
28
+ .where("polls.created_at > ?", options[:since])
29
+ .order("polls.votes_count desc")
30
+ .limit(options[:limit])
33
31
  end
34
32
 
35
33
  def self.find_popular_in_category(category, options = {})
36
34
  options.reverse_merge! :limit => 5
37
- self.includes(:post).order('polls.votes_count desc').limit(options[:limit]).where('posts.category_id = ?', category.id)
35
+ self.includes(:post).order('polls.votes_count desc').where('posts.category_id = ?', category.id).references(:posts).limit(options[:limit])
38
36
  end
39
37
 
40
38
  end
@@ -1,7 +1,6 @@
1
1
  class Post < ActiveRecord::Base
2
2
  include Rakismet::Model
3
3
  rakismet_attrs :comment_type => 'post'
4
- attr_protected :akismet_attrs
5
4
 
6
5
  acts_as_moderated_commentable
7
6
 
@@ -33,14 +32,12 @@ class Post < ActiveRecord::Base
33
32
 
34
33
  attr_accessor :invalid_emails
35
34
 
36
- attr_accessible :category_id, :title, :raw_post, :published_as, :send_comment_notifications
37
-
38
35
  # Class Methods
39
36
  class << self
40
37
 
41
38
  # Scopes
42
39
  def by_featured_writers
43
- where("users.featured_writer = ?", true).includes(:user)
40
+ includes(:user).where("users.featured_writer = ?", true).references(:users)
44
41
  end
45
42
  def popular
46
43
  order('posts.view_count DESC')
@@ -62,28 +59,27 @@ class Post < ActiveRecord::Base
62
59
  end
63
60
 
64
61
  def find_recent(options = {:limit => 5})
65
- recent.find :all, options
62
+ recent.limit(options[:limit])
66
63
  end
67
64
 
68
65
  def find_popular(options = {} )
69
66
  options.reverse_merge! :limit => 5, :since => 7.days
70
67
 
71
- self.popular.since(options[:since]).limit(options[:limit]).all
68
+ self.popular.since(options[:since]).limit(options[:limit])
72
69
  end
73
70
 
74
71
  def find_featured(options = {:limit => 10})
75
- self.recent.by_featured_writers.limit(options[:limit]).all
72
+ self.recent.by_featured_writers.limit(options[:limit])
76
73
  end
77
74
 
78
75
  def find_most_commented(limit = 10, since = 7.days.ago)
79
- Post.find(:all,
80
- :select => 'posts.*, count(*) as comments_count',
81
- :joins => "LEFT JOIN comments ON comments.commentable_id = posts.id",
82
- :conditions => ['comments.commentable_type = ? AND posts.published_at > ?', 'Post', since],
83
- :group => self.columns.map{|column| self.table_name + "." + column.name}.join(","),
84
- :order => 'comments_count DESC',
85
- :limit => limit
86
- )
76
+ Post.select('posts.*', 'count(*) as comments_count')
77
+ .joins("LEFT JOIN comments ON comments.commentable_id = posts.id")
78
+ .where('comments.commentable_type = ? AND posts.published_at > ?', 'Post', since)
79
+ .references('comments')
80
+ .group(self.columns.map{|column| self.table_name + "." + column.name}.join(","))
81
+ .order('comments_count DESC')
82
+ .limit(limit)
87
83
  end
88
84
 
89
85
  def new_from_bookmarklet(params)
@@ -1,6 +1,5 @@
1
1
  class Role < ActiveRecord::Base
2
2
  acts_as_enumerated
3
- validates_presence_of :name
4
- attr_accessible :name
3
+ validates_presence_of :name
5
4
  end
6
5
 
@@ -9,9 +9,6 @@ class Rsvp < ActiveRecord::Base
9
9
  belongs_to :user
10
10
  belongs_to :event
11
11
 
12
- attr_protected :user_id
13
- attr_protected :event_id
14
-
15
12
  private
16
13
 
17
14
  def event_allows_rsvp
@@ -10,11 +10,13 @@ class SbPost < ActiveRecord::Base
10
10
  format_attribute :body
11
11
  before_create { |r| r.forum_id = r.topic.forum_id }
12
12
  after_create { |r|
13
- Topic.update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', r.created_at, r.user_id, r.id], ['id = ?', r.topic_id])
13
+ Topic.where('id = ?', r.topic_id)
14
+ .update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', r.created_at, r.user_id, r.id])
15
+
14
16
  }
15
17
  after_destroy { |r|
16
18
  t = Topic.find(r.topic_id)
17
- Topic.update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', t.sb_posts.recent.last.created_at, t.sb_posts.recent.last.user_id, t.sb_posts.recent.last.id], ['id = ?', t.id]) if t.sb_posts.recent.last
19
+ Topic.where('id = ?', t.id).update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', t.sb_posts.recent.last.created_at, t.sb_posts.recent.last.user_id, t.sb_posts.recent.last.id]) if t.sb_posts.recent.last
18
20
  }
19
21
 
20
22
  validates_presence_of :user_id, :unless => Proc.new{|record| configatron.allow_anonymous_forum_posting }
@@ -23,18 +25,21 @@ class SbPost < ActiveRecord::Base
23
25
  validates_presence_of :author_ip, :unless => Proc.new{|record| record.user} #log ip unless logged in
24
26
 
25
27
  validates_presence_of :body, :topic
26
-
27
- attr_accessible :body, :author_email, :author_ip, :author_name, :author_url, :topic, :user_id
28
+
28
29
  after_create :monitor_topic
29
30
  after_create :notify_monitoring_users
30
31
 
31
- scope :with_query_options, :select => 'sb_posts.*, topics.title as topic_title, forums.name as forum_name', :joins => 'inner join topics on sb_posts.topic_id = topics.id inner join forums on topics.forum_id = forums.id', :order => 'sb_posts.created_at desc'
32
- scope :recent, :order => 'sb_posts.created_at ASC'
32
+ scope :with_query_options, lambda {
33
+ select('sb_posts.*, topics.title as topic_title, forums.name as forum_name')
34
+ .joins('inner join topics on sb_posts.topic_id = topics.id inner join forums on topics.forum_id = forums.id')
35
+ .order('sb_posts.created_at desc')
36
+ }
37
+ scope :recent, -> { order('sb_posts.created_at ASC') }
33
38
  validate :check_spam
34
39
 
35
40
  def monitor_topic
36
41
  return unless user
37
- monitorship = Monitorship.find_or_initialize_by_user_id_and_topic_id(self.user.id, self.topic.id)
42
+ monitorship = Monitorship.where(:user_id => self.user.id, :topic_id => self.topic.id).first_or_initialize
38
43
  if monitorship.new_record?
39
44
  monitorship.update_attribute :active, true
40
45
  end
@@ -53,8 +58,8 @@ class SbPost < ActiveRecord::Base
53
58
  end
54
59
 
55
60
  def check_spam
56
- if !configatron.akismet_key.nil? && self.spam?
57
- self.errors.add(:base, :comment_spam_error.l)
61
+ if configatron.has_key?(:akismet_key) && self.spam?
62
+ self.errors.add(:base, :comment_spam_error.l)
58
63
  end
59
64
  end
60
65
 
@@ -1,6 +1,4 @@
1
1
  class State < ActiveRecord::Base
2
2
  has_many :metro_areas
3
3
  # belongs_to :country
4
-
5
- attr_accessible :name
6
4
  end
@@ -5,7 +5,7 @@ class Topic < ActiveRecord::Base
5
5
  belongs_to :forum, :counter_cache => true
6
6
  belongs_to :user
7
7
  has_many :monitorships
8
- has_many :monitors, :through => :monitorships, :conditions => ['monitorships.active = ?', true], :source => :user
8
+ has_many :monitors, -> { where('monitorships.active = ?', true) }, :through => :monitorships, :source => :user
9
9
 
10
10
  has_many :sb_posts, :dependent => :destroy, :inverse_of => :topic
11
11
 
@@ -17,9 +17,8 @@ class Topic < ActiveRecord::Base
17
17
  after_create :create_monitorship_for_owner
18
18
 
19
19
  accepts_nested_attributes_for :sb_posts
20
- attr_accessible :title, :sticky, :locked, :sb_posts_attributes, :forum_id, :user_id
21
-
22
- scope :recently_replied, order('replied_at DESC')
20
+
21
+ scope :recently_replied, -> {order('replied_at DESC')}
23
22
 
24
23
  def notify_of_new_post(post)
25
24
  monitorships.each do |m|
@@ -64,11 +63,11 @@ class Topic < ActiveRecord::Base
64
63
  end
65
64
 
66
65
  def set_post_topic_id
67
- SbPost.update_all ['forum_id = ?', forum_id], ['topic_id = ?', id]
66
+ SbPost.where('topic_id = ?', id).update_all(['forum_id = ?', forum_id])
68
67
  end
69
68
 
70
69
  def create_monitorship_for_owner
71
- monitorship = Monitorship.find_or_initialize_by_user_id_and_topic_id(user.id, self.id)
70
+ monitorship = Monitorship.find_or_initialize_by(:user_id => user.id, :topic_id => self.id)
72
71
  monitorship.update_attribute :active, true
73
72
  end
74
73
  end
@@ -2,15 +2,15 @@ require 'digest/sha1'
2
2
  require 'bcrypt'
3
3
 
4
4
  class User < ActiveRecord::Base
5
+ extend FriendlyId
5
6
  include UrlUpload
6
7
  include FacebookProfile
7
8
  include TwitterProfile
8
9
 
9
10
  include Rakismet::Model
10
11
  rakismet_attrs :author => :login, :comment_type => 'registration', :content => :description, :user_ip => :last_login_ip, :author_email => :email
11
- attr_protected :admin, :featured, :role_id, :akismet_attrs
12
12
 
13
- has_friendly_id :login, :use_slug => true, :cache_column => 'login_slug'
13
+ friendly_id :login, :use => [:slugged, :finders], :slug_column => 'login_slug'
14
14
 
15
15
  MALE = 'M'
16
16
  FEMALE = 'F'
@@ -20,15 +20,15 @@ class User < ActiveRecord::Base
20
20
  c.transition_from_crypto_providers = CommunityEngineSha1CryptoMethod
21
21
  c.crypto_provider = Authlogic::CryptoProviders::BCrypt
22
22
 
23
- c.validates_length_of_password_field_options = { :within => 6..20, :if => :password_required? }
24
- c.validates_length_of_password_confirmation_field_options = { :within => 6..20, :if => :password_required? }
23
+ c.validates_length_of_password_field_options = { :within => configatron.authlogic.password_length, :if => :password_required? }
24
+ c.validates_length_of_password_confirmation_field_options = { :within => configatron.authlogic.password_length, :if => :password_required? }
25
25
 
26
- c.validates_length_of_login_field_options = { :minimum => 5, :unless => :omniauthed? }
26
+ c.validates_length_of_login_field_options = { :within => configatron.authlogic.login_length, :unless => :omniauthed? }
27
27
  c.validates_format_of_login_field_options = { :with => configatron.regexes.login, :unless => :omniauthed? }
28
28
 
29
- c.validates_length_of_email_field_options = { :within => 3..100, :if => :email_required? }
29
+ c.validates_length_of_email_field_options = { :within => configatron.authlogic.email_length, :if => :email_required? }
30
30
  c.validates_format_of_email_field_options = { :with => configatron.regexes.email, :if => :email_required? }
31
- c.validates_uniqueness_of_email_field_options :case_sensitive => false
31
+ c.validates_uniqueness_of_email_field_options :case_sensitive => configatron.authlogic.email_case_sensitive
32
32
  end
33
33
  rescue StandardError
34
34
  puts 'Failed to initialize AuthLogic'
@@ -57,73 +57,62 @@ class User < ActiveRecord::Base
57
57
 
58
58
  #associations
59
59
  has_many :authorizations, :dependent => :destroy
60
- has_many :posts, :order => "published_at desc", :dependent => :destroy
61
- has_many :photos, :order => "created_at desc", :dependent => :destroy
60
+ has_many :posts, -> {order("published_at desc")}, :dependent => :destroy
61
+ has_many :photos, -> {order("created_at desc")}, :dependent => :destroy
62
62
  has_many :invitations, :dependent => :destroy
63
63
  has_many :rsvps, :dependent => :destroy
64
64
  has_many :albums, :dependent => :destroy
65
65
 
66
66
  #friendship associations
67
67
  has_many :friendships, :class_name => "Friendship", :foreign_key => "user_id", :dependent => :destroy
68
- has_many :accepted_friendships, :class_name => "Friendship", :conditions => ['friendship_status_id = ?', 2]
69
- has_many :pending_friendships, :class_name => "Friendship", :conditions => ['initiator = ? AND friendship_status_id = ?', false, 1]
70
- has_many :friendships_initiated_by_me, :class_name => "Friendship", :foreign_key => "user_id", :conditions => ['initiator = ?', true], :dependent => :destroy
71
- has_many :friendships_not_initiated_by_me, :class_name => "Friendship", :foreign_key => "user_id", :conditions => ['initiator = ?', false], :dependent => :destroy
68
+ has_many :accepted_friendships, -> { where('friendship_status_id = ?', 2) }, :class_name => "Friendship"
69
+ has_many :pending_friendships, -> { where('initiator = ? AND friendship_status_id = ?', false, 1) }, :class_name => "Friendship"
70
+ has_many :friendships_initiated_by_me, -> { where('initiator = ?', true) }, :class_name => "Friendship", :foreign_key => "user_id", :dependent => :destroy
71
+ has_many :friendships_not_initiated_by_me, -> { where('initiator = ?', false) }, :class_name => "Friendship", :foreign_key => "user_id", :dependent => :destroy
72
72
  has_many :occurances_as_friend, :class_name => "Friendship", :foreign_key => "friend_id", :dependent => :destroy
73
73
 
74
74
  #forums
75
75
  has_many :moderatorships, :dependent => :destroy
76
- has_many :forums, :through => :moderatorships, :order => 'forums.name'
76
+ has_many :forums, -> { order("forums.name") }, :through => :moderatorships
77
77
  has_many :sb_posts, :dependent => :destroy
78
78
  has_many :topics, :dependent => :destroy
79
79
  has_many :monitorships, :dependent => :destroy
80
- has_many :monitored_topics, :through => :monitorships, :conditions => ['monitorships.active = ?', true], :order => 'topics.replied_at desc', :source => :topic
80
+ has_many :monitored_topics, -> { where('monitorships.active = ?', true).order('topics.replied_at desc') }, :through => :monitorships, :source => :topic
81
81
 
82
82
  belongs_to :avatar, :class_name => "Photo", :foreign_key => "avatar_id", :inverse_of => :user_as_avatar
83
83
  belongs_to :metro_area, :counter_cache => true
84
84
  belongs_to :state
85
85
  belongs_to :country
86
- has_many :comments_as_author, :class_name => "Comment", :foreign_key => "user_id", :order => "created_at desc", :dependent => :destroy
87
- has_many :comments_as_recipient, :class_name => "Comment", :foreign_key => "recipient_id", :order => "created_at desc", :dependent => :destroy
88
- has_many :clippings, :order => "created_at desc", :dependent => :destroy
89
- has_many :favorites, :order => "created_at desc", :dependent => :destroy
86
+ has_many :comments_as_author, -> { order("created_at desc") }, :class_name => "Comment", :foreign_key => "user_id", :dependent => :destroy
87
+ has_many :comments_as_recipient, -> { order("created_at desc") }, :class_name => "Comment", :foreign_key => "recipient_id", :dependent => :destroy
88
+ has_many :clippings, -> { order("created_at desc") }, :dependent => :destroy
89
+ has_many :favorites, -> { order("created_at desc") }, :dependent => :destroy
90
90
 
91
91
  #messages
92
92
  has_many :all_sent_messages, :class_name => "Message", :foreign_key => "sender_id", :dependent => :destroy
93
- has_many :sent_messages,
93
+ has_many :sent_messages, -> { where("messages.sender_deleted = ?", false).order("messages.created_at DESC") },
94
94
  :class_name => 'Message',
95
- :foreign_key => 'sender_id',
96
- :order => "messages.created_at DESC",
97
- :conditions => ["messages.sender_deleted = ?", false]
95
+ :foreign_key => 'sender_id'
98
96
 
99
- has_many :received_messages,
97
+ has_many :received_messages, -> { where("messages.recipient_deleted = ?", false).order("messages.created_at DESC") },
100
98
  :class_name => 'Message',
101
- :foreign_key => 'recipient_id',
102
- :order => "message.created_at DESC",
103
- :conditions => ["message.recipient_deleted = ?", false]
99
+ :foreign_key => 'recipient_id'
104
100
  has_many :message_threads_as_recipient, :class_name => "MessageThread", :foreign_key => "recipient_id"
105
101
 
106
102
  #named scopes
107
- scope :recent, order('users.created_at DESC')
108
- scope :featured, where(:featured_writer => true)
109
- scope :active, where("users.activated_at IS NOT NULL")
110
- scope :vendors, where(:vendor => true)
103
+ scope :recent, -> {order('users.created_at DESC')}
104
+ scope :featured, -> { where(:featured_writer => true) }
105
+ scope :active, -> {where("users.activated_at IS NOT NULL")}
106
+ scope :vendors, -> {where(:vendor => true)}
111
107
 
112
108
 
113
- accepts_nested_attributes_for :avatar
114
- attr_accessible :avatar_id, :company_name, :country_id, :description, :email,
115
- :firstname, :fullname, :gender, :lastname, :login, :metro_area_id,
116
- :middlename, :notify_comments, :notify_community_news,
117
- :notify_friend_requests, :password, :password_confirmation,
118
- :profile_public, :state_id, :stylesheet, :time_zone, :vendor, :zip, :avatar_attributes, :birthday,
119
- :activated_at, :activation_code
120
-
121
109
  attr_accessor :authorizing_from_omniauth
110
+ accepts_nested_attributes_for :avatar
122
111
 
123
112
  ## Class Methods
124
113
 
125
114
  def self.find_by_login_or_email(string)
126
- self.first(:conditions => ["LOWER(email) = ? OR LOWER(login) = ?", string.downcase, string.downcase])
115
+ self.where("LOWER(email) = ? OR LOWER(login) = ?", string.downcase, string.downcase).first
127
116
  end
128
117
 
129
118
  def self.find_country_and_state_from_search_params(search)
@@ -140,7 +129,7 @@ class User < ActiveRecord::Base
140
129
 
141
130
  states = country ? country.states.sort_by{|s| s.name} : []
142
131
  if states.any?
143
- metro_areas = state ? state.metro_areas.all(:order => "name") : []
132
+ metro_areas = state ? state.metro_areas.order("name") : []
144
133
  else
145
134
  metro_areas = country ? country.metro_areas : []
146
135
  end
@@ -169,13 +158,13 @@ class User < ActiveRecord::Base
169
158
  users = users.where(user[:metro_area_id].eq(search['metro_area_id']))
170
159
  end
171
160
  if search['login']
172
- users = users.where('`users`.login LIKE ?', "%#{search['login']}%")
161
+ users = users.where(user[:login].matches("%#{search['login']}%"))
173
162
  end
174
163
  if search['vendor']
175
164
  users = users.where(user[:vendor].eq(true))
176
165
  end
177
166
  if search['description']
178
- users = users.where('`users`.description LIKE ?', "%#{search['description']}%")
167
+ users = users.where(user[:description].matches("%#{search['description']}%"))
179
168
  end
180
169
  users
181
170
  end
@@ -183,14 +172,12 @@ class User < ActiveRecord::Base
183
172
  def self.find_by_activity(options = {})
184
173
  options.reverse_merge! :limit => 30, :require_avatar => true, :since => 7.days.ago
185
174
 
186
- activities = Activity.since(options[:since]).find(:all,
187
- :select => 'activities.user_id, count(*) as count',
188
- :group => 'activities.user_id',
189
- :conditions => "#{options[:require_avatar] ? ' users.avatar_id IS NOT NULL AND ' : ''} users.activated_at IS NOT NULL",
190
- :order => 'count DESC',
191
- :joins => "LEFT JOIN users ON users.id = activities.user_id",
192
- :limit => options[:limit]
193
- )
175
+ activities = Activity.since(options[:since]).select('activities.user_id, count(*) as count').
176
+ group('activities.user_id').
177
+ where("#{options[:require_avatar] ? ' users.avatar_id IS NOT NULL AND ' : ''} users.activated_at IS NOT NULL").
178
+ order('count DESC').
179
+ joins( "LEFT JOIN users ON users.id = activities.user_id").
180
+ limit(options[:limit])
194
181
  activities.map{|a| find(a.user_id) }
195
182
  end
196
183
 
@@ -214,12 +201,12 @@ class User < ActiveRecord::Base
214
201
  end
215
202
 
216
203
  def self.currently_online
217
- User.find(:all, :conditions => ["sb_last_seen_at > ?", Time.now.utc-5.minutes])
204
+ User.where("sb_last_seen_at > ?", Time.now.utc-5.minutes)
218
205
  end
219
206
 
220
207
  def self.search(query, options = {})
221
208
  with_scope :find => { :conditions => build_search_conditions(query) } do
222
- find :all, options
209
+ where(options)
223
210
  end
224
211
  end
225
212
 
@@ -233,7 +220,7 @@ class User < ActiveRecord::Base
233
220
  ## Instance Methods
234
221
 
235
222
  def moderator_of?(forum)
236
- moderatorships.count(:all, :conditions => ['forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)]) == 1
223
+ moderatorships.where('forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)).count == 1
237
224
  end
238
225
 
239
226
  def monitoring_topic?(topic)
@@ -243,16 +230,16 @@ class User < ActiveRecord::Base
243
230
  def recount_metro_area_users
244
231
  return unless self.metro_area
245
232
  ma = self.metro_area
246
- ma.users_count = User.count(:conditions => ["metro_area_id = ?", ma.id])
233
+ ma.users_count = User.where("metro_area_id = ?", ma.id).count
247
234
  ma.save
248
235
  end
249
236
 
250
237
  def this_months_posts
251
- self.posts.find(:all, :conditions => ["published_at > ?", DateTime.now.to_time.at_beginning_of_month])
238
+ self.posts.where("published_at > ?", DateTime.now.to_time.at_beginning_of_month)
252
239
  end
253
240
 
254
241
  def last_months_posts
255
- self.posts.find(:all, :conditions => ["published_at > ? and published_at < ?", DateTime.now.to_time.at_beginning_of_month.months_ago(1), DateTime.now.to_time.at_beginning_of_month])
242
+ self.posts.where("published_at > ? and published_at < ?", DateTime.now.to_time.at_beginning_of_month.months_ago(1), DateTime.now.to_time.at_beginning_of_month)
256
243
  end
257
244
 
258
245
  def avatar_photo_url(size = :original)
@@ -335,7 +322,7 @@ class User < ActiveRecord::Base
335
322
  end
336
323
 
337
324
  def friendship_exists_with?(friend)
338
- Friendship.find(:first, :conditions => ["user_id = ? AND friend_id = ?", self.id, friend.id])
325
+ Friendship.where("user_id = ? AND friend_id = ?", self.id, friend.id).first
339
326
  end
340
327
 
341
328
  def deliver_signup_notification
@@ -348,7 +335,7 @@ class User < ActiveRecord::Base
348
335
  end
349
336
 
350
337
  def has_reached_daily_friend_request_limit?
351
- friendships_initiated_by_me.count(:conditions => ['created_at > ?', Time.now.beginning_of_day]) >= Friendship.daily_request_limit
338
+ friendships_initiated_by_me.where('created_at > ?', Time.now.beginning_of_day).count >= Friendship.daily_request_limit
352
339
  end
353
340
 
354
341
  def network_activity(page = {}, since = 1.week.ago)
@@ -404,7 +391,7 @@ class User < ActiveRecord::Base
404
391
  end
405
392
 
406
393
  def update_last_seen_at
407
- User.update_all ['sb_last_seen_at = ?', Time.now.utc], ['id = ?', self.id]
394
+ User.where('id = ?', self.id).update_all(['sb_last_seen_at = ?', Time.now.utc])
408
395
  self.sb_last_seen_at = Time.now.utc
409
396
  end
410
397
 
@@ -413,7 +400,7 @@ class User < ActiveRecord::Base
413
400
  end
414
401
 
415
402
  def unread_message_count
416
- message_threads_as_recipient.count(:conditions => ["messages.recipient_id = ? AND messages.recipient_deleted = ? AND read_at IS NULL", self.id, false], :include => :message)
403
+ message_threads_as_recipient.includes(:message).where("messages.recipient_id = ? AND messages.recipient_deleted = ? AND read_at IS NULL", self.id, false).references(:messages).count
417
404
  end
418
405
 
419
406
  def deliver_password_reset_instructions!
@@ -427,7 +414,7 @@ class User < ActiveRecord::Base
427
414
  end
428
415
 
429
416
  def self.find_or_create_from_authorization(auth)
430
- user = User.find_or_initialize_by_email(:email => auth.email)
417
+ user = User.where(:email => auth.email).first_or_initialize
431
418
  user.login ||= auth.nickname
432
419
 
433
420
  if user.new_record?
@@ -446,7 +433,7 @@ class User < ActiveRecord::Base
446
433
  end
447
434
 
448
435
  def check_spam
449
- if !configatron.akismet_key.nil? && self.spam?
436
+ if configatron.has_key?(:akismet_key) && self.spam?
450
437
  self.errors.add(:base, :user_spam_error.l)
451
438
  end
452
439
  end