commontator 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -1
  3. data/app/assets/javascripts/commontator/application.js~ +3 -0
  4. data/app/assets/javascripts/commontator/mentions.js~ +31 -0
  5. data/app/assets/stylesheets/commontator/application.css~ +14 -0
  6. data/app/assets/stylesheets/commontator/threads.css~ +71 -0
  7. data/app/controllers/commontator/comments_controller.rb~ +160 -0
  8. data/app/controllers/commontator/threads_controller.rb~ +75 -0
  9. data/app/mailers/commontator/subscriptions_mailer.rb~ +65 -0
  10. data/app/models/commontator/comment.rb~ +124 -0
  11. data/app/models/commontator/subscription.rb~ +23 -0
  12. data/app/views/commontator/shared/_thread.html.erb~ +21 -0
  13. data/app/views/commontator/subscriptions_mailer/comment_created.html.erb~ +10 -0
  14. data/app/views/commontator/threads/_hide_show.js.erb~ +21 -0
  15. data/app/views/commontator/threads/_hide_show_links.js.erb~ +17 -0
  16. data/app/views/commontator/threads/_show.html.erb~ +118 -0
  17. data/app/views/commontator/threads/_show.js.erb~ +18 -0
  18. data/config/initializers/commontator.rb~ +290 -0
  19. data/config/locales/en.yml~ +101 -0
  20. data/config/locales/ru.yml~ +79 -0
  21. data/config/locales/zh.yml~ +79 -0
  22. data/config/routes.rb~ +25 -0
  23. data/db/migrate/0_install_commontator.rb~ +52 -0
  24. data/db/migrate/1_add_parent_comment_id_to_commontator_comments.rb~ +9 -0
  25. data/lib/commontator.rb~ +145 -0
  26. data/lib/commontator/acts_as_commontable.rb +3 -1
  27. data/lib/commontator/shared_helper.rb~ +26 -0
  28. data/lib/commontator/version.rb +1 -1
  29. data/lib/commontator/version.rb~ +3 -0
  30. data/spec/controllers/commontator/comments_controller_spec.rb~ +612 -0
  31. data/spec/controllers/commontator/subscriptions_controller_spec.rb~ +101 -0
  32. data/spec/controllers/commontator/threads_controller_spec.rb~ +218 -0
  33. data/spec/dummy/README.md~ +3 -0
  34. data/spec/dummy/Rakefile~ +6 -0
  35. data/spec/dummy/app/assets/javascripts/application.js~ +16 -0
  36. data/spec/dummy/app/assets/stylesheets/application.css~ +14 -0
  37. data/spec/dummy/app/controllers/application_controller.rb~ +4 -0
  38. data/spec/dummy/app/controllers/dummy_models_controller.rb~ +23 -0
  39. data/spec/dummy/app/helpers/application_helper.rb~ +15 -0
  40. data/spec/dummy/app/models/dummy_dependent_model.rb +4 -0
  41. data/spec/dummy/app/models/dummy_model.rb~ +3 -0
  42. data/spec/dummy/app/models/dummy_user.rb~ +13 -0
  43. data/spec/dummy/app/views/dummy_models/index.html.erb~ +6 -0
  44. data/spec/dummy/app/views/dummy_models/show.html.erb~ +2 -0
  45. data/spec/dummy/app/views/layouts/application.html.erb~ +14 -0
  46. data/spec/dummy/config.ru~ +4 -0
  47. data/spec/dummy/config/application.rb~ +26 -0
  48. data/spec/dummy/config/boot.rb~ +5 -0
  49. data/spec/dummy/config/database.yml~ +25 -0
  50. data/spec/dummy/config/environment.rb~ +8 -0
  51. data/spec/dummy/config/environments/development.rb~ +31 -0
  52. data/spec/dummy/config/environments/production.rb~ +82 -0
  53. data/spec/dummy/config/environments/test.rb~ +40 -0
  54. data/spec/dummy/config/initializers/backtrace_silencers.rb~ +7 -0
  55. data/spec/dummy/config/initializers/commontator.rb~ +21 -0
  56. data/spec/dummy/config/initializers/filter_parameter_logging.rb~ +4 -0
  57. data/spec/dummy/config/initializers/inflections.rb~ +16 -0
  58. data/spec/dummy/config/initializers/mime_types.rb~ +5 -0
  59. data/spec/dummy/config/initializers/secret_token.rb~ +12 -0
  60. data/spec/dummy/config/initializers/session_store.rb~ +3 -0
  61. data/spec/dummy/config/initializers/wrap_parameters.rb~ +14 -0
  62. data/spec/dummy/config/routes.rb~ +10 -0
  63. data/spec/dummy/db/development.sqlite3 +0 -0
  64. data/spec/dummy/db/migrate/1_create_dummy_models.rb~ +7 -0
  65. data/spec/dummy/db/migrate/2_create_dummy_users.rb~ +7 -0
  66. data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb~ +27 -0
  67. data/spec/dummy/db/migrate/4_create_dummy_dependent_models.rb +7 -0
  68. data/spec/dummy/db/schema.rb +6 -1
  69. data/spec/dummy/db/test.sqlite3 +0 -0
  70. data/spec/dummy/lib/controllers.rb~ +10 -0
  71. data/spec/dummy/log/development.log +6471 -191
  72. data/spec/dummy/log/test.log +121221 -31445
  73. data/spec/dummy/public/404.html~ +26 -0
  74. data/spec/dummy/public/422.html~ +26 -0
  75. data/spec/dummy/public/500.html~ +25 -0
  76. data/spec/dummy/script/rails~ +6 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/-RolHYhJdGiLoPkoWZXQdI9AIWUjMMCa2yFJezCE_Bo.cache +2 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/-STzK7UuGeY3gSvnmTELWLvtRMKpmSAQCEw4ao3b1r8.cache +1 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/3NH8nN7uktAXgA3NqaqXTXDVic3BxBvqCxoLpGGbib4.cache +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/4_iT7KM6P2IT75Rssrk9p4crTBwM8DQWR41gmsxczL0.cache +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/58TLCXvf5bFFYY-mIUXrQNOVWlGsq7qPAoSX2OIIB8Y.cache +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6OQdyrATvNatvWu8Mp1qbuvRx-HLmzCZ5XBGYca-rZU.cache +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6UKCUV-ZLaWCoPMfMB6a2W0RCFPQzPJ6Mz-y67sH7zk.cache +2 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6wKNjFdNd4OHjIpLC0nq1kBWcbYg1aEYrp7ZhWoJlvY.cache +1 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/7Xxb5iYP5elo40JRlhNQB1gLbv3ueELK2rTinYt5xdc.cache +1 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/7twIKlS6VYCyLlwhsQg2vu4wLSUJsT2REHR4DjZf1oE.cache +2 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/87m-4EcbQnkbo2HYkQp4V9I2U3AYQO1mPeReieduolA.cache +1 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8B331vt8qC4iXTcVzkx3j-ET8i1oaQskj5LyqGq8mPQ.cache +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8KWvIOgvo7BVJYtdTpFuiSQQFFwZhLWYtwacZv52y48.cache +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9yQa5M2ObK2-qDu231zMoarjVbhKUUg-ND3r2iXqB_Q.cache +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/A-ffuUI2juZT6qFpTUwUR1P8OPWcyFFN26WSUZe60Ko.cache +1 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/BbO4diS6uacx69Hn_bCabYlXEbWWdjHShRlfzlWSOMI.cache +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/CXhqxaQQAQ8b0Y8y0jTQyiqsZ6Oe4fZn0YiacpJ9IoI.cache +1 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/E1zaNOh68xzPxdtdOwRtOaMCoKivN2dxVwCP65WEi5I.cache +2 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EmPkV3H8p2Snv9WyPjWran_kOMQ0MqQ1a9CVdGDd8l4.cache +1 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Hc12Nxe7cw2e0u2pzNsAe8D3ncQpcqLuI2NVL7aAXgw.cache +1 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/HdWuQr9W2mZvggsAxVjDgLYUNfg3rbI-T8KhaDIsvQk.cache +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/I7lsrHTKpbfLWqIqdDIx2RN_12yFL2PyLRyYsMxg1IU.cache +1 -0
  99. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/JOCzfBjMjX3D5BUUGh5lJ7fjzMuJrHLxAginRA2_hZQ.cache +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/JusxTSXt06IqBm9jeCMM2nTmM3Wvbl3i3L1IwEvW5YA.cache +2 -0
  101. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KAY1_IaTONtGr0KK8ihOdoA-RDXybqBMNSZLIDRHx68.cache +1 -0
  102. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KBHIDNfa4ryw9LAkYqK8GgPWne7HkX6mNYgrJajGm94.cache +1 -0
  103. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/L_lv02y00MmIFiFhg5c9zhl7CDHLSahehzLyi_mRZeY.cache +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MOT2X4iikR8v89A4N1bxDTeS1-xV8c9036TNFXmwXCM.cache +1 -0
  105. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MiX2Z4Vbha1riozZWw1U3_PGttRiZ1iQ_o4wSZJnKCs.cache +3 -0
  106. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MntKfwol0ud4LuvrX3MVPthTlfNlJZRYbQXpQBxhRrs.cache +1 -0
  107. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MrqmgPGNYJV1capJKIKJOVEQ4NiO-Z_2YhpjNteJ8B8.cache +2 -0
  108. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/NVMnAwylzGp5bjl_o9dwMAQxVAPDzc4ygddNQSD1fiw.cache +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/O2sKqGxNuCYhjzuEZVC9hX_FeemOfRn_1-CCuHBQYyg.cache +1 -0
  110. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Qy3TykLFmAt5jhSluMTaZaefcA5c_vfBRhQ7tin-gsk.cache +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/R3DpUgZ_hja1dQTIzumiP9AD_r8mlOaqv0U9QqnGQqo.cache +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RF07mgb06A30OcDWtCaDlM5tEc1yp0uAsk986Gqs5w8.cache +1 -0
  113. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/S-6Iq5YOEpVnd_vQ0RSSfrmyIwB1dk0op35alFgJ9xA.cache +2 -0
  114. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/TKV8dUTo88gdFY-z2I7Xa5vDC1Z3LY6Paa18385MJsI.cache +1 -0
  115. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UI4zPmWfZA2d_5ZZIXqK9KmkjOKSDg6JoM7qcOIxm0Q.cache +1 -0
  116. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UP29vrIQbCkfghZGSCFxpW5gjlsgCxlVrncjjopvRqM.cache +2 -0
  117. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UoU16f4V7haEXM5GY5j4QFuNMP7PJZaAMEvVNNtNLBA.cache +1 -0
  118. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/VqPqYNG07yqcjbd7FA05Mu-jr5hzsZPaHFf8X0FFbXk.cache +2 -0
  119. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WkN1QFvcuzXSsyNmfaK02ojXPk-8zmdEegzNPfdAEL4.cache +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WkQX7Wiz41OKx2aGF7uffOmS04hIVZeGCondBAvwum8.cache +2 -0
  121. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/XMeYF1vwAg53eVjXVkw_IKQH2W3-9tWvtuCdqUCbPBM.cache +2 -0
  122. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/XX0Z7OM0xZKfQaAvHARpyeQNZCstNyu9MlsnwThSkg8.cache +1 -0
  123. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Y-pGNFTA6bAKxSvqZvmMVs3b4Els1aByxZVFxtJR71c.cache +1 -0
  124. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Y3p3m5V5NOm7yq56apKmF5KZUUsTfnhT_SG3fqbEJgo.cache +1 -0
  125. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/YLZuRWklL6q-csC-7A7CiOTTTYEQcA9PCdWEOm9MpNU.cache +1 -0
  126. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Yo7V5YXukEBm6z37l-TIRCJx3HZExEUBu3MUMhAzkMU.cache +1 -0
  127. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/bK6QttR8pGmMAMJO0avCBLwH0za8_bAC-yWqkU3Yj24.cache +1 -0
  128. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/cLncjrqpQXzsVBp7K0W7iG1STLrnzfGpbJXxNE7aIUk.cache +2 -0
  129. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/dBcAd64EZFdhHZNXKGXPIR7EtPGf03bzqkci2W12T8g.cache +2 -0
  130. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d_bbPiareJHKkzFZFCl3pcwfQOFzsB1KHn4A2xxhR20.cache +1 -0
  131. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/eaHZBuJRcawVlkGZVyyRr5_4xYKVOXbCqnTcmaNXzL0.cache +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/gWnmfJty3jBn53qsJfOXKrWv4e8i3Dp80wVel-f1L1E.cache +1 -0
  133. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/gumo32Bd3W_q7MYEt9JIZEiQdHF93tLSsGfmXIm2MqU.cache +1 -0
  134. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/jKTlG9KP0iaCGHwg8kQ1amz9SHJ1OAWeCRRn9wc5w7c.cache +1 -0
  135. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/kPJfTiWbmX-q6i2rjM9MAMdEf2silSihU0_lxlTGVA8.cache +1 -0
  136. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lrt1SWPj4qWUZUMH9xg3n9KLYUqJZxRn-XI-NTU6oTI.cache +1 -0
  137. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mcCP5u08nlCL6TgWdzzrem9uE2rbsbG3KyIXxvWvlJE.cache +3 -0
  138. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/pC4exGjkQLXXPE0O9hjX_2AJ4DASTFeB6RGjXagxEac.cache +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/pIRh_Lq-ZhYC_XdRcqIsCtUkTnwVET0Wrrpw1EltHd8.cache +2 -0
  140. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/qfXc71sDbi1cE9f327D6ABPURPU6lLguGiJqH2fqM0w.cache +1 -0
  141. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rBcrkzXcMaiCjwvWl8tO0eARzKZS69I3i-lfsTAFzcc.cache +1 -0
  142. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/sfl8l1_1AGn-4llkmb91Q0wHJ-A-x5gAGkIUWe1zLqo.cache +1 -0
  143. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tFQc0MOeWpJ7t7cNP2GOzo7o9Z6YBgLEpdS0tGLvUSw.cache +0 -0
  144. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tb9v5OemP-ADEwYnETLLi1r088kZm_TMb9ZVeTV5JxI.cache +1 -0
  145. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/uKmWfbgaNZ8FTsVK1VNuUv15rmtTHzSdJ7TQRGr0Rck.cache +2 -0
  146. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ul0QEoovfr_12YOpyWx8BJs8fvz5Ay3AZG8-lsLr-a4.cache +1 -0
  147. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/vY6eUgBIXKHqfU2ZroS-GugKPg5_fo2QBs-vS5gBN2o.cache +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/vrRc4DPAbHIJHJqsXfBYdyKUPFv8f8YYKJUrk-1zdVw.cache +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/wTET4PQq7wlxzrgvNivPJad-CACkoQS4BNxAP0FQaR4.cache +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/wcvE87iLx7cDjMDs_Yu1jKYvep-VyLEyj1eXL79KLp4.cache +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xQeZ92qbm2t9FaRck5xUakvNP-MJ2cs0RroN-fm0Tf8.cache +1 -0
  152. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xQz9WPf67Mu5uV4rNuOfU-y6_KWSlWcnTWrTvQPonKM.cache +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xhYTRUOS8cIvyRp2Jn6FKnXlGOSsIM2z3HAGOJoJs7w.cache +1 -0
  154. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/yLxMFI0ARh2OKSOQLF2xEfM7sbst2vUbOBXoOuI6iTE.cache +1 -0
  155. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ynnYZxuxqerlFUytw54dl_CwP94g0U4HmGjyILWnhfQ.cache +1 -0
  156. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zCivVPbSRpKF_X-P5OJeld32YhymG-bkjQwzqe2o6zg.cache +2 -0
  157. data/spec/dummy/tmp/cache/assets/test/sprockets/02d4b791eb831cf2057bf4703a1218d1 +0 -0
  158. data/spec/dummy/tmp/cache/assets/test/sprockets/0f196a1a50363b0a076ec6e1ee5417f6 +0 -0
  159. data/spec/dummy/tmp/cache/assets/test/sprockets/a3fb9025f90ff05a6fd4afc7ded2692c +0 -0
  160. data/spec/dummy/tmp/cache/assets/test/sprockets/a41c8be5379abec3c0d0d98e2f0d5609 +0 -0
  161. data/spec/dummy/tmp/cache/assets/test/sprockets/c69ee3cc5796188d873574179290a6ef +0 -0
  162. data/spec/dummy/tmp/cache/assets/test/sprockets/e1f674c11941d62aac1764ef3a7134e4 +0 -0
  163. data/spec/dummy/tmp/cache/assets/test/sprockets/e85565206c3e5fdf9dfeb367c85557b1 +0 -0
  164. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/-gXoYfEJ-e9QQUbNRpNa-pwMCnTc7Eqvkq6Bosde6W8.cache +0 -0
  165. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/6iNAIrMKxHltOChiHQQf9VNsLQuj2rVKz6oqWnK7aSM.cache +1 -0
  166. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/E1zaNOh68xzPxdtdOwRtOaMCoKivN2dxVwCP65WEi5I.cache +2 -0
  167. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/HsNbq1o4RbrEWNL4zXVqFfUVnXXLK_y0F0BvddDre6g.cache +0 -0
  168. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/JusxTSXt06IqBm9jeCMM2nTmM3Wvbl3i3L1IwEvW5YA.cache +2 -0
  169. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/L5DjABL_iOtoxSOLn3X7_YlxECU5EhnrVIKxJFAysgc.cache +1 -0
  170. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/PNc9TJUmRdGTSwgZvGlxKaIiJIkyoWtTPiGGWBqpHAE.cache +0 -0
  171. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/QkgTHa6nNs7XP6RPoV3yBbWWV-uo1u2-qxLuvLCFe_0.cache +0 -0
  172. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/S-6Iq5YOEpVnd_vQ0RSSfrmyIwB1dk0op35alFgJ9xA.cache +2 -0
  173. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/Vuc93A9yywiFxc9CAdxrzdsAQw4jxiCa6JRzRjNxOYs.cache +1 -0
  174. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/YAPBll4U0cgs6cz-WyMRKoakK_gVOOcl9n0CvGyxPjY.cache +1 -0
  175. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/bDNeZfPBQaef5z0YajZc4jFE54nNy9gc06mPNKvvPFk.cache +1 -0
  176. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/c5Wa2loowFYFRBaMoTn1IWYXo4BGMbEy7NIi0vbvfRU.cache +1 -0
  177. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/dkn8MYu2ve_AJW6u0jjTlKrj1KBRqorOHQR0Obx2elU.cache +0 -0
  178. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/fZuAzt_-48u9C7ZXmsPgTraGDYtNC9B9zN-9-EnxJG4.cache +1 -0
  179. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/gumo32Bd3W_q7MYEt9JIZEiQdHF93tLSsGfmXIm2MqU.cache +1 -0
  180. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/ige85jXyj8X7XYr7HpA0gSTThqfPUm71HjhSJXtTbUY.cache +1 -0
  181. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/kuYeE5bV6FdXmfB_o-xhflhSDWoQhYYaaupAXODZ9dQ.cache +1 -0
  182. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/qhZbbNIRUaAOtGano94zLHjeBKUhKr4qbh2tTCi0Bnk.cache +2 -0
  183. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/wJJbzdHJHP6tchng3HhfTwmjc5LursgX8yZkAjpO5UA.cache +0 -0
  184. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/xNL1WW-qU3EvV2iTSW6F4hAFRBsCYmFKJhLjgCZkOV8.cache +2 -0
  185. data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/ytHkF2DwUE6oaiLyrK6tL-0INpeNhjN6ctD7J0LNY6I.cache +2 -0
  186. data/spec/helpers/commontator/application_helper_spec.rb~ +9 -0
  187. data/spec/lib/commontator/acts_as_commontable_spec.rb~ +25 -0
  188. data/spec/lib/commontator/acts_as_commontator_spec.rb~ +52 -0
  189. data/spec/lib/commontator/commontable_config_spec.rb~ +29 -0
  190. data/spec/lib/commontator/commontator_config_spec.rb~ +29 -0
  191. data/spec/lib/commontator/controller_includes_spec.rb~ +18 -0
  192. data/spec/lib/commontator/controllers_spec.rb~ +18 -0
  193. data/spec/lib/commontator/shared_helper_spec.rb~ +22 -0
  194. data/spec/lib/commontator_spec.rb~ +26 -0
  195. data/spec/mailers/commontator/subscriptions_mailer_spec.rb~ +30 -0
  196. data/spec/models/commontator/comment_spec.rb~ +82 -0
  197. data/spec/models/commontator/subscription_spec.rb~ +38 -0
  198. data/spec/models/commontator/thread_spec.rb +37 -0
  199. data/spec/models/commontator/thread_spec.rb~ +122 -0
  200. data/spec/rails_helper.rb~ +74 -0
  201. data/spec/spec_helper.rb~ +93 -0
  202. data/vendor/assets/javascripts/mentionsInput/index.js~ +3 -0
  203. metadata +409 -51
@@ -0,0 +1,124 @@
1
+ module Commontator
2
+ class Comment < ActiveRecord::Base
3
+ belongs_to :creator, :polymorphic => true
4
+ belongs_to :editor, :polymorphic => true
5
+ belongs_to :thread
6
+ belongs_to :parent_comment
7
+
8
+ validates_presence_of :creator, :on => :create
9
+ validates_presence_of :editor, :on => :update
10
+ validates_presence_of :thread
11
+ validates_presence_of :body
12
+
13
+ validates_uniqueness_of :body,
14
+ :scope => [:creator_type, :creator_id, :thread_id, :deleted_at],
15
+ :message => I18n.t('commontator.comment.errors.double_posted')
16
+
17
+ validate :parent_comment_in_same_thread
18
+
19
+ protected
20
+
21
+ cattr_accessor :acts_as_votable_initialized
22
+
23
+ def parent_comment_in_same_thread
24
+ return if parent_comment.nil? || parent_comment.thread_id == thread_id
25
+ errors.add(:parent_comment, 'must belong to the same thread')
26
+ end
27
+
28
+ public
29
+
30
+ def is_modified?
31
+ !editor.nil?
32
+ end
33
+
34
+ def is_latest?
35
+ thread.comments.last == self
36
+ end
37
+
38
+ def is_votable?
39
+ return true if acts_as_votable_initialized
40
+ return false unless self.class.respond_to?(:acts_as_votable)
41
+ self.class.acts_as_votable
42
+ self.class.acts_as_votable_initialized = true
43
+ end
44
+
45
+ def get_vote_by(user)
46
+ return nil unless is_votable? && !user.nil? && user.is_commontator
47
+ votes_for.where(:voter_type => user.class.name, :voter_id => user.id).first
48
+ end
49
+
50
+ def update_cached_votes(vote_scope = nil)
51
+ self.update_column(:cached_votes_up, count_votes_up(true))
52
+ self.update_column(:cached_votes_down, count_votes_down(true))
53
+ end
54
+
55
+ def is_deleted?
56
+ !deleted_at.blank?
57
+ end
58
+
59
+ def delete_by(user)
60
+ return false if is_deleted?
61
+ self.deleted_at = Time.now
62
+ self.editor = user
63
+ self.save
64
+ end
65
+
66
+ def undelete_by(user)
67
+ return false unless is_deleted?
68
+ self.deleted_at = nil
69
+ self.editor = user
70
+ self.save
71
+ end
72
+
73
+ def created_timestamp
74
+ I18n.t 'commontator.comment.status.created_at',
75
+ :created_at => I18n.l(created_at, :format => :commontator)
76
+ end
77
+
78
+ def updated_timestamp
79
+ I18n.t 'commontator.comment.status.updated_at',
80
+ :editor_name => Commontator.commontator_name(editor || creator),
81
+ :updated_at => I18n.l(updated_at, :format => :commontator)
82
+ end
83
+
84
+ ##################
85
+ # Access Control #
86
+ ##################
87
+
88
+ def can_be_created_by?(user)
89
+ user == creator && !user.nil? && user.is_commontator &&\
90
+ !thread.is_closed? && thread.can_be_read_by?(user)
91
+ end
92
+
93
+ def can_be_edited_by?(user)
94
+ return true if thread.can_be_edited_by?(user) &&\
95
+ thread.config.moderator_permissions.to_sym == :e
96
+ comment_edit = thread.config.comment_editing.to_sym
97
+ !thread.is_closed? && !is_deleted? && user == creator &&\
98
+ comment_edit != :n && (is_latest? || comment_edit == :a) &&\
99
+ thread.can_be_read_by?(user)
100
+ end
101
+
102
+ def can_be_deleted_by?(user)
103
+ mod_perm = thread.config.moderator_permissions.to_sym
104
+ return true if thread.can_be_edited_by?(user) &&\
105
+ (mod_perm == :e ||\
106
+ mod_perm == :d)
107
+ comment_del = thread.config.comment_deletion.to_sym
108
+ !thread.is_closed? && (!is_deleted? || editor == user) &&\
109
+ user == creator && comment_del != :n &&\
110
+ (is_latest? || comment_del == :a) &&\
111
+ thread.can_be_read_by?(user)
112
+ end
113
+
114
+ def can_be_voted_on?
115
+ !thread.is_closed? && !is_deleted? &&\
116
+ thread.config.comment_voting.to_sym != :n && is_votable?
117
+ end
118
+
119
+ def can_be_voted_on_by?(user)
120
+ !user.nil? && user.is_commontator && user != creator &&\
121
+ thread.can_be_read_by?(user) && can_be_voted_on?
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,23 @@
1
+ module Commontator
2
+ class Subscription < ActiveRecord::Base
3
+ belongs_to :subscriber, :polymorphic => true
4
+ belongs_to :thread
5
+
6
+ validates_presence_of :subscriber, :thread
7
+ validates_uniqueness_of :thread_id, :scope => [:subscriber_type, :subscriber_id]
8
+
9
+ def self.comment_created(comment)
10
+ recipients = comment.thread.subscribers.reject{|s| s == comment.creator}
11
+ return if recipients.empty?
12
+
13
+ mail = SubscriptionsMailer.comment_created(comment, recipients)
14
+ (mail.respond_to?(:deliver_later) ? mail.deliver_later : mail.deliver) \
15
+ unless recipients.empty?
16
+ end
17
+
18
+ def unread_comments
19
+ created_at = Comment.arel_table[:created_at]
20
+ thread.filtered_comments.where(created_at.gt(updated_at))
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ <% # Clients of this partial must supply the following variables:
2
+ # thread
3
+ # user
4
+ %>
5
+
6
+ <% if !thread.can_be_read_by?(user) %>
7
+ <div id="thread_<%= thread.id %>_div" class="thread" style="display: none;">
8
+ <% if @commontator_thread_show %>
9
+ <%= render :partial => 'commontator/threads/show',
10
+ :locals => { :thread => thread,
11
+ :user => user,
12
+ :page => @commontator_page,
13
+ :per_page => @commontator_per_page } %>
14
+ <% else %>
15
+ <% subscription = thread.subscription_for(user) %>
16
+ <%= link_to "#{t 'commontator.thread.actions.show'} (#{(subscription.unread_comments.count.to_s + '/') if subscription}#{thread.filtered_comments.count.to_s})",
17
+ commontator.thread_path(thread),
18
+ :remote => true %>
19
+ <% end %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <h4><%= t 'commontator.email.comment_created.body',
2
+ :creator_name => @creator_name,
3
+ :commontable_name => @commontable_name %></h4>
4
+
5
+ <%= render :partial => 'commontator/comments/body',
6
+ :locals => { :comment => @comment } %>
7
+
8
+ <p><%= t 'commontator.email.thread_link_html',
9
+ :comment_url => @commontable_url,
10
+ :commontable_name => @commontable_name %></p>
@@ -0,0 +1,21 @@
1
+ $("#").replaceWith(<%= ej(
2
+ link_to t('commontator.thread.actions.show'),
3
+ '#',
4
+ :id => "thread_#{thread.id.to_s}_show_link",
5
+ :class => "thread_show_link",
6
+ :remote => true
7
+ ) %>);
8
+
9
+ $().replaceWith(<%= ej(
10
+ link_to t('commontator.thread.actions.hide'),
11
+ '#',
12
+ :id => "thread_#{thread.id.to_s}_hide_link",
13
+ :class => "thread_hide_link",
14
+ :remote => true
15
+ ) %>);
16
+
17
+ <%= link_to t('commontator.thread.actions.hide'),
18
+ '',
19
+ :id => "thread_#{thread.id.to_s}_hide_link",
20
+ :class => "thread_hide_link",
21
+ :remote => true %>
@@ -0,0 +1,17 @@
1
+ <% # Clients of this partial must supply the following variables:
2
+ # thread
3
+ %>
4
+
5
+ $("#thread_<%= thread.id %>_hide_link").click(function() {
6
+ $("#thread_<%= thread.id %>_span").hide();
7
+
8
+ $("#thread_<%= thread.id %>_show_span").fadeIn()[0].scrollIntoView();
9
+ });
10
+
11
+ $("#thread_<%= thread.id %>_show_link").click(function() {
12
+ $("#thread_<%= thread.id %>_span").fadeIn()[0].scrollIntoView();
13
+
14
+ $("#thread_<%= thread.id %>_span").hide();
15
+ });
16
+
17
+ $("#thread_<%= thread.id %>_hide_span").show();
@@ -0,0 +1,118 @@
1
+ <% # Clients of this partial must supply the following variables:
2
+ # thread
3
+ # user
4
+ # page
5
+ # per_page
6
+ # Optionally, they can also supply the following variable:
7
+ show_all ||= false
8
+ %>
9
+
10
+ <% can_subscribe = thread.can_subscribe?(user)
11
+ can_edit = thread.can_be_edited_by?(user) %>
12
+
13
+ <span id="thread_<%= thread.id.to_s %>_show_span" class="thread_show commontator_hidden">
14
+ <%= link_to t('commontator.thread.actions.show'),
15
+ '#',
16
+ id: "thread_#{thread.id.to_s}_show_link",
17
+ class: "thread_show_link" %>
18
+ </span>
19
+
20
+ <span id="thread_<%= thread.id %>_span" class="thread_span">
21
+ <span id="thread_<%= thread.id.to_s %>_actions_span" class="thread_actions">
22
+ <span id="thread_<%= thread.id.to_s %>_hide_span" class="thread_hide commontator_hidden">
23
+ <%= link_to t('commontator.thread.actions.hide'),
24
+ '#',
25
+ id: "thread_#{thread.id.to_s}_hide_link",
26
+ class: "thread_hide_link" %>
27
+ </span>
28
+
29
+ &nbsp;
30
+
31
+ <% if can_subscribe %>
32
+ <span id="thread_<%= thread.id.to_s %>_subscription_span" class="thread_subscription">
33
+ <%= render :partial => 'commontator/subscriptions/link',
34
+ :locals => { :thread => thread,
35
+ :user => user } %>
36
+ </span>
37
+ <% end %>
38
+
39
+ &nbsp;
40
+
41
+ <% if can_edit %>
42
+ <% filter_string = show_all ? 'filter' : 'show_all'
43
+ is_closed = thread.is_closed?
44
+ close_string = is_closed ? 'reopen' : 'close' %>
45
+
46
+ <% if thread.is_filtered? %>
47
+ <%= link_to t("commontator.thread.actions.#{filter_string}"),
48
+ commontator.thread_path(thread, :show_all => (show_all ? nil : true)),
49
+ :id => "thread_#{thread.id.to_s}_#{filter_string}_link",
50
+ :class => "thread_#{filter_string}_link",
51
+ :remote => true %>
52
+
53
+ &nbsp;
54
+ <% end %>
55
+
56
+ <%= link_to t("commontator.thread.actions.#{close_string}"),
57
+ commontator.polymorphic_path([close_string, thread]),
58
+ :confirm => (!is_closed ? t('commontator.thread.actions.confirm_close') : nil),
59
+ :method => :put,
60
+ :id => "thread_#{thread.id.to_s}_#{close_string}_link",
61
+ :class => "thread_#{close_string}_link",
62
+ :remote => true %>
63
+ <% end %>
64
+ </span>
65
+
66
+ <span id="thread_<%= thread.id.to_s %>_header_span" class="thread_header">
67
+ <%= t "commontator.thread.status.#{thread.is_closed? ? 'closed' : 'open'}",
68
+ :closer_name => (thread.is_closed? ? Commontator.commontator_name(thread.closer) : '') %>
69
+ </span>
70
+
71
+ <% if thread.config.comment_order == :l %>
72
+ <%= render :partial => 'commontator/threads/reply',
73
+ :locals => { :thread => thread, :user => user, :per_page => per_page } %>
74
+ <% end %>
75
+
76
+ <div id="thread_<%= thread.id.to_s %>_comment_list_div" class="thread_comment_list">
77
+ <% comments = show_all ? thread.ordered_comments(true) : \
78
+ thread.paginated_comments(page, per_page) %>
79
+ <%= render :partial => 'commontator/comments/list',
80
+ :locals => { :comments => comments,
81
+ :user => user } %>
82
+ </div>
83
+
84
+ <% if thread.will_paginate? && !show_all %>
85
+ <div id="thread_<%= thread.id.to_s %>_pagination_div" class="thread_pagination">
86
+ <div id="thread_<%= thread.id.to_s %>_page_entries_info_div" class="thread_page_entries_info">
87
+ <%= page_entries_info comments,
88
+ :params => { :controller => 'commontator/threads',
89
+ :action => 'show',
90
+ :id => thread.id,
91
+ :page => page,
92
+ :per_page => per_page } %>.
93
+ </div>
94
+
95
+ <div id="thread_<%= thread.id.to_s %>_will_paginate_div" class="thread_will_paginate">
96
+ <%= will_paginate comments,
97
+ :renderer => Commontator::LinkRenderer,
98
+ :routes_proxy => commontator,
99
+ :remote => true,
100
+ :params => { :controller => 'commontator/threads',
101
+ :action => 'show',
102
+ :id => thread.id,
103
+ :page => page,
104
+ :per_page => per_page } %>
105
+ </div>
106
+ </div>
107
+ <% end %>
108
+
109
+ <% if thread.config.comment_order != :l %>
110
+ <%= render :partial => 'commontator/threads/reply',
111
+ :locals => { :thread => thread, :user => user, :per_page => per_page } %>
112
+ <% end %>
113
+ </span>
114
+
115
+ <script type="text/javascript">
116
+ <%= j(render partial: 'commontator/threads/hide_show_links.js',
117
+ locals: { thread: thread }) %>
118
+ </script>
@@ -0,0 +1,18 @@
1
+ <% # Clients of this partial must supply the following variables:
2
+ # thread
3
+ # user
4
+ # page
5
+ # per_page
6
+ # Optionally, they can also supply the following variable:
7
+ show_all ||= false
8
+ %>
9
+
10
+ $("#thread_<%= thread.id %>_div").replaceWith(
11
+ "<%= escape_javascript(
12
+ render :partial => 'commontator/threads/show',
13
+ :formats => [:html],
14
+ :locals => { :thread => thread,
15
+ :user => user,
16
+ :page => page,
17
+ :per_page => per_page,
18
+ :show_all => show_all }) %>");
@@ -0,0 +1,290 @@
1
+ # Change the settings below to suit your needs
2
+ # All settings are initially set to their default values
3
+
4
+ # Note: Do not "return" from a Proc, use "next" instead if necessary
5
+ # "return" in a lambda is OK
6
+ Commontator.configure do |config|
7
+ # Engine Configuration
8
+
9
+ # current_user_proc
10
+ # Type: Proc
11
+ # Arguments: the current controller (ActionController::Base)
12
+ # Returns: the current user (acts_as_commontator)
13
+ # The default works for Devise and similar authentication plugins
14
+ # Default: lambda { |controller| controller.current_user }
15
+ config.current_user_proc = lambda { |controller| controller.current_user }
16
+
17
+ # javascript_proc
18
+ # Type: Proc
19
+ # Arguments: a view (ActionView::Base)
20
+ # Returns: a String that is appended to Commontator JS views
21
+ # Can be used, for example, to display/clear Rails error messages
22
+ # or to reapply JQuery UI styles after Ajax calls
23
+ # Objects visible in view templates can be accessed
24
+ # through the view object (for example, view.flash)
25
+ # However, the view does not include the main application's helpers
26
+ # Default: lambda { |view| '$("#error_explanation").remove();' }
27
+ config.javascript_proc = lambda { |view|
28
+ '$("#error_explanation").remove();' }
29
+
30
+
31
+
32
+ # User (acts_as_commontator) Configuration
33
+
34
+ # user_name_proc
35
+ # Type: Proc
36
+ # Arguments: a user (acts_as_commontator)
37
+ # Returns: the user's name (String)
38
+ # Default: lambda { |user| I18n.t('commontator.anonymous') } (all users are anonymous)
39
+ config.user_name_proc = lambda { |user| I18n.t('commontator.anonymous') }
40
+
41
+ # user_link_proc
42
+ # Type: Proc
43
+ # Arguments: a user (acts_as_commontator),
44
+ # the app_routes (ActionDispatch::Routing::RoutesProxy)
45
+ # Returns: a path to the user's `show` page (String)
46
+ # If anything non-blank is returned, the user's name in comments
47
+ # comments will become a hyperlink pointing to this path
48
+ # The main application's routes can be accessed through the app_routes object
49
+ # Default: lambda { |user, app_routes| '' } (no link)
50
+ config.user_link_proc = lambda { |user, app_routes| '' }
51
+
52
+ # user_avatar_proc
53
+ # Type: Proc
54
+ # Arguments: a user (acts_as_commontator), a view (ActionView::Base)
55
+ # Returns: a String containing a HTML <img> tag pointing to the user's avatar image
56
+ # The commontator_gravatar_image_tag helper takes a user object,
57
+ # a border size and an options hash for Gravatar, and produces a Gravatar image tag
58
+ # See available options at http://en.gravatar.com/site/implement/images/)
59
+ # Note: Gravatar has several security implications for your users
60
+ # It makes your users trackable across different sites and
61
+ # allows de-anonymization attacks against their email addresses
62
+ # If you absolutely want to keep users' email addresses or identities secret,
63
+ # do not use Gravatar or similar services
64
+ # Default: lambda { |user, view|
65
+ # view.commontator_gravatar_image_tag(
66
+ # user, 1, :s => 60, :d => 'mm') }
67
+ config.user_avatar_proc = lambda { |user, view|
68
+ view.commontator_gravatar_image_tag(
69
+ user, 1, :s => 60, :d => 'mm') }
70
+
71
+ # user_email_proc
72
+ # Type: Proc
73
+ # Arguments: a user (acts_as_commontator), a mailer (ActionMailer::Base)
74
+ # Returns: the user's email address (String)
75
+ # The default works for Devise's defaults
76
+ # If the mailer argument is nil, Commontator intends to hash the email and send the hash
77
+ # to Gravatar, so you should always return the user's email address (if using Gravatar)
78
+ # If the mailer argument is not nil, then Commontator intends to send an email to
79
+ # the address returned; you can prevent it from being sent by returning a blank String
80
+ # Default: lambda { |user, mailer| user.try(:email) || '' }
81
+ config.user_email_proc = lambda { |user, mailer| user.try(:email) || '' }
82
+
83
+
84
+
85
+ # Thread/Commontable (acts_as_commontable) Configuration
86
+
87
+ # comment_filter
88
+ # Type: Arel node (Arel::Nodes::Node) or nil
89
+ # Arel that filters visible comments
90
+ # If specified, visible comments will be filtered according to this Arel node
91
+ # A value of nil will cause no filtering to be done
92
+ # Moderators can manually override this filter for themselves
93
+ # Example: Commontator::Comment.arel_table[:deleted_at].eq(nil) (hides deleted comments)
94
+ # This is not recommended, as it can cause confusion over deleted comments
95
+ # If using pagination, it can also cause comments to change pages
96
+ # Default: nil (no filtering - all comments are visible)
97
+ config.comment_filter = nil
98
+
99
+ # thread_read_proc
100
+ # Type: Proc
101
+ # Arguments: a thread (Commontator::Thread), a user (acts_as_commontator)
102
+ # Returns: a Boolean, true iif the user should be allowed to read that thread
103
+ # Note: can be called with a user object that is nil (if they are not logged in)
104
+ # Default: lambda { |thread, user| true } (anyone can read any thread)
105
+ config.thread_read_proc = lambda { |thread, user| true }
106
+
107
+ # thread_moderator_proc
108
+ # Type: Proc
109
+ # Arguments: a thread (Commontator::Thread), a user (acts_as_commontator)
110
+ # Returns: a Boolean, true iif the user is a moderator for that thread
111
+ # If you want global moderators, make this proc true for them regardless of thread
112
+ # Default: lambda { |thread, user| false } (no moderators)
113
+ config.thread_moderator_proc = lambda { |thread, user| false }
114
+
115
+ # comment_editing
116
+ # Type: Symbol
117
+ # Whether users can edit their own comments
118
+ # Valid options:
119
+ # :a (always)
120
+ # :l (only if it's the latest comment)
121
+ # :n (never)
122
+ # Default: :l
123
+ config.comment_editing = :l
124
+
125
+ # comment_deletion
126
+ # Type: Symbol
127
+ # Whether users can delete their own comments
128
+ # Valid options:
129
+ # :a (always)
130
+ # :l (only if it's the latest comment)
131
+ # :n (never)
132
+ # Note: For moderators, see the next option
133
+ # Default: :l
134
+ config.comment_deletion = :l
135
+
136
+ # moderator_permissions
137
+ # Type: Symbol
138
+ # What permissions moderators have
139
+ # Valid options:
140
+ # :e (delete and edit comments and close threads)
141
+ # :d (delete comments and close threads)
142
+ # :c (close threads only)
143
+ # Default: :d
144
+ config.moderator_permissions = :d
145
+
146
+ # comment_voting
147
+ # Type: Symbol
148
+ # Whether users can vote on other users' comments
149
+ # Valid options:
150
+ # :n (no voting)
151
+ # :l (likes - requires acts_as_votable gem)
152
+ # :ld (likes/dislikes - requires acts_as_votable gem)
153
+ # Not yet implemented:
154
+ # :s (star ratings)
155
+ # :r (reputation system)
156
+ # Default: :n
157
+ config.comment_voting = :n
158
+
159
+ # vote_count_proc
160
+ # Type: Proc
161
+ # Arguments: a thread (Commontator::Thread), pos (Fixnum), neg (Fixnum)
162
+ # Returns: vote count to be displayed (String)
163
+ # pos is the number of likes, or the rating, or the reputation
164
+ # neg is the number of dislikes, if applicable, or 0 otherwise
165
+ # Default: lambda { |thread, pos, neg| "%+d" % (pos - neg) }
166
+ config.vote_count_proc = lambda { |thread, pos, neg| "%+d" % (pos - neg) }
167
+
168
+ # comment_order
169
+ # Type: Symbol
170
+ # What order to use for comments
171
+ # Valid options:
172
+ # :e (earliest comment first)
173
+ # :l (latest comment first)
174
+ # :ve (highest voted first; earliest first if tied)
175
+ # :vl (highest voted first; latest first if tied)
176
+ # Notes:
177
+ # :e is usually used in forums (discussions)
178
+ # :l is usually used in blogs (opinions)
179
+ # :ve and :vl are usually used where it makes sense to rate comments
180
+ # based on usefulness (q&a, reviews, guides, etc.)
181
+ # If :l is selected, the "reply to thread" form will appear before the comments
182
+ # Otherwise, it will appear after the comments
183
+ # Default: :e
184
+ config.comment_order = :e
185
+
186
+ # new_comment_style
187
+ # Type: Symbol
188
+ # How to display the "new comment" form
189
+ # Valid options:
190
+ # :t (always present in the thread's page)
191
+ # :l (link to the form; opens in the same page using JS)
192
+ # Not yet implemented:
193
+ # :n (link to the form; opens in a new window)
194
+ # Default: :l
195
+ config.new_comment_style = :l
196
+
197
+ # comments_per_page
198
+ # Type: Fixnum or nil
199
+ # Number of comments to display in each page
200
+ # Set to nil to disable pagination
201
+ # Any other value requires the will_paginate gem
202
+ # Default: nil (no pagination)
203
+ config.comments_per_page = nil
204
+
205
+ # thread_subscription
206
+ # Type: Symbol
207
+ # Whether users can subscribe to threads to receive activity email notifications
208
+ # Valid options:
209
+ # :n (no subscriptions)
210
+ # :a (automatically subscribe when you comment; cannot do it manually)
211
+ # :m (manual subscriptions only)
212
+ # :b (both automatic, when commenting, and manual)
213
+ # Default: :n
214
+ config.thread_subscription = :n
215
+
216
+ # email_from_proc
217
+ # Type: Proc
218
+ # Arguments: a thread (Commontator::Thread)
219
+ # Returns: the address emails are sent "from" (String)
220
+ # Important: If using subscriptions, change this to at least match your domain name
221
+ # Default: lambda { |thread|
222
+ # "no-reply@#{Rails.application.class.parent.to_s.downcase}.com" }
223
+ config.email_from_proc = lambda { |thread|
224
+ "no-reply@#{Rails.application.class.parent.to_s.downcase}.com" }
225
+
226
+ # commontable_name_proc
227
+ # Type: Proc
228
+ # Arguments: a thread (Commontator::Thread)
229
+ # Returns: a name that refers to the commontable object (String)
230
+ # If you have multiple commontable models, you can also pass this
231
+ # configuration value as an argument to acts_as_commontable for each one
232
+ # Default: lambda { |thread|
233
+ # "#{thread.commontable.class.name} ##{thread.commontable.id}" }
234
+ config.commontable_name_proc = lambda { |thread|
235
+ "#{thread.commontable.class.name} ##{thread.commontable.id}" }
236
+
237
+ # comment_url_proc
238
+ # Type: Proc
239
+ # Arguments: a comment (Commontator::Comment),
240
+ # the app_routes (ActionDispatch::Routing::RoutesProxy)
241
+ # Returns: a String containing the url of the view that displays the given comment
242
+ # This usually is the commontable's "show" page
243
+ # The main application's routes can be accessed through the app_routes object
244
+ # Default: lambda { |comment, app_routes|
245
+ <<<<<<< Updated upstream
246
+ # app_routes.polymorphic_url(comment.thread.commontable) }
247
+ # Link to comment:
248
+ # lambda { |comment, app_routes|
249
+ # app_routes.polymorphic_url(comment.thread.commontable, anchor: "comment_#{comment.id}_div") }
250
+ # (defaults to the commontable's show url)
251
+ config.commontable_url_proc = lambda { |comment, app_routes|
252
+ app_routes.polymorphic_url(comment.thread.commontable) }
253
+ =======
254
+ # app_routes.polymorphic_url(comment.thread.commontable,
255
+ # anchor: "comment_#{comment.id}_div") }
256
+ # (defaults to the commontable's show url with an anchor pointing to the comment's div)
257
+ config.comment_url_proc = lambda { |comment, app_routes|
258
+ app_routes.polymorphic_url(comment.thread.commontable, anchor: "comment_#{comment.id}_div") }
259
+ >>>>>>> Stashed changes
260
+
261
+ # mentions_enabled
262
+ # Type: Boolean
263
+ # Whether users can mention other users to subscribe them to the thread
264
+ # Valid options:
265
+ # false (no mentions)
266
+ # true (mentions enabled)
267
+ # Default: false
268
+ config.mentions_enabled = false
269
+
270
+ # user_mentions_proc
271
+ # Type: Proc
272
+ # Arguments:
273
+ # the current user (acts_as_commontator)
274
+ # the search query inputted by user (String)
275
+ # Returns: an ActiveRecord Relation object
276
+ # Important notes:
277
+ #
278
+ # - The proc will be called internally with an empty search string.
279
+ # In that case, it MUST return all users that can be mentioned.
280
+ #
281
+ # - With mentions enabled, any registered user in your app is able
282
+ # to call this proc with any search query >= 3 characters.
283
+ # Make sure to handle SQL escaping properly and that the
284
+ # attribute being searched does not contain sensitive information.
285
+ #
286
+ # Default: lambda { |current_user, query|
287
+ # current_user.class.where('username LIKE ?', "#{query}%") }
288
+ config.user_mentions_proc = lambda { |current_user, query|
289
+ current_user.class.where('username LIKE ?', "#{query}%") }
290
+ end