commontator 4.5.4 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +5 -13
  2. data/MIT-LICENSE +2 -1
  3. data/README.md +31 -34
  4. data/Rakefile +3 -2
  5. data/app/assets/stylesheets/commontator/application.css +1 -0
  6. data/app/assets/stylesheets/commontator/comments.css +1 -0
  7. data/app/assets/stylesheets/commontator/threads.css +13 -7
  8. data/{spec/dummy/tmp/cache/assets/test/sprockets/a473b3873e554893372a53d71f5e9879 → app/assets/stylesheets/commontator/threads.css~} +0 -0
  9. data/app/controllers/commontator/application_controller.rb +14 -14
  10. data/app/controllers/commontator/application_controller.rb~ +35 -0
  11. data/app/controllers/commontator/comments_controller.rb +8 -7
  12. data/app/controllers/commontator/comments_controller.rb~ +153 -0
  13. data/app/controllers/commontator/subscriptions_controller.rb +1 -0
  14. data/app/controllers/commontator/threads_controller.rb +7 -2
  15. data/app/helpers/commontator/application_helper.rb +1 -0
  16. data/app/mailers/commontator/subscriptions_mailer.rb +8 -10
  17. data/app/mailers/commontator/subscriptions_mailer.rb~ +44 -0
  18. data/app/models/commontator/comment.rb +14 -13
  19. data/app/models/commontator/comment.rb~ +119 -0
  20. data/app/models/commontator/subscription.rb +8 -4
  21. data/app/models/commontator/thread.rb +64 -43
  22. data/app/models/commontator/thread.rb~ +159 -0
  23. data/app/views/commontator/comments/_actions.html.erb +1 -0
  24. data/app/views/commontator/comments/_body.html.erb +2 -1
  25. data/app/views/commontator/comments/_form.html.erb +5 -1
  26. data/app/views/commontator/comments/_form.html.erb~ +39 -0
  27. data/app/views/commontator/comments/_list.html.erb +1 -1
  28. data/app/views/commontator/comments/_show.html.erb +5 -3
  29. data/app/views/commontator/comments/_show.html.erb~ +49 -0
  30. data/app/views/commontator/comments/_votes.html.erb +2 -1
  31. data/app/views/commontator/comments/_votes.html.erb~ +69 -0
  32. data/app/views/commontator/comments/cancel.js.erb +1 -0
  33. data/app/views/commontator/comments/create.js.erb +6 -4
  34. data/app/views/commontator/comments/create.js.erb~ +14 -0
  35. data/app/views/commontator/comments/delete.js.erb +1 -0
  36. data/app/views/commontator/comments/edit.js.erb +1 -0
  37. data/app/views/commontator/comments/new.js.erb +3 -1
  38. data/app/views/commontator/comments/new.js.erb~ +13 -0
  39. data/app/views/commontator/comments/update.js.erb +1 -0
  40. data/app/views/commontator/comments/vote.js.erb +1 -0
  41. data/app/views/commontator/shared/_thread.html.erb +4 -5
  42. data/app/views/commontator/subscriptions/_link.html.erb +2 -1
  43. data/app/views/commontator/subscriptions/_link.html.erb~ +16 -0
  44. data/app/views/commontator/subscriptions/subscribe.js.erb +1 -0
  45. data/app/views/commontator/subscriptions_mailer/comment_created.html.erb +1 -0
  46. data/app/views/commontator/threads/_reply.html.erb +4 -2
  47. data/app/views/commontator/threads/_reply.html.erb~ +19 -0
  48. data/app/views/commontator/threads/_show.html.erb +44 -9
  49. data/app/views/commontator/threads/_show.html.erb~ +95 -0
  50. data/app/views/commontator/threads/_show.js.erb +19 -0
  51. data/app/views/commontator/threads/show.js.erb +4 -4
  52. data/config/initializers/commontator.rb +169 -132
  53. data/config/initializers/commontator.rb~ +238 -0
  54. data/config/locales/commontator/en.yml +12 -3
  55. data/config/locales/commontator/en.yml~ +104 -0
  56. data/config/routes.rb +1 -0
  57. data/db/migrate/0_install_commontator.rb +9 -11
  58. data/db/migrate/0_install_commontator.rb~ +54 -0
  59. data/lib/commontator.rb +57 -16
  60. data/lib/commontator.rb~ +142 -0
  61. data/lib/commontator/acts_as_commontable.rb +12 -14
  62. data/lib/commontator/acts_as_commontator.rb +1 -16
  63. data/lib/commontator/commontable_config.rb +1 -0
  64. data/lib/commontator/commontator_config.rb +1 -0
  65. data/lib/commontator/controller_includes.rb +3 -3
  66. data/lib/commontator/engine.rb +1 -0
  67. data/lib/commontator/link_renderer.rb +29 -0
  68. data/lib/commontator/security_transgression.rb +1 -0
  69. data/lib/commontator/shared_helper.rb +7 -5
  70. data/lib/commontator/version.rb +2 -1
  71. data/lib/tasks/commontator_tasks.rake +1 -0
  72. data/spec/app/controllers/commontator/comments_controller_spec.rb +12 -11
  73. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +2 -1
  74. data/spec/app/controllers/commontator/threads_controller_spec.rb +2 -1
  75. data/spec/app/helpers/commontator/application_helper_spec.rb +2 -1
  76. data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb +2 -1
  77. data/spec/app/models/commontator/comment_spec.rb +18 -11
  78. data/spec/app/models/commontator/comment_spec.rb~ +74 -0
  79. data/spec/app/models/commontator/subscription_spec.rb +18 -8
  80. data/spec/app/models/commontator/thread_spec.rb +28 -42
  81. data/spec/dummy/README.md +1 -0
  82. data/spec/dummy/Rakefile +1 -0
  83. data/spec/dummy/app/assets/javascripts/application.js +1 -0
  84. data/spec/dummy/app/assets/stylesheets/application.css +1 -0
  85. data/spec/dummy/app/controllers/application_controller.rb +1 -0
  86. data/spec/dummy/app/controllers/dummy_models_controller.rb +1 -0
  87. data/spec/dummy/app/helpers/application_helper.rb +1 -0
  88. data/spec/dummy/app/models/dummy_model.rb +1 -0
  89. data/spec/dummy/app/models/dummy_user.rb +7 -2
  90. data/spec/dummy/app/models/dummy_user.rb~ +16 -0
  91. data/spec/dummy/app/views/dummy_model/show.html.erb +1 -0
  92. data/spec/dummy/app/views/layouts/application.html.erb +1 -0
  93. data/spec/dummy/config.ru +1 -0
  94. data/spec/dummy/config/boot.rb +1 -0
  95. data/spec/dummy/config/database.yml +1 -0
  96. data/spec/dummy/config/environment.rb +1 -0
  97. data/spec/dummy/config/environments/development.rb +1 -0
  98. data/spec/dummy/config/environments/production.rb +1 -0
  99. data/spec/dummy/config/environments/test.rb +1 -0
  100. data/spec/dummy/config/initializers/backtrace_silencers.rb +1 -0
  101. data/spec/dummy/config/initializers/commontator.rb +6 -1
  102. data/spec/dummy/config/initializers/commontator.rb~ +15 -0
  103. data/spec/dummy/config/initializers/filter_parameter_logging.rb +1 -0
  104. data/spec/dummy/config/initializers/inflections.rb +1 -0
  105. data/spec/dummy/config/initializers/mime_types.rb +1 -0
  106. data/spec/dummy/config/initializers/secret_token.rb +1 -0
  107. data/spec/dummy/config/initializers/session_store.rb +1 -0
  108. data/spec/dummy/config/initializers/wrap_parameters.rb +1 -0
  109. data/spec/dummy/config/routes.rb +1 -0
  110. data/spec/dummy/db/development.sqlite3 +0 -0
  111. data/spec/dummy/db/migrate/1_create_dummy_models.rb +1 -0
  112. data/spec/dummy/db/migrate/2_create_dummy_users.rb +1 -0
  113. data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb +1 -0
  114. data/spec/dummy/db/schema.rb +10 -13
  115. data/spec/dummy/db/test.sqlite3 +0 -0
  116. data/spec/dummy/public/404.html +1 -0
  117. data/spec/dummy/public/422.html +1 -0
  118. data/spec/dummy/public/500.html +1 -0
  119. data/spec/dummy/script/rails +1 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/{72b63dddbc5c995f79af8e3c94904fd9 → 02d4b791eb831cf2057bf4703a1218d1} +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/{a77b1a9223d168112e1705c29220116f → 0f196a1a50363b0a076ec6e1ee5417f6} +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/a3fb9025f90ff05a6fd4afc7ded2692c +0 -0
  123. data/spec/dummy/tmp/cache/assets/test/sprockets/a41c8be5379abec3c0d0d98e2f0d5609 +0 -0
  124. data/spec/dummy/tmp/cache/assets/test/sprockets/c69ee3cc5796188d873574179290a6ef +0 -0
  125. data/spec/dummy/tmp/cache/assets/test/sprockets/{f721383d531f067d82b071e14aed7a92 → e1f674c11941d62aac1764ef3a7134e4} +0 -0
  126. data/spec/dummy/tmp/cache/assets/test/sprockets/{d2244ccef8e05bb993f75715af0344cc → e85565206c3e5fdf9dfeb367c85557b1} +0 -0
  127. data/spec/lib/commontator/acts_as_commontable_spec.rb +3 -2
  128. data/spec/lib/commontator/acts_as_commontator_spec.rb +2 -5
  129. data/spec/lib/commontator/commontable_config_spec.rb +8 -5
  130. data/spec/lib/commontator/commontator_config_spec.rb +2 -1
  131. data/spec/lib/commontator/controller_includes_spec.rb +2 -1
  132. data/spec/lib/commontator/shared_helper_spec.rb +2 -1
  133. data/spec/lib/commontator_spec.rb +2 -1
  134. data/spec/{test_helper.rb → spec_helper.rb} +0 -0
  135. metadata +154 -135
  136. data/lib/commontator/remote_link_renderer.rb +0 -10
  137. data/spec/dummy/config/locales/en.yml +0 -23
  138. data/spec/dummy/log/development.log +0 -36
  139. data/spec/dummy/log/test.log +0 -22683
  140. data/spec/dummy/tmp/cache/assets/test/sprockets/afa63eb365bdf4f42584b17ac9176b9d +0 -0
  141. data/spec/dummy/tmp/cache/assets/test/sprockets/decb63cac838a5314aa0c22a979f5ac9 +0 -0
@@ -0,0 +1,238 @@
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
+ # Objects visible in view templates can be accessed
23
+ # through the view object (for example, view.flash)
24
+ # However, the view does not include the main application's helpers
25
+ # Default: lambda { |view| '$("#error_explanation").remove();' }
26
+ config.javascript_proc = lambda { |view|
27
+ '$("#error_explanation").remove();' }
28
+
29
+
30
+
31
+ # User (acts_as_commontator) Configuration
32
+
33
+ # user_name_proc
34
+ # Type: Proc
35
+ # Arguments: a user (acts_as_commontator)
36
+ # Returns: the user's name (String)
37
+ # Default: lambda { |user| I18n.t('commontator.anonymous') } (all users are anonymous)
38
+ config.user_name_proc = lambda { |user| I18n.t('commontator.anonymous') }
39
+
40
+ # user_link_proc
41
+ # Type: Proc
42
+ # Arguments: a user (acts_as_commontator),
43
+ # the app_routes (ActionDispatch::Routing::RoutesProxy)
44
+ # Returns: a path to the user's `show` page (String)
45
+ # If anything non-blank is returned, the user's name in comments
46
+ # comments will become a hyperlink pointing to this path
47
+ # The main application's routes can be accessed through the app_routes object
48
+ # Default: lambda { |user, app_routes| '' } (no link)
49
+ config.user_link_proc = lambda { |user, app_routes| '' }
50
+
51
+ # user_avatar_proc
52
+ # Type: Proc
53
+ # Arguments: a user (acts_as_commontator), a view (ActionView::Base)
54
+ # Returns: a String containing a HTML <img> tag pointing to the user's avatar image
55
+ # The commontator_gravatar_image_tag helper takes a user object,
56
+ # a border size and an options hash for Gravatar, and produces a Gravatar image tag
57
+ # See available options at http://en.gravatar.com/site/implement/images/)
58
+ # Note: Gravatar has several security implications for your users
59
+ # It makes your users trackable across different sites and
60
+ # allows de-anonymization attacks against their email addresses
61
+ # If you absolutely want to keep users' email addresses or identities secret,
62
+ # do not use Gravatar or similar services
63
+ # Default: lambda { |user, view|
64
+ # view.commontator_gravatar_image_tag(
65
+ # user, 1, :s => 60, :d => 'mm') }
66
+ config.user_avatar_proc = lambda { |user, view|
67
+ view.commontator_gravatar_image_tag(
68
+ user, 1, :s => 60, :d => 'mm') }
69
+
70
+ # user_email_proc
71
+ # Type: Proc
72
+ # Arguments: a user (acts_as_commontator), a mailer (ActionMailer::Base)
73
+ # Returns: the user's email address (String)
74
+ # The default works for Devise's defaults
75
+ # If the mailer argument is nil, Commontator intends to hash the email and send the hash
76
+ # to Gravatar, so you should always return the user's email address (if using Gravatar)
77
+ # If the mailer argument is not nil, then Commontator intends to send an email to
78
+ # the address returned; you can prevent it from being sent by returning a blank String
79
+ # Default: lambda { |user, mailer| user.email }
80
+ config.user_email_proc = lambda { |user, mailer| user.try(:email) || '' }
81
+
82
+
83
+
84
+ # Thread/Commontable (acts_as_commontable) Configuration
85
+
86
+ # comment_filter
87
+ # Type: Arel node (Arel::Nodes::Node) or nil
88
+ # Arel that filters visible comments
89
+ # If specified, visible comments will be filtered according to this Arel node
90
+ # A value of nil will cause no filtering to be done
91
+ # Moderators can manually override this filter for themselves
92
+ # Example: Commontator::Comment.arel_table[:deleted_at].eq(nil) (hides deleted comments)
93
+ # This is not recommended, as it can cause confusion over deleted comments
94
+ # If using pagination, it can also cause comments to change pages
95
+ # Default: nil (no filtering - all comments are visible)
96
+ config.comment_filter = nil
97
+
98
+ # thread_read_proc
99
+ # Type: Proc
100
+ # Arguments: a thread (Commontator::Thread), a user (acts_as_commontator)
101
+ # Returns: a Boolean, true iif the user should be allowed to read that thread
102
+ # Note: can be called with a user object that is nil (if they are not logged in)
103
+ # Default: lambda { |thread, user| true } (anyone can read any thread)
104
+ config.thread_read_proc = lambda { |thread, user| true }
105
+
106
+ # thread_moderator_proc
107
+ # Type: Proc
108
+ # Arguments: a thread (Commontator::Thread), a user (acts_as_commontator)
109
+ # Returns: a Boolean, true iif the user is a moderator for that thread
110
+ # If you want global moderators, make this proc true for them regardless of thread
111
+ # Default: lambda { |thread, user| false } (no moderators)
112
+ config.thread_moderator_proc = lambda { |thread, user| false }
113
+
114
+ # comment_editing
115
+ # Type: Symbol
116
+ # Whether users can edit their own comments
117
+ # Valid options:
118
+ # :a (always)
119
+ # :l (only if it's the latest comment)
120
+ # :n (never)
121
+ # Default: :l
122
+ config.comment_editing = :l
123
+
124
+ # comment_deletion
125
+ # Type: Symbol
126
+ # Whether users can delete their own comments
127
+ # Valid options:
128
+ # :a (always)
129
+ # :l (only if it's the latest comment)
130
+ # :n (never)
131
+ # Note: For moderators, see the next option
132
+ # Default: :l
133
+ config.comment_deletion = :l
134
+
135
+ # moderator_permissions
136
+ # Type: Symbol
137
+ # What permissions moderators have
138
+ # Valid options:
139
+ # :e (delete and edit comments and close threads)
140
+ # :d (delete comments and close threads)
141
+ # :c (close threads only)
142
+ # Default: :d
143
+ config.moderator_permissions = :d
144
+
145
+ # comment_voting
146
+ # Type: Symbol
147
+ # Whether users can vote on other users' comments
148
+ # Valid options:
149
+ # :n (no voting)
150
+ # :l (likes - requires acts_as_votable gem)
151
+ # :ld (likes/dislikes - requires acts_as_votable gem)
152
+ # Not yet implemented:
153
+ # :s (star ratings)
154
+ # :r (reputation system)
155
+ # Default: :n
156
+ config.comment_voting = :n
157
+
158
+ # vote_count_proc
159
+ # Type: Proc
160
+ # Arguments: a thread (Commontator::Thread), pos (Fixnum), neg (Fixnum)
161
+ # Returns: vote count to be displayed (String)
162
+ # pos is the number of likes, or the rating, or the reputation
163
+ # neg is the number of dislikes, if applicable, or 0 otherwise
164
+ # Default: lambda { |thread, pos, neg| "%+d" % (pos - neg) }
165
+ config.vote_count_proc = lambda { |thread, pos, neg| "%+d" % (pos - neg) }
166
+
167
+ # comment_order
168
+ # Type: Symbol
169
+ # What order to use for comments
170
+ # Valid options:
171
+ # :e (earliest comment first)
172
+ # :l (latest comment first)
173
+ # :ve (highest voted first; earliest first if tied)
174
+ # :vl (highest voted first; latest first if tied)
175
+ # Notes:
176
+ # :e is usually used in forums (discussions)
177
+ # :l is usually used in blogs (opinions)
178
+ # :ve and :vl are usually used where it makes sense to rate comments
179
+ # based on usefulness (q&a, reviews, guides, etc.)
180
+ # If :l is selected, the "reply to thread" form will appear before the comments
181
+ # Otherwise, it will appear after the comments
182
+ # Default: :e
183
+ config.comment_order = :e
184
+
185
+ # comments_per_page
186
+ # Type: Fixnum or nil
187
+ # Number of comments to display in each page
188
+ # Set to nil to disable pagination
189
+ # Any other value requires the will_paginate gem
190
+ # Default: nil (no pagination)
191
+ config.comments_per_page = nil
192
+
193
+ # thread_subscription
194
+ # Type: Symbol
195
+ # Whether users can subscribe to threads to receive activity email notifications
196
+ # Valid options:
197
+ # :n (no subscriptions)
198
+ # :a (automatically subscribe when you comment; cannot do it manually)
199
+ # :m (manual subscriptions only)
200
+ # :b (both automatic, when commenting, and manual)
201
+ # Default: :n
202
+ config.thread_subscription = :n
203
+
204
+ # email_from_proc
205
+ # Type: Proc
206
+ # Arguments: a thread (Commontator::Thread)
207
+ # Returns: the address emails are sent "from" (String)
208
+ # Important: If using subscriptions, change this to at least match your domain name
209
+ # Default: lambda { |thread|
210
+ # "no-reply@#{Rails.application.class.parent.to_s.downcase}.com" }
211
+ config.email_from_proc = lambda { |thread|
212
+ "no-reply@#{Rails.application.class.parent.to_s.downcase}.com" }
213
+
214
+ # commontable_name_proc
215
+ # Type: Proc
216
+ # Arguments: a thread (Commontator::Thread)
217
+ # Returns: a name that refers to the commontable object (String)
218
+ # If you have multiple commontable models, you can also pass this
219
+ # configuration value as an argument to acts_as_commontable for each one
220
+ # Default: lambda { |thread|
221
+ # "#{thread.commontable.class.name} ##{thread.commontable.id}" }
222
+ config.commontable_name_proc = lambda { |thread|
223
+ "#{thread.commontable.class.name} ##{thread.commontable.id}" }
224
+
225
+ # commontable_url_proc
226
+ # Type: Proc
227
+ # Arguments: a thread (Commontator::Thread),
228
+ # the app_routes (ActionDispatch::Routing::RoutesProxy)
229
+ # Returns: a String containing the url of the view that displays the given thread
230
+ # This usually is the commontable's "show" page
231
+ # The main application's routes can be accessed through the app_routes object
232
+ # Default: lambda { |commontable, app_routes|
233
+ # app_routes.polymorphic_url(commontable) }
234
+ # (defaults to the commontable's show url)
235
+ config.commontable_url_proc = lambda { |thread, app_routes|
236
+ app_routes.polymorphic_url(thread.commontable) }
237
+ end
238
+
@@ -34,9 +34,15 @@ en:
34
34
  commontator/thread:
35
35
  commontable: Commontable
36
36
  models:
37
- commontator/comment: Comment
38
- commontator/subscription: Subscription
39
- commontator/thread: Discussion
37
+ commontator/comment:
38
+ one: comment
39
+ other: comments
40
+ commontator/subscription:
41
+ one: subscription
42
+ other: subscriptions
43
+ commontator/thread:
44
+ one: thread
45
+ other: threads
40
46
  commontator:
41
47
  anonymous: Anonymous
42
48
  comment:
@@ -76,6 +82,8 @@ en:
76
82
  not_subscribed: "You are not subscribed to this discussion."
77
83
  thread:
78
84
  actions:
85
+ show_all: "Show All Comments"
86
+ filter: "Filter Comments"
79
87
  close: "Close Discussion"
80
88
  confirm_close: "Are you sure you want to close this discussion?"
81
89
  reopen: "Reopen Discussion"
@@ -90,3 +98,4 @@ en:
90
98
  time:
91
99
  formats:
92
100
  commontator: "%b %d %Y at %I:%M%p %Z"
101
+
@@ -0,0 +1,104 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ ---
23
+ en:
24
+ activerecord:
25
+ attributes:
26
+ commontator/comment:
27
+ body: Comment
28
+ creator: Creator
29
+ editor: Editor
30
+ thread: Discussion
31
+ commontator/subscription:
32
+ subscriber: Subscriber
33
+ thread: Discussion
34
+ commontator/thread:
35
+ commontable: Commontable
36
+ models:
37
+ commontator/comment:
38
+ zero: comments
39
+ one: comment
40
+ other: comments
41
+ commontator/subscription:
42
+ zero: subscriptions
43
+ one: subscription
44
+ other: subscriptions
45
+ commontator/thread:
46
+ zero: threads
47
+ one: thread
48
+ other: threads
49
+ commontator:
50
+ anonymous: Anonymous
51
+ comment:
52
+ actions:
53
+ cancel: Cancel
54
+ confirm_delete: "Are you sure you want to delete this comment?"
55
+ create: "Post Comment"
56
+ delete: Delete
57
+ edit: Edit
58
+ new: "New Comment"
59
+ undelete: Undelete
60
+ update: "Modify Comment"
61
+ errors:
62
+ already_deleted: "This comment has already been deleted."
63
+ create: "This comment could not be posted because:"
64
+ double_posted: "is a duplicate of another comment."
65
+ not_deleted: "This comment is not deleted."
66
+ update: "This comment could not be modified because:"
67
+ status:
68
+ created_at: "Posted on %{created_at}."
69
+ deleted_by: "Comment deleted by %{deleter_name}."
70
+ updated_at: "Last modified by %{editor_name} on %{updated_at}."
71
+ email:
72
+ comment_created:
73
+ body: "%{creator_name} commented on %{commontable_name}:"
74
+ subject: "%{creator_name} posted a comment on %{commontable_name}"
75
+ thread_link_html: "<a href=\"%{commontable_url}\">Click here</a> to view all comments on %{commontable_name}."
76
+ undisclosed_recipients: "Undisclosed Recipients"
77
+ require_login: "You must login before you can post a comment."
78
+ subscription:
79
+ actions:
80
+ confirm_unsubscribe: "Are you sure you want to unsubscribe from this discussion?"
81
+ subscribe: Subscribe
82
+ unsubscribe: Unsubscribe
83
+ errors:
84
+ already_subscribed: "You are already subscribed to this discussion."
85
+ not_subscribed: "You are not subscribed to this discussion."
86
+ thread:
87
+ actions:
88
+ show_all: "Show All Comments"
89
+ filter: "Filter Comments"
90
+ close: "Close Discussion"
91
+ confirm_close: "Are you sure you want to close this discussion?"
92
+ reopen: "Reopen Discussion"
93
+ show: "Show Comments"
94
+ errors:
95
+ already_closed: "This discussion has already been closed."
96
+ not_closed: "This discussion is not closed."
97
+ status:
98
+ cannot_post: "New comments cannot be posted at this time."
99
+ closed: "Comments (Closed by %{closer_name})"
100
+ open: Comments
101
+ time:
102
+ formats:
103
+ commontator: "%b %d %Y at %I:%M%p %Z"
104
+
@@ -20,3 +20,4 @@ Commontator::Engine.routes.draw do
20
20
  end
21
21
  end
22
22
  end
23
+
@@ -8,31 +8,28 @@ class InstallCommontator < ActiveRecord::Migration
8
8
  t.integer 'thread_id', :null => false
9
9
  t.text 'body', :null => false
10
10
  t.datetime 'deleted_at'
11
-
12
- t.integer 'cached_votes_total', :default => 0
13
- t.integer 'cached_votes_up', :default => 0
14
- t.integer 'cached_votes_down', :default => 0
11
+
12
+ t.integer :cached_votes_up, :default => 0
13
+ t.integer :cached_votes_down, :default => 0
15
14
 
16
15
  t.timestamps
17
16
  end
18
17
 
19
- add_index :commontator_comments, [:creator_id, :creator_type, :thread_id], :name => 'index_c_c_on_c_id_and_c_type_and_t_id'
18
+ add_index :commontator_comments, [:creator_id, :creator_type, :thread_id], :name => 'index_commontator_comments_on_c_id_and_c_type_and_t_id'
20
19
  add_index :commontator_comments, :thread_id
21
20
 
22
- add_index :commontator_comments, :cached_votes_total
23
- add_index :commontator_comments, :cached_votes_up
24
- add_index :commontator_comments, :cached_votes_down
21
+ add_index :commontator_comments, :cached_votes_up
22
+ add_index :commontator_comments, :cached_votes_down
25
23
 
26
24
  create_table 'commontator_subscriptions' do |t|
27
25
  t.string 'subscriber_type', :null => false
28
26
  t.integer 'subscriber_id', :null => false
29
27
  t.integer 'thread_id', :null => false
30
- t.integer 'unread', :null => false, :default => 0
31
28
 
32
29
  t.timestamps
33
30
  end
34
31
 
35
- add_index :commontator_subscriptions, [:subscriber_id, :subscriber_type, :thread_id], :unique => true, :name => 'index_c_s_on_s_id_and_s_type_and_t_id'
32
+ add_index :commontator_subscriptions, [:subscriber_id, :subscriber_type, :thread_id], :unique => true, :name => 'index_commontator_subscriptions_on_s_id_and_s_type_and_t_id'
36
33
  add_index :commontator_subscriptions, :thread_id
37
34
 
38
35
  create_table 'commontator_threads' do |t|
@@ -45,6 +42,7 @@ class InstallCommontator < ActiveRecord::Migration
45
42
  t.timestamps
46
43
  end
47
44
 
48
- add_index :commontator_threads, [:commontable_id, :commontable_type], :unique => true, :name => 'index_c_t_on_c_id_and_c_type'
45
+ add_index :commontator_threads, [:commontable_id, :commontable_type], :unique => true, :name => 'index_commontator_threads_on_c_id_and_c_type'
49
46
  end
50
47
  end
48
+
@@ -0,0 +1,54 @@
1
+ class InstallCommontator < ActiveRecord::Migration
2
+ def change
3
+ create_table 'commontator_comments' do |t|
4
+ t.string 'creator_type'
5
+ t.integer 'creator_id'
6
+ t.string 'editor_type'
7
+ t.integer 'editor_id'
8
+ t.integer 'thread_id', :null => false
9
+ t.text 'body', :null => false
10
+ t.datetime 'deleted_at'
11
+
12
+ t.integer :cached_votes_total, :default => 0
13
+ t.integer :cached_votes_score, :default => 0
14
+ t.integer :cached_votes_up, :default => 0
15
+ t.integer :cached_votes_down, :default => 0
16
+ t.integer :cached_weighted_score, :default => 0
17
+
18
+ t.timestamps
19
+ end
20
+
21
+ add_index :commontator_comments, [:creator_id, :creator_type, :thread_id], :name => 'index_commontator_comments_on_c_id_and_c_type_and_t_id'
22
+ add_index :commontator_comments, :thread_id
23
+
24
+ add_index :commontator_comments, :cached_votes_total
25
+ add_index :commontator_comments, :cached_votes_score
26
+ add_index :commontator_comments, :cached_votes_up
27
+ add_index :commontator_comments, :cached_votes_down
28
+ add_index :commontator_comments, :cached_weighted_score
29
+
30
+ create_table 'commontator_subscriptions' do |t|
31
+ t.string 'subscriber_type', :null => false
32
+ t.integer 'subscriber_id', :null => false
33
+ t.integer 'thread_id', :null => false
34
+
35
+ t.timestamps
36
+ end
37
+
38
+ add_index :commontator_subscriptions, [:subscriber_id, :subscriber_type, :thread_id], :unique => true, :name => 'index_commontator_subscriptions_on_s_id_and_s_type_and_t_id'
39
+ add_index :commontator_subscriptions, :thread_id
40
+
41
+ create_table 'commontator_threads' do |t|
42
+ t.string 'commontable_type'
43
+ t.integer 'commontable_id'
44
+ t.datetime 'closed_at'
45
+ t.string 'closer_type'
46
+ t.integer 'closer_id'
47
+
48
+ t.timestamps
49
+ end
50
+
51
+ add_index :commontator_threads, [:commontable_id, :commontable_type], :unique => true, :name => 'index_commontator_threads_on_c_id_and_c_type'
52
+ end
53
+ end
54
+