commontator 0.1.46 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +1 -1
- data/README.md +99 -8
- data/app/mailers/commontator/subscriptions_mailer.rb +1 -4
- data/app/mailers/commontator/subscriptions_mailer.rb~ +1 -3
- data/app/models/commontator/comment.rb +0 -2
- data/app/models/commontator/comment.rb~ +1 -1
- data/app/models/commontator/subscription.rb +0 -2
- data/app/models/commontator/subscription.rb~ +2 -2
- data/app/models/commontator/thread.rb +22 -17
- data/app/models/commontator/thread.rb~ +22 -20
- data/config/initializers/commontator.rb +160 -3
- data/config/initializers/commontator.rb~ +164 -0
- data/db/migrate/{0_install_commontator.rb → 0_install.rb} +8 -0
- data/db/migrate/0_install_commontator.rb~ +9 -1
- data/lib/commontator.rb +46 -49
- data/lib/commontator.rb~ +46 -49
- data/lib/commontator/commontable_config.rb +2 -2
- data/lib/commontator/commontable_config.rb~ +13 -0
- data/lib/commontator/commontator_config.rb +2 -2
- data/lib/commontator/commontator_config.rb~ +13 -0
- data/lib/commontator/version.rb +1 -1
- data/lib/commontator/version.rb~ +1 -1
- data/lib/tasks/commontator_tasks.rake +38 -0
- data/lib/tasks/commontator_tasks.rake~ +39 -0
- data/test/dummy/config/initializers/commontator.rb +164 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/1_install.commontator.rb +49 -0
- data/test/dummy/db/schema.rb +46 -1
- data/test/dummy/log/development.log +72 -0
- metadata +11 -3
- data/app/views/layouts/commontator/application.html.erb +0 -14
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,25 +1,116 @@
|
|
1
1
|
# Common Tator
|
2
2
|
|
3
3
|
A Rails engine for comments
|
4
|
-
This is not ready for use yet. We recommend you do not use this gem until it is done.
|
5
4
|
|
6
5
|
## Installation
|
7
6
|
|
8
|
-
|
7
|
+
There are 4 steps you must follow to install commontator:
|
9
8
|
|
10
|
-
|
9
|
+
1. Gem
|
11
10
|
|
12
|
-
|
11
|
+
Add this line to your application's Gemfile:
|
13
12
|
|
14
|
-
|
13
|
+
```ruby
|
14
|
+
gem 'commontator', '~> 0.2.0'
|
15
|
+
```
|
15
16
|
|
16
|
-
|
17
|
+
And then execute:
|
17
18
|
|
18
|
-
|
19
|
+
```sh
|
20
|
+
$ bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
$ gem install commontator
|
27
|
+
```
|
28
|
+
|
29
|
+
2. Initializer and Migration
|
30
|
+
|
31
|
+
Run the following command to copy commontator's initializer and migration to your own app:
|
32
|
+
|
33
|
+
```sh
|
34
|
+
$ rake commontator:install
|
35
|
+
```
|
36
|
+
|
37
|
+
And then execute:
|
38
|
+
|
39
|
+
```sh
|
40
|
+
$ rake db:migrate
|
41
|
+
```
|
42
|
+
|
43
|
+
Or run each rake task manually:
|
44
|
+
|
45
|
+
```sh
|
46
|
+
$ rake commontator:install:initializers
|
47
|
+
|
48
|
+
$ rake commontator:install:migrations
|
49
|
+
|
50
|
+
$ rake db:migrate
|
51
|
+
```
|
52
|
+
|
53
|
+
3. Configuration
|
54
|
+
|
55
|
+
Change commontator's configurations to suit your needs by editing config/intializers/commontator.rb.
|
56
|
+
|
57
|
+
4. Routes
|
58
|
+
|
59
|
+
Add this line to your application's routes file:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
mount Commontator::Engine => "/commontator"
|
63
|
+
```
|
64
|
+
|
65
|
+
You can change the mount path if you would like a different one.
|
19
66
|
|
20
67
|
## Usage
|
21
68
|
|
22
|
-
|
69
|
+
Follow the steps below to add commontator to your models and views:
|
70
|
+
|
71
|
+
1. Models
|
72
|
+
|
73
|
+
Add this line to your user model(s) (or any models that should be able to make comments):
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
acts_as_commontator
|
77
|
+
```
|
78
|
+
|
79
|
+
Add this line to any models you want to be able to comment on:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
acts_as_commontable
|
83
|
+
```
|
84
|
+
|
85
|
+
2. Views
|
86
|
+
|
87
|
+
Add the following line to any view where you want to display comments:
|
88
|
+
|
89
|
+
```erb
|
90
|
+
<%= commontator_thread_link(commontable) %>
|
91
|
+
```
|
92
|
+
|
93
|
+
Where commontable is an instance of some model that acts_as_commontable.
|
94
|
+
|
95
|
+
That's it! Commontator is now ready for use.
|
96
|
+
|
97
|
+
## Customization
|
98
|
+
|
99
|
+
Copy commontator's files to your app using any of the following commands:
|
100
|
+
|
101
|
+
```sh
|
102
|
+
rake commontator:copy:images
|
103
|
+
rake commontator:copy:stylesheets
|
104
|
+
|
105
|
+
rake commontator:copy:views
|
106
|
+
rake commontator:copy:mailers
|
107
|
+
rake commontator:copy:helpers
|
108
|
+
|
109
|
+
rake commontator:copy:controllers
|
110
|
+
rake commontator:copy:models
|
111
|
+
```
|
112
|
+
|
113
|
+
You are now free to modify them and have any changes made manifest in your application.
|
23
114
|
|
24
115
|
## Contributing
|
25
116
|
|
@@ -8,8 +8,7 @@ module Commontator
|
|
8
8
|
setup_variables(comment)
|
9
9
|
|
10
10
|
mail(:bcc => @bcc,
|
11
|
-
:subject => @subject
|
12
|
-
:body => @body)
|
11
|
+
:subject => @subject)
|
13
12
|
end
|
14
13
|
|
15
14
|
protected
|
@@ -43,8 +42,6 @@ protected
|
|
43
42
|
params[:commontable_id] = @commontable_id
|
44
43
|
|
45
44
|
@subject = @config.subscription_email_subject_proc.call(params)
|
46
|
-
@body = @config.subscription_email_body_proc.blank? ? nil : \
|
47
|
-
@config.subscription_email_body_proc.call?(params)
|
48
45
|
end
|
49
46
|
|
50
47
|
end
|
@@ -42,9 +42,7 @@ protected
|
|
42
42
|
params[:commontable_name] = @commontable_name
|
43
43
|
params[:commontable_id] = @commontable_id
|
44
44
|
|
45
|
-
@subject =
|
46
|
-
@body = params[:config].subscription_email_body_proc.blank? ? nil : \
|
47
|
-
params[:config].subscription_email_body_proc.call?(params)
|
45
|
+
@subject = @config.subscription_email_subject_proc.call(params)
|
48
46
|
end
|
49
47
|
|
50
48
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Commontator
|
2
2
|
class Comment < ActiveRecord::Base
|
3
|
-
|
4
3
|
belongs_to :commontator, :polymorphic => true
|
5
4
|
belongs_to :deleter, :polymorphic => true
|
6
5
|
belongs_to :thread
|
@@ -79,6 +78,5 @@ module Commontator
|
|
79
78
|
can_be_voted_on? && !thread.is_closed? &&\
|
80
79
|
thread.can_be_read_by?(user) && user != commontator
|
81
80
|
end
|
82
|
-
|
83
81
|
end
|
84
82
|
end
|
@@ -65,7 +65,7 @@ module Commontator
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def can_be_deleted_by?(user)
|
68
|
-
!thread.is_closed?
|
68
|
+
!thread.is_closed? &&\
|
69
69
|
((user == commontator && thread.config.can_delete_own_comments) &&\
|
70
70
|
(thread.comments.last == self || thread.config.can_delete_old_comments)) ||\
|
71
71
|
thread.can_be_edited_by?(user)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Commontator
|
2
2
|
class Subscription < ActiveRecord::Base
|
3
|
-
|
4
3
|
belongs_to :subscriber, :polymorphic => true
|
5
4
|
belongs_to :thread
|
6
5
|
|
@@ -16,6 +15,5 @@ module Commontator
|
|
16
15
|
def mark_as_unread
|
17
16
|
self.update_attribute(:is_unread, true)
|
18
17
|
end
|
19
|
-
|
20
18
|
end
|
21
19
|
end
|
@@ -4,11 +4,11 @@ module Commontator
|
|
4
4
|
belongs_to :subscriber, :polymorphic => true
|
5
5
|
belongs_to :thread
|
6
6
|
|
7
|
-
attr_accessible :subscriber, :thread
|
8
|
-
|
9
7
|
validates_presence_of :subscriber, :thread
|
10
8
|
validates_uniqueness_of :thread_id, :scope => [:subscriber_id, :subscriber_type]
|
11
9
|
|
10
|
+
attr_accessible :subscriber, :thread
|
11
|
+
|
12
12
|
def mark_as_read
|
13
13
|
self.update_attribute(:is_unread, false)
|
14
14
|
end
|
@@ -1,16 +1,24 @@
|
|
1
1
|
module Commontator
|
2
2
|
class Thread < ActiveRecord::Base
|
3
|
-
|
4
3
|
belongs_to :closer, :polymorphic => true
|
5
4
|
belongs_to :commontable, :polymorphic => true
|
6
5
|
|
7
6
|
has_many :comments, :dependent => :destroy
|
8
7
|
has_many :subscriptions, :dependent => :destroy
|
9
8
|
|
10
|
-
validates_presence_of :commontable, :
|
9
|
+
validates_presence_of :commontable, :on => :create
|
11
10
|
|
12
11
|
attr_accessible :is_closed
|
13
12
|
|
13
|
+
def config
|
14
|
+
commontable.try(:commontable_config)
|
15
|
+
end
|
16
|
+
|
17
|
+
def comments
|
18
|
+
(!commontable.blank? && config.comments_can_be_voted_on && config.comments_ordered_by_votes) ? \
|
19
|
+
super.order("cached_votes_down - cached_votes_up") : super
|
20
|
+
end
|
21
|
+
|
14
22
|
def subscribers
|
15
23
|
subscriptions.collect{|s| s.subscriber}
|
16
24
|
end
|
@@ -23,10 +31,6 @@ module Commontator
|
|
23
31
|
!closed_at.blank?
|
24
32
|
end
|
25
33
|
|
26
|
-
def config
|
27
|
-
commontable.commontable_config
|
28
|
-
end
|
29
|
-
|
30
34
|
def is_subscribed?(user)
|
31
35
|
!subscription_for(subscriber).blank?
|
32
36
|
end
|
@@ -69,7 +73,9 @@ module Commontator
|
|
69
73
|
|
70
74
|
# Creates a new empty thread and assigns it to the commontable
|
71
75
|
# The old thread is kept in the database for archival purposes
|
76
|
+
|
72
77
|
def clear(user = nil)
|
78
|
+
return if commontable.blank?
|
73
79
|
new_thread = Thread.new
|
74
80
|
new_thread.commontable = commontable
|
75
81
|
self.with_lock do
|
@@ -91,27 +97,27 @@ module Commontator
|
|
91
97
|
####################
|
92
98
|
|
93
99
|
def comment_created_callback(user, comment)
|
94
|
-
commontable.send(config.comment_created_callback, user, comment) unless config.comment_created_callback.blank?
|
100
|
+
commontable.send(config.comment_created_callback, user, comment) unless commontable.blank? || config.comment_created_callback.blank?
|
95
101
|
end
|
96
102
|
|
97
103
|
def comment_edited_callback(user, comment)
|
98
|
-
commontable.send(config.comment_edited_callback, user, comment) unless config.comment_edited_callback.blank?
|
104
|
+
commontable.send(config.comment_edited_callback, user, comment) unless commontable.blank? || config.comment_edited_callback.blank?
|
99
105
|
end
|
100
106
|
|
101
107
|
def comment_deleted_callback(user, comment)
|
102
|
-
commontable.send(config.comment_deleted_callback, user, comment) unless config.comment_deleted_callback.blank?
|
108
|
+
commontable.send(config.comment_deleted_callback, user, comment) unless commontable.blank? || config.comment_deleted_callback.blank?
|
103
109
|
end
|
104
110
|
|
105
111
|
def thread_closed_callback(user)
|
106
|
-
commontable.send(config.thread_closed_callback, user) unless config.thread_closed_callback.blank?
|
112
|
+
commontable.send(config.thread_closed_callback, user) unless commontable.blank? || config.thread_closed_callback.blank?
|
107
113
|
end
|
108
114
|
|
109
115
|
def subscribe_callback(user)
|
110
|
-
commontable.send(config.subscribe_callback, user) unless config.subscribe_callback.blank?
|
116
|
+
commontable.send(config.subscribe_callback, user) unless commontable.blank? || config.subscribe_callback.blank?
|
111
117
|
end
|
112
118
|
|
113
119
|
def unsubscribe_callback(user)
|
114
|
-
commontable.send(config.unsubscribe_callback, user) unless config.unsubscribe_callback.blank?
|
120
|
+
commontable.send(config.unsubscribe_callback, user) unless commontable.blank? || config.unsubscribe_callback.blank?
|
115
121
|
end
|
116
122
|
|
117
123
|
##########################
|
@@ -119,20 +125,19 @@ module Commontator
|
|
119
125
|
##########################
|
120
126
|
|
121
127
|
def can_be_read_by?(user) # Reader and poster capabilities
|
122
|
-
((!is_closed? || config.closed_threads_are_readable) &&\
|
128
|
+
(!commontable.blank? && (!is_closed? || config.closed_threads_are_readable) &&\
|
123
129
|
config.can_read_thread_method.blank? ? true : commontable.send(config.can_read_thread_method, user)) ||\
|
124
130
|
can_be_edited_by?(user)
|
125
131
|
end
|
126
132
|
|
127
133
|
def can_be_edited_by?(user) # Thread admin capabilities
|
128
|
-
config.can_edit_thread_method.blank? ?
|
134
|
+
!commontable.blank? && (config.can_edit_thread_method.blank? ?
|
129
135
|
(user.commontator_config.is_admin_method.blank? ? false : user.send(user.commontator_config.is_admin_method)) :
|
130
|
-
commontable.send(config.can_edit_thread_method, user)
|
136
|
+
commontable.send(config.can_edit_thread_method, user))
|
131
137
|
end
|
132
138
|
|
133
139
|
def can_subscribe?(user)
|
134
|
-
config.can_subscribe_to_thread && can_be_read_by?(user)
|
140
|
+
!commontable.blank? && config.can_subscribe_to_thread && can_be_read_by?(user)
|
135
141
|
end
|
136
|
-
|
137
142
|
end
|
138
143
|
end
|
@@ -1,16 +1,24 @@
|
|
1
1
|
module Commontator
|
2
2
|
class Thread < ActiveRecord::Base
|
3
|
-
|
4
3
|
belongs_to :closer, :polymorphic => true
|
5
4
|
belongs_to :commontable, :polymorphic => true
|
6
5
|
|
7
6
|
has_many :comments, :dependent => :destroy
|
8
7
|
has_many :subscriptions, :dependent => :destroy
|
9
8
|
|
10
|
-
validates_presence_of :commontable, :
|
9
|
+
validates_presence_of :commontable, :on => :create
|
11
10
|
|
12
11
|
attr_accessible :is_closed
|
13
12
|
|
13
|
+
def config
|
14
|
+
commontable.try(:commontable_config)
|
15
|
+
end
|
16
|
+
|
17
|
+
def comments
|
18
|
+
(!commontable.blank? && config.comments_can_be_voted_on && config.comments_ordered_by_votes) ? \
|
19
|
+
super.order("cached_votes_down - cached_votes_up") : super
|
20
|
+
end
|
21
|
+
|
14
22
|
def subscribers
|
15
23
|
subscriptions.collect{|s| s.subscriber}
|
16
24
|
end
|
@@ -23,10 +31,6 @@ module Commontator
|
|
23
31
|
!closed_at.blank?
|
24
32
|
end
|
25
33
|
|
26
|
-
def config
|
27
|
-
commontable.commontable_config
|
28
|
-
end
|
29
|
-
|
30
34
|
def is_subscribed?(user)
|
31
35
|
!subscription_for(subscriber).blank?
|
32
36
|
end
|
@@ -69,7 +73,9 @@ module Commontator
|
|
69
73
|
|
70
74
|
# Creates a new empty thread and assigns it to the commontable
|
71
75
|
# The old thread is kept in the database for archival purposes
|
76
|
+
|
72
77
|
def clear(user = nil)
|
78
|
+
return if commontable.blank?
|
73
79
|
new_thread = Thread.new
|
74
80
|
new_thread.commontable = commontable
|
75
81
|
self.with_lock do
|
@@ -91,30 +97,27 @@ module Commontator
|
|
91
97
|
####################
|
92
98
|
|
93
99
|
def comment_created_callback(user, comment)
|
94
|
-
|
95
|
-
self.mark_as_unread_except_for(user)
|
96
|
-
SubscriptionMailer.comment_created_email(comment)
|
97
|
-
commontable.send(config.comment_created_callback, user, comment) unless config.comment_created_callback.blank?
|
100
|
+
commontable.send(config.comment_created_callback, user, comment) unless commontable.blank? || config.comment_created_callback.blank?
|
98
101
|
end
|
99
102
|
|
100
103
|
def comment_edited_callback(user, comment)
|
101
|
-
commontable.send(config.comment_edited_callback, user, comment) unless config.comment_edited_callback.blank?
|
104
|
+
commontable.send(config.comment_edited_callback, user, comment) unless commontable.blank? || config.comment_edited_callback.blank?
|
102
105
|
end
|
103
106
|
|
104
107
|
def comment_deleted_callback(user, comment)
|
105
|
-
commontable.send(config.comment_deleted_callback, user, comment) unless config.comment_deleted_callback.blank?
|
108
|
+
commontable.send(config.comment_deleted_callback, user, comment) unless commontable.blank? || config.comment_deleted_callback.blank?
|
106
109
|
end
|
107
110
|
|
108
111
|
def thread_closed_callback(user)
|
109
|
-
commontable.send(config.thread_closed_callback, user) unless config.thread_closed_callback.blank?
|
112
|
+
commontable.send(config.thread_closed_callback, user) unless commontable.blank? || config.thread_closed_callback.blank?
|
110
113
|
end
|
111
114
|
|
112
115
|
def subscribe_callback(user)
|
113
|
-
commontable.send(config.subscribe_callback, user) unless config.subscribe_callback.blank?
|
116
|
+
commontable.send(config.subscribe_callback, user) unless commontable.blank? || config.subscribe_callback.blank?
|
114
117
|
end
|
115
118
|
|
116
119
|
def unsubscribe_callback(user)
|
117
|
-
commontable.send(config.unsubscribe_callback, user) unless config.unsubscribe_callback.blank?
|
120
|
+
commontable.send(config.unsubscribe_callback, user) unless commontable.blank? || config.unsubscribe_callback.blank?
|
118
121
|
end
|
119
122
|
|
120
123
|
##########################
|
@@ -122,20 +125,19 @@ module Commontator
|
|
122
125
|
##########################
|
123
126
|
|
124
127
|
def can_be_read_by?(user) # Reader and poster capabilities
|
125
|
-
((!is_closed? || config.closed_threads_are_readable) &&\
|
128
|
+
(!commontable.blank? && (!is_closed? || config.closed_threads_are_readable) &&\
|
126
129
|
config.can_read_thread_method.blank? ? true : commontable.send(config.can_read_thread_method, user)) ||\
|
127
130
|
can_be_edited_by?(user)
|
128
131
|
end
|
129
132
|
|
130
133
|
def can_be_edited_by?(user) # Thread admin capabilities
|
131
|
-
config.can_edit_thread_method.blank? ?
|
134
|
+
!commontable.blank? && (config.can_edit_thread_method.blank? ?
|
132
135
|
(user.commontator_config.is_admin_method.blank? ? false : user.send(user.commontator_config.is_admin_method)) :
|
133
|
-
commontable.send(config.can_edit_thread_method, user)
|
136
|
+
commontable.send(config.can_edit_thread_method, user))
|
134
137
|
end
|
135
138
|
|
136
139
|
def can_subscribe?(user)
|
137
|
-
config.can_subscribe_to_thread && can_be_read_by?(user)
|
140
|
+
!commontable.blank? && config.can_subscribe_to_thread && can_be_read_by?(user)
|
138
141
|
end
|
139
|
-
|
140
142
|
end
|
141
143
|
end
|
@@ -1,7 +1,164 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# Change the settings below to suit your needs
|
2
|
+
# All settings are initially set to their default values
|
3
3
|
Commontator.configure do |config|
|
4
4
|
|
5
|
-
#
|
5
|
+
# Engine Configuration
|
6
|
+
|
7
|
+
# Method called on ApplicationController to return the current user
|
8
|
+
# Default: 'current_user'
|
9
|
+
config.current_user_method = 'current_user'
|
10
|
+
|
11
|
+
# Proc that is called when a view wants to set the page heading.
|
12
|
+
# Default: Proc.new {}
|
13
|
+
config.heading_proc = nil
|
14
|
+
|
15
|
+
# Proc that is called after any javascript runs (e.g. to clear flash notices)
|
16
|
+
# Default: Proc.new {}
|
17
|
+
config.javascript_proc = nil
|
18
|
+
|
19
|
+
|
20
|
+
# Commontator (User model) Configuration
|
21
|
+
|
22
|
+
# Whether the commontator's name is clickable in the comment view
|
23
|
+
# Default: false
|
24
|
+
config.commontator_name_clickable = false
|
25
|
+
|
26
|
+
# The method that return the commontator's email address
|
27
|
+
# Default: 'email'
|
28
|
+
config.commontator_email_method = 'email'
|
29
|
+
|
30
|
+
# The method that return the commontator's name
|
31
|
+
# Default: '' (Anonymous)
|
32
|
+
config.commontator_name_method = ''
|
33
|
+
|
34
|
+
# Method that returns true if the commontator is an admin for all threads
|
35
|
+
# Admins can always delete other users' comments and close threads
|
36
|
+
# Default: '' (no admins)
|
37
|
+
config.is_admin_method = ''
|
38
|
+
|
39
|
+
|
40
|
+
# Commontable (Commentable model) Configuration
|
41
|
+
|
42
|
+
# What a comment is called in your application
|
43
|
+
# Default: 'comment'
|
44
|
+
config.comment_name = 'comment'
|
45
|
+
|
46
|
+
# Verb used when creating comments (present)
|
47
|
+
# Default: 'post'
|
48
|
+
config.comment_create_verb_present = 'post'
|
49
|
+
|
50
|
+
# Verb used when creating comments (past)
|
51
|
+
# Default: 'posted'
|
52
|
+
config.comment_create_verb_past = 'posted'
|
53
|
+
|
54
|
+
# What a commontable is called in your application
|
55
|
+
# If you have multiple commontable models,
|
56
|
+
# you might want to pass this configuration value
|
57
|
+
# as an argument to acts_as_commontable in each one
|
58
|
+
# Default: 'commontable'
|
59
|
+
config.commontable_name = 'commontable'
|
60
|
+
|
61
|
+
# Proc that returns the subscription email subject
|
62
|
+
# Default: Proc.new {}
|
63
|
+
config.subscription_email_subject_proc = Proc.new {|params| \
|
64
|
+
"#{params[:commontator_name]} #{params[:config].comment_create_verb_past} a " + \
|
65
|
+
"#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}"}
|
66
|
+
|
67
|
+
# The format of the timestamps used by Commontator
|
68
|
+
# Default: '%b %d %Y, %I:%M %p'
|
69
|
+
config.timestamp_format = '%b %d %Y, %I:%M %p'
|
70
|
+
|
71
|
+
# Whether admins can edit other users' comments
|
72
|
+
# Default: false
|
73
|
+
config.admin_can_edit_comments = false
|
74
|
+
|
75
|
+
# Whether users automatically subscribe to a thread when commenting
|
76
|
+
# Default: false
|
77
|
+
config.auto_subscribe_on_comment = false
|
78
|
+
|
79
|
+
# Whether users can edit their own comments
|
80
|
+
# Default: true
|
81
|
+
config.can_edit_own_comments = true
|
82
|
+
|
83
|
+
# Whether users can edit their own comments
|
84
|
+
# after someone posted a newer comment
|
85
|
+
# Default: false
|
86
|
+
config.can_edit_old_comments = false
|
87
|
+
|
88
|
+
# Whether users can delete their own comments
|
89
|
+
# Default: false
|
90
|
+
config.can_delete_own_comments = false
|
91
|
+
|
92
|
+
# Whether users can delete their own comments
|
93
|
+
# after someone posted a newer comment
|
94
|
+
# Default: false
|
95
|
+
config.can_delete_old_comments = false
|
96
|
+
|
97
|
+
# Whether users can manually subscribe or unsubscribe to threads
|
98
|
+
# Default: true
|
99
|
+
config.can_subscribe_to_thread = true
|
100
|
+
|
101
|
+
# Whether users can vote on other users' comments
|
102
|
+
# Note: requires acts_as_votable gem installed
|
103
|
+
# and configured for your application
|
104
|
+
# Default: false
|
105
|
+
config.comments_can_be_voted_on = false
|
106
|
+
|
107
|
+
# Whether comments should be ordered by vote score
|
108
|
+
# instead of by order posted
|
109
|
+
# Default: false
|
110
|
+
config.comments_ordered_by_votes = false
|
111
|
+
|
112
|
+
# Whether users can read threads closed by admins
|
113
|
+
# Default: true
|
114
|
+
config.closed_threads_are_readable = true
|
115
|
+
|
116
|
+
# Whether comments deleted by admins can be seen
|
117
|
+
# (the content will still be hidden)
|
118
|
+
# Default: true
|
119
|
+
config.deleted_comments_are_visible = true
|
120
|
+
|
121
|
+
# Method called on commontable to return its id
|
122
|
+
# Default: 'id'
|
123
|
+
config.commontable_id_method = 'id'
|
124
|
+
|
125
|
+
# Method called on commontable and passed user as argument
|
126
|
+
# If true, that user is an admin for that particular commontable's thread
|
127
|
+
# Default: '' (no thread-specific admins)
|
128
|
+
config.can_edit_thread_method = ''
|
129
|
+
|
130
|
+
# Method called on commontable and passed user as argument
|
131
|
+
# If true, that user is allowed to read that commontable's thread
|
132
|
+
# Default: '' (no read restrictions)
|
133
|
+
config.can_read_thread_method = ''
|
134
|
+
|
135
|
+
# Method called on commontable when a comment is created
|
136
|
+
# Passed user, comment as arguments
|
137
|
+
# Default: '' (no callback)
|
138
|
+
config.comment_created_callback = ''
|
139
|
+
|
140
|
+
# Method called on commontable when a comment is edited
|
141
|
+
# Passed user, comment as arguments
|
142
|
+
# Default: '' (no callback)
|
143
|
+
config.comment_edited_callback = ''
|
144
|
+
|
145
|
+
# Method called on commontable when a comment is deleted
|
146
|
+
# Passed user, comment as arguments
|
147
|
+
# Default: '' (no callback)
|
148
|
+
config.comment_deleted_callback = ''
|
149
|
+
|
150
|
+
# Method called on commontable when a thread is closed
|
151
|
+
# Passed user as argument
|
152
|
+
# Default: '' (no callback)
|
153
|
+
config.thread_closed_callback = ''
|
154
|
+
|
155
|
+
# Method called on commontable when a thread is subscribed to
|
156
|
+
# Passed user as argument
|
157
|
+
# Default: '' (no callback)
|
158
|
+
config.subscribe_callback = ''
|
6
159
|
|
160
|
+
# Method called on commontable when a thread is unsubscribed to
|
161
|
+
# Passed user as argument
|
162
|
+
# Default: '' (no callback)
|
163
|
+
config.unsubscribe_callback = ''
|
7
164
|
end
|