commontator 0.4.1 → 0.5.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +35 -23
- data/app/assets/stylesheets/commontator/comments.css +1 -1
- data/app/assets/stylesheets/commontator/comments.css~ +0 -4
- data/app/controllers/commontator/application_controller.rb +4 -5
- data/app/controllers/commontator/application_controller.rb~ +5 -5
- data/app/controllers/commontator/comments_controller.rb +30 -30
- data/app/controllers/commontator/comments_controller.rb~ +31 -31
- data/app/controllers/commontator/subscriptions_controller.rb +8 -7
- data/app/controllers/commontator/subscriptions_controller.rb~ +6 -7
- data/app/controllers/commontator/threads_controller.rb +8 -9
- data/app/controllers/commontator/threads_controller.rb~ +9 -10
- data/app/helpers/commontator/comments_helper.rb~ +14 -24
- data/app/helpers/commontator/subscriptions_helper.rb~ +3 -3
- data/app/helpers/commontator/threads_helper.rb +0 -8
- data/app/helpers/commontator/threads_helper.rb~ +5 -5
- data/app/mailers/commontator/subscriptions_mailer.rb +8 -8
- data/app/mailers/commontator/subscriptions_mailer.rb~ +9 -10
- data/app/models/commontator/comment.rb +14 -6
- data/app/models/commontator/comment.rb~ +15 -12
- data/app/views/commontator/comments/_actions.html.erb +6 -5
- data/app/views/commontator/comments/_actions.html.erb~ +6 -5
- data/app/views/commontator/comments/_body.html.erb +2 -1
- data/app/views/commontator/comments/_body.html.erb~ +1 -2
- data/app/views/commontator/comments/_form.html.erb +8 -3
- data/app/views/commontator/comments/_form.html.erb~ +7 -4
- data/app/views/commontator/comments/_show.html.erb +11 -8
- data/app/views/commontator/comments/_show.html.erb~ +11 -8
- data/app/views/commontator/comments/_votes.html.erb +7 -6
- data/app/views/commontator/comments/create.js.erb +4 -2
- data/app/views/commontator/comments/delete.js.erb +5 -3
- data/app/views/commontator/comments/delete.js.erb~ +5 -3
- data/app/views/commontator/comments/update.js.erb +1 -1
- data/app/views/commontator/comments/update.js.erb~ +1 -1
- data/app/views/commontator/comments/vote.js.erb +2 -1
- data/app/views/commontator/shared/_thread.html.erb +17 -0
- data/app/views/commontator/shared/_thread.html.erb~ +16 -0
- data/app/views/commontator/shared/_thread_link.html.erb~ +16 -0
- data/app/views/commontator/subscriptions/_link.html.erb +3 -2
- data/app/views/commontator/subscriptions/subscribe.js.erb +2 -1
- data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb +1 -1
- data/app/views/commontator/threads/_show.html.erb +18 -11
- data/app/views/commontator/threads/_show.html.erb~ +18 -11
- data/app/views/commontator/threads/show.js.erb +2 -1
- data/config/initializers/commontator.rb +14 -14
- data/db/migrate/0_install_commontator.rb +3 -3
- data/lib/commontator.rb +5 -6
- data/lib/commontator.rb~ +5 -6
- data/lib/commontator/acts_as_commontable.rb +2 -0
- data/lib/commontator/acts_as_commontator.rb +2 -0
- data/lib/commontator/controller_includes.rb +23 -0
- data/lib/commontator/controller_includes.rb~ +23 -0
- data/lib/commontator/shared_helper.rb +42 -0
- data/lib/commontator/shared_helper.rb~ +42 -0
- data/lib/commontator/shared_methods.rb~ +24 -0
- data/lib/commontator/version.rb +1 -1
- data/lib/commontator/version.rb~ +1 -1
- data/test/dummy/config/initializers/commontator.rb +15 -15
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/1_install_commontator.commontator.rb +3 -3
- data/test/dummy/db/schema.rb +3 -3
- data/test/dummy/log/development.log +64 -0
- metadata +10 -70
- data/app/assets/stylesheets/commontator/application.css~ +0 -88
- data/app/assets/stylesheets/commontator/threads.css~ +0 -13
- data/app/helpers/commontator/application_helper.rb~ +0 -11
- data/app/helpers/commontator/comments_helper.rb +0 -51
- data/app/helpers/commontator/commontable_helper.rb~ +0 -9
- data/app/helpers/commontator/commontator_helper.rb +0 -8
- data/app/helpers/commontator/commontator_helper.rb~ +0 -8
- data/app/helpers/commontator/subscriptions_helper.rb +0 -8
- data/app/mailers/commontator/subscription_mailer.rb~ +0 -38
- data/app/models/commontator/subscription.rb~ +0 -21
- data/app/models/commontator/thread.rb~ +0 -143
- data/app/views/commontator/comments/_votes.html.erb~ +0 -62
- data/app/views/commontator/comments/create.js.erb~ +0 -15
- data/app/views/commontator/comments/destroy.js.erb~ +0 -1
- data/app/views/commontator/comments/edit.html.erb~ +0 -6
- data/app/views/commontator/comments/edit.js.erb~ +0 -5
- data/app/views/commontator/comments/new.html.erb~ +0 -8
- data/app/views/commontator/comments/new.js.erb~ +0 -12
- data/app/views/commontator/comments/vote.js.erb~ +0 -5
- data/app/views/commontator/shared/_thread_link.html.erb +0 -13
- data/app/views/commontator/subscriptions/_index.html.erb~ +0 -16
- data/app/views/commontator/subscriptions/_link.html.erb~ +0 -15
- data/app/views/commontator/subscriptions/_subscription_link.html.erb~ +0 -13
- data/app/views/commontator/subscriptions/create.js.erb~ +0 -5
- data/app/views/commontator/subscriptions/destroy.js.erb~ +0 -3
- data/app/views/commontator/subscriptions/index.html.erb~ +0 -16
- data/app/views/commontator/subscriptions/subscribe.js.erb~ +0 -5
- data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb~ +0 -6
- data/app/views/commontator/threads/_actions.html.erb~ +0 -28
- data/app/views/commontator/threads/_link.html.erb~ +0 -14
- data/app/views/commontator/threads/close.js.erb~ +0 -5
- data/app/views/commontator/threads/show.html.erb~ +0 -3
- data/app/views/commontator/threads/show.js.erb~ +0 -6
- data/config/initializers/commontator.rb~ +0 -179
- data/config/routes.rb~ +0 -24
- data/db/migrate/0_install_commontator.rb~ +0 -48
- data/lib/commontator/acts_as_commontable.rb~ +0 -39
- data/lib/commontator/acts_as_commontator.rb~ +0 -28
- data/lib/commontator/commontable_config.rb~ +0 -13
- data/lib/commontator/commontator_config.rb~ +0 -13
- data/lib/commontator/routes.rb~ +0 -37
- data/lib/tasks/commontator_tasks.rake~ +0 -41
- data/test/dummy/config/initializers/commontator.rb~ +0 -179
- data/test/dummy/config/routes.rb~ +0 -3
- data/test/functional/comment_thread_subscriptions_controller_test.rb~ +0 -125
- data/test/functional/comments_controller_test.rb~ +0 -184
- data/test/functional/subscriptions_controller_test.rb~ +0 -122
- data/test/unit/comment_test.rb~ +0 -38
- data/test/unit/comment_thread_subscription_test.rb~ +0 -18
- data/test/unit/comment_thread_test.rb~ +0 -60
- data/test/unit/helpers/comment_thread_subscriptions_helper_test.rb~ +0 -7
- data/test/unit/helpers/comments_helper_test.rb~ +0 -7
- data/test/unit/helpers/subscriptions_helper_test.rb~ +0 -4
- data/test/unit/subscription_test.rb~ +0 -15
- data/test/unit/thread_test.rb~ +0 -57
@@ -1,9 +1,10 @@
|
|
1
|
-
<% # Clients of this partial must supply the following
|
1
|
+
<% # Clients of this partial must supply the following variables:
|
2
2
|
# thread
|
3
|
+
# user
|
3
4
|
%>
|
4
5
|
|
5
|
-
<% can_subscribe = thread.can_subscribe?(
|
6
|
-
<% can_edit = thread.can_be_edited_by?(
|
6
|
+
<% can_subscribe = thread.can_subscribe?(user) %>
|
7
|
+
<% can_edit = thread.can_be_edited_by?(user) %>
|
7
8
|
|
8
9
|
<span id="thread_<%= thread.id.to_s %>_header_span" class="thread_header">
|
9
10
|
<%= thread.config.comment_name.capitalize.pluralize %>
|
@@ -13,7 +14,8 @@
|
|
13
14
|
<% if can_subscribe %>
|
14
15
|
<span id="thread_<%= thread.id.to_s %>_subscription_span" class="thread_subscription">
|
15
16
|
<%= render :partial => 'commontator/subscriptions/link',
|
16
|
-
:locals => {:thread => thread
|
17
|
+
:locals => {:thread => thread,
|
18
|
+
:user => user} %>
|
17
19
|
</span>
|
18
20
|
<% end %>
|
19
21
|
|
@@ -23,9 +25,9 @@
|
|
23
25
|
<% is_closed = thread.is_closed? %>
|
24
26
|
<% close_string = is_closed ? "reopen" : "close" %>
|
25
27
|
<%= link_to close_string.capitalize,
|
26
|
-
polymorphic_path([close_string, thread]),
|
28
|
+
commontator.polymorphic_path([close_string, thread]),
|
27
29
|
:confirm => (!is_closed ? \
|
28
|
-
'Are you sure you want to close this thread' : nil),
|
30
|
+
'Are you sure you want to close this thread?' : nil),
|
29
31
|
:method => :put,
|
30
32
|
:id => "thread_#{thread.id.to_s}_#{close_string}_link",
|
31
33
|
:class => "thread_#{close_string}_link" %>
|
@@ -34,21 +36,26 @@
|
|
34
36
|
|
35
37
|
<div id="thread_<%= thread.id.to_s %>_comment_list_div" class="thread_comment_list">
|
36
38
|
<% thread.ordered_comments.each do |comment| %>
|
37
|
-
<% next unless comment.can_be_read_by?(
|
39
|
+
<% next unless comment.can_be_read_by?(user) %>
|
38
40
|
<%= render :partial => 'commontator/comments/show',
|
39
|
-
:locals => {:comment => comment
|
41
|
+
:locals => {:comment => comment,
|
42
|
+
:user => user} %>
|
40
43
|
<% end %>
|
41
44
|
</div>
|
42
45
|
|
43
|
-
|
46
|
+
<br/>
|
44
47
|
|
45
|
-
|
48
|
+
<% if thread.is_closed? %>
|
49
|
+
|
50
|
+
<p><%= thread.config.comment_name.capitalize.pluralize %> cannot be <%= thread.config.comment_create_verb_past %> at this time.</p>
|
51
|
+
|
52
|
+
<% else %>
|
46
53
|
|
47
54
|
<div id="thread_<%= thread.id %>_new_comment_div" class="thread_new_comment"></div>
|
48
55
|
|
49
56
|
<span id="thread_<%= thread.id %>_new_comment_link_span" class="thread_new_comment_link">
|
50
57
|
<%= link_to thread.config.comment_create_verb_present.capitalize + ' ' + thread.config.comment_name,
|
51
|
-
new_thread_comment_path(thread), :remote => true %>
|
58
|
+
commontator.new_thread_comment_path(thread), :remote => true %>
|
52
59
|
</span>
|
53
60
|
|
54
61
|
<% end %>
|
@@ -16,31 +16,31 @@ Commontator.configure do |config|
|
|
16
16
|
config.javascript_proc = lambda { |view| '$("#error_explanation").remove();' }
|
17
17
|
|
18
18
|
|
19
|
-
#
|
19
|
+
# User (acts_as_commontator) Configuration
|
20
20
|
|
21
|
-
# The name used if the
|
21
|
+
# The name used if the user's name cannot be retrieved
|
22
22
|
# Default: 'Anonymous'
|
23
|
-
config.
|
23
|
+
config.user_missing_name = 'Anonymous'
|
24
24
|
|
25
|
-
# Whether the
|
25
|
+
# Whether the user's name is clickable in the comment view
|
26
26
|
# Default: false
|
27
|
-
config.
|
27
|
+
config.user_name_clickable = false
|
28
28
|
|
29
|
-
# The method that
|
29
|
+
# The method that returns the user's email address
|
30
30
|
# Default: 'email'
|
31
|
-
config.
|
31
|
+
config.user_email_method = 'email'
|
32
32
|
|
33
|
-
# The method that
|
34
|
-
# Default: '' (use
|
35
|
-
config.
|
33
|
+
# The method that returns the user's name
|
34
|
+
# Default: '' (use user_missing_name)
|
35
|
+
config.user_name_method = ''
|
36
36
|
|
37
|
-
# Method that returns true if the
|
37
|
+
# Method that returns true if the user is an admin for all threads
|
38
38
|
# Admins can always delete other users' comments and close threads
|
39
39
|
# Default: '' (no admins)
|
40
40
|
config.is_admin_method = ''
|
41
41
|
|
42
42
|
|
43
|
-
# Commontable (
|
43
|
+
# Commontable (acts_as_commontable) Configuration
|
44
44
|
|
45
45
|
# What a comment is called in your application
|
46
46
|
# Default: 'comment'
|
@@ -70,11 +70,11 @@ Commontator.configure do |config|
|
|
70
70
|
# Proc that returns the subscription email subject
|
71
71
|
# Default:
|
72
72
|
# lambda do |params|
|
73
|
-
# "#{params[:
|
73
|
+
# "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \
|
74
74
|
# "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}"
|
75
75
|
# end
|
76
76
|
config.subscription_email_subject_proc = lambda do |params|
|
77
|
-
"#{params[:
|
77
|
+
"#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \
|
78
78
|
"#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}"
|
79
79
|
end
|
80
80
|
|
@@ -2,8 +2,8 @@ class InstallCommontator < ActiveRecord::Migration
|
|
2
2
|
def change
|
3
3
|
create_table "commontator_comments" do |t|
|
4
4
|
t.text "body"
|
5
|
-
t.integer "
|
6
|
-
t.string "
|
5
|
+
t.integer "creator_id"
|
6
|
+
t.string "creator_type"
|
7
7
|
t.datetime "deleted_at"
|
8
8
|
t.integer "deleter_id"
|
9
9
|
t.string "deleter_type"
|
@@ -35,7 +35,7 @@ class InstallCommontator < ActiveRecord::Migration
|
|
35
35
|
t.timestamps
|
36
36
|
end
|
37
37
|
|
38
|
-
add_index :commontator_comments, [:
|
38
|
+
add_index :commontator_comments, [:creator_id, :creator_type, :thread_id], :name => "index_c_c_on_c_id_and_c_type_and_t_id"
|
39
39
|
add_index :commontator_comments, :thread_id
|
40
40
|
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"
|
41
41
|
add_index :commontator_subscriptions, :thread_id
|
data/lib/commontator.rb
CHANGED
@@ -9,10 +9,10 @@ module Commontator
|
|
9
9
|
|
10
10
|
# Can be set in initializer or passed as an option to acts_as_commontator
|
11
11
|
COMMONTATOR_ATTRIBUTES = [
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
12
|
+
:user_missing_name,
|
13
|
+
:user_name_clickable,
|
14
|
+
:user_email_method,
|
15
|
+
:user_name_method,
|
16
16
|
:is_admin_method
|
17
17
|
]
|
18
18
|
|
@@ -58,7 +58,6 @@ module Commontator
|
|
58
58
|
end
|
59
59
|
|
60
60
|
require 'commontator/engine'
|
61
|
-
require 'commontator/commontator_config'
|
62
|
-
require 'commontator/commontable_config'
|
63
61
|
require 'commontator/acts_as_commontator'
|
64
62
|
require 'commontator/acts_as_commontable'
|
63
|
+
require 'commontator/controller_includes'
|
data/lib/commontator.rb~
CHANGED
@@ -9,10 +9,10 @@ module Commontator
|
|
9
9
|
|
10
10
|
# Can be set in initializer or passed as an option to acts_as_commontator
|
11
11
|
COMMONTATOR_ATTRIBUTES = [
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
12
|
+
:user_missing_name,
|
13
|
+
:user_name_clickable,
|
14
|
+
:user_email_method,
|
15
|
+
:user_name_method,
|
16
16
|
:is_admin_method
|
17
17
|
]
|
18
18
|
|
@@ -58,7 +58,6 @@ module Commontator
|
|
58
58
|
end
|
59
59
|
|
60
60
|
require 'commontator/engine'
|
61
|
-
require 'commontator/commontator_config'
|
62
|
-
require 'commontator/commontable_config'
|
63
61
|
require 'commontator/acts_as_commontator'
|
64
62
|
require 'commontator/acts_as_commontable'
|
63
|
+
require 'commontator/shared_methods'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'commontator/shared_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
module ControllerIncludes
|
5
|
+
def self.included(base)
|
6
|
+
base.helper Commontator::SharedHelper
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def commontator_thread_show(commontable)
|
12
|
+
user = send Commontator.current_user_method
|
13
|
+
raise SecurityTransgression unless (user.nil? || user.is_commontator)
|
14
|
+
|
15
|
+
thread = commontable.thread
|
16
|
+
raise SecurityTransgression unless thread.can_be_read_by?(user)
|
17
|
+
thread.mark_as_read_for(user)
|
18
|
+
@commontator_thread_show = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
ActionController::Base.send :include, Commontator::ControllerIncludes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'commontator/shared_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
module ControllerIncludes
|
5
|
+
def self.included(base)
|
6
|
+
base.helper Commontator::SharedHelper
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def commontator_thread_show(commontable)
|
12
|
+
user = send Commontator.current_user_method
|
13
|
+
raise SecurityTransgression unless (@user.nil? || @user.is_commontator)
|
14
|
+
|
15
|
+
thread = commontable.thread
|
16
|
+
raise SecurityTransgression unless thread.can_be_read_by?(user)
|
17
|
+
thread.mark_as_read_for(user)
|
18
|
+
@commontator_thread_show = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
ActionController::Base.send :include, Commontator::ControllerIncludes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Commontator
|
2
|
+
module SharedHelper
|
3
|
+
def commontator_thread(commontable)
|
4
|
+
user = send Commontator.current_user_method
|
5
|
+
|
6
|
+
render(:partial => 'commontator/shared/thread',
|
7
|
+
:locals => {:thread => commontable.thread,
|
8
|
+
:user => user}).html_safe
|
9
|
+
end
|
10
|
+
|
11
|
+
def commontator_name(user)
|
12
|
+
return Commontator.user_missing_name if user.nil?
|
13
|
+
config = user.commontator_config
|
14
|
+
config.user_name_method.blank? ? config.user_missing_name : \
|
15
|
+
user.send(config.user_name_method)
|
16
|
+
end
|
17
|
+
|
18
|
+
def commontator_email(user)
|
19
|
+
return '' if user.nil?
|
20
|
+
config = user.commontator_config
|
21
|
+
config.user_email_method.blank? ? '' : user.send(config.user_email_method)
|
22
|
+
end
|
23
|
+
|
24
|
+
def commontator_gravatar_url(user, options = {})
|
25
|
+
options[:secure] ||= request.ssl?
|
26
|
+
options[:size] ||= 50
|
27
|
+
|
28
|
+
hash = Digest::MD5.hexdigest(commontator_email(user))
|
29
|
+
base = options[:secure] ? "s://secure" : "://www"
|
30
|
+
|
31
|
+
"http#{base}.gravatar.com/avatar/#{hash}?s=#{options[:size]}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def commontator_gravatar_image(user, options = {})
|
35
|
+
name = commontator_name(user)
|
36
|
+
image_tag(commontator_gravatar_url(user, options),
|
37
|
+
{ :alt => name,
|
38
|
+
:title => name,
|
39
|
+
:border => 1 })
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Commontator
|
2
|
+
module SharedHelper
|
3
|
+
def commontator_thread(commontable)
|
4
|
+
user = send Commontator.current_user_method
|
5
|
+
|
6
|
+
render(:partial => 'commontator/shared/thread',
|
7
|
+
:locals => {:thread => commontable.thread,
|
8
|
+
:user => user}).html_safe
|
9
|
+
end
|
10
|
+
|
11
|
+
def commontator_name(user)
|
12
|
+
return Commontator.user_missing_name if user.nil?
|
13
|
+
config = user.commontator_config
|
14
|
+
config.user_name_method.blank? ? config.user_missing_name : \
|
15
|
+
user.send(config.user_name_method)
|
16
|
+
end
|
17
|
+
|
18
|
+
def commontator_email(user)
|
19
|
+
return '' if user.nil?
|
20
|
+
config = user.commontator_config
|
21
|
+
config.email_method.blank? ? '' : user.send(config.user_email_method)
|
22
|
+
end
|
23
|
+
|
24
|
+
def commontator_gravatar_url(user, options = {})
|
25
|
+
options[:secure] ||= request.ssl?
|
26
|
+
options[:size] ||= 50
|
27
|
+
|
28
|
+
hash = Digest::MD5.hexdigest(commontator_email(user))
|
29
|
+
base = options[:secure] ? "s://secure" : "://www"
|
30
|
+
|
31
|
+
"http#{base}.gravatar.com/avatar/#{hash}?s=#{options[:size]}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def commontator_gravatar_image(user, options = {})
|
35
|
+
name = commontator_name(user)
|
36
|
+
image_tag(commontator_gravatar_url(user, options),
|
37
|
+
{ :alt => name,
|
38
|
+
:title => name,
|
39
|
+
:border => 1 })
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'commontator/shared_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
module SharedMethods
|
5
|
+
def self.included(base)
|
6
|
+
base.helper Commontator::SharedHelper
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def commontator_thread_show(commontable)
|
12
|
+
user = send Commontator.current_user_method
|
13
|
+
raise SecurityTransgression unless (user.nil? || user.is_commontator)
|
14
|
+
|
15
|
+
thread = commontable.thread
|
16
|
+
raise SecurityTransgression unless thread.can_be_read_by?(user)
|
17
|
+
thread.mark_as_read_for(user)
|
18
|
+
@commontator_thread_show = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
ActionController::Base.send :include, Commontator::SharedMethods
|
24
|
+
ActionMailer::Base.send :include, Commontator::SharedMethods
|
data/lib/commontator/version.rb
CHANGED
data/lib/commontator/version.rb~
CHANGED
@@ -16,31 +16,31 @@ Commontator.configure do |config|
|
|
16
16
|
config.javascript_proc = lambda { |view| '$("#error_explanation").remove();' }
|
17
17
|
|
18
18
|
|
19
|
-
#
|
19
|
+
# User (acts_as_commontator) Configuration
|
20
20
|
|
21
|
-
# The name used if the
|
21
|
+
# The name used if the user's name cannot be retrieved
|
22
22
|
# Default: 'Anonymous'
|
23
|
-
config.
|
23
|
+
config.user_missing_name = 'Anonymous'
|
24
24
|
|
25
|
-
# Whether the
|
25
|
+
# Whether the user's name is clickable in the comment view
|
26
26
|
# Default: false
|
27
|
-
config.
|
27
|
+
config.user_name_clickable = false
|
28
28
|
|
29
|
-
# The method that
|
29
|
+
# The method that returns the user's email address
|
30
30
|
# Default: 'email'
|
31
|
-
config.
|
31
|
+
config.user_email_method = 'email'
|
32
32
|
|
33
|
-
# The method that
|
34
|
-
# Default: '' (use
|
35
|
-
config.
|
33
|
+
# The method that returns the user's name
|
34
|
+
# Default: '' (use user_missing_name)
|
35
|
+
config.user_name_method = ''
|
36
36
|
|
37
|
-
# Method that returns true if the
|
37
|
+
# Method that returns true if the user is an admin for all threads
|
38
38
|
# Admins can always delete other users' comments and close threads
|
39
39
|
# Default: '' (no admins)
|
40
40
|
config.is_admin_method = ''
|
41
41
|
|
42
42
|
|
43
|
-
# Commontable (
|
43
|
+
# Commontable (acts_as_commontable) Configuration
|
44
44
|
|
45
45
|
# What a comment is called in your application
|
46
46
|
# Default: 'comment'
|
@@ -60,7 +60,7 @@ Commontator.configure do |config|
|
|
60
60
|
# as an argument to acts_as_commontable in each one
|
61
61
|
# Default: 'commontable'
|
62
62
|
config.commontable_name = 'commontable'
|
63
|
-
|
63
|
+
|
64
64
|
# Proc that returns the commontable url that contains the thread
|
65
65
|
# (defaults to the commontable show url)
|
66
66
|
# Main application's routes can be accessed using main_app object
|
@@ -70,11 +70,11 @@ Commontator.configure do |config|
|
|
70
70
|
# Proc that returns the subscription email subject
|
71
71
|
# Default:
|
72
72
|
# lambda do |params|
|
73
|
-
# "#{params[:
|
73
|
+
# "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \
|
74
74
|
# "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}"
|
75
75
|
# end
|
76
76
|
config.subscription_email_subject_proc = lambda do |params|
|
77
|
-
"#{params[:
|
77
|
+
"#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \
|
78
78
|
"#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}"
|
79
79
|
end
|
80
80
|
|