commontator 4.6.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -7
- data/app/views/commontator/threads/_show.html.erb +3 -3
- data/lib/commontator/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +36 -0
- data/spec/dummy/log/test.log +24750 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{e1f674c11941d62aac1764ef3a7134e4 → 72b63dddbc5c995f79af8e3c94904fd9} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{c69ee3cc5796188d873574179290a6ef → a473b3873e554893372a53d71f5e9879} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{e85565206c3e5fdf9dfeb367c85557b1 → a77b1a9223d168112e1705c29220116f} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{a3fb9025f90ff05a6fd4afc7ded2692c → afa63eb365bdf4f42584b17ac9176b9d} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{0f196a1a50363b0a076ec6e1ee5417f6 → d2244ccef8e05bb993f75715af0344cc} +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/decb63cac838a5314aa0c22a979f5ac9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/{02d4b791eb831cf2057bf4703a1218d1 → f721383d531f067d82b071e14aed7a92} +0 -0
- metadata +131 -151
- data/app/assets/stylesheets/commontator/threads.css~ +0 -71
- data/app/controllers/commontator/application_controller.rb~ +0 -35
- data/app/controllers/commontator/comments_controller.rb~ +0 -153
- data/app/mailers/commontator/subscriptions_mailer.rb~ +0 -44
- data/app/models/commontator/comment.rb~ +0 -119
- data/app/models/commontator/thread.rb~ +0 -159
- data/app/views/commontator/comments/_form.html.erb~ +0 -39
- data/app/views/commontator/comments/_show.html.erb~ +0 -49
- data/app/views/commontator/comments/_votes.html.erb~ +0 -69
- data/app/views/commontator/comments/create.js.erb~ +0 -14
- data/app/views/commontator/comments/new.js.erb~ +0 -13
- data/app/views/commontator/subscriptions/_link.html.erb~ +0 -16
- data/app/views/commontator/threads/_reply.html.erb~ +0 -19
- data/app/views/commontator/threads/_show.html.erb~ +0 -95
- data/config/initializers/commontator.rb~ +0 -238
- data/config/locales/commontator/en.yml~ +0 -104
- data/db/migrate/0_install_commontator.rb~ +0 -54
- data/lib/commontator.rb~ +0 -142
- data/spec/app/models/commontator/comment_spec.rb~ +0 -74
- data/spec/dummy/app/models/dummy_user.rb~ +0 -16
- data/spec/dummy/config/initializers/commontator.rb~ +0 -15
- data/spec/dummy/tmp/cache/assets/test/sprockets/a41c8be5379abec3c0d0d98e2f0d5609 +0 -0
@@ -1,39 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must provide the following variables:
|
2
|
-
# comment
|
3
|
-
#
|
4
|
-
# Optionally, they can also supply the following variables:
|
5
|
-
per_page ||= nil
|
6
|
-
thread ||= nil
|
7
|
-
no_remote ||= false
|
8
|
-
%>
|
9
|
-
|
10
|
-
<% config = comment.thread.config %>
|
11
|
-
|
12
|
-
<% if comment.errors.any? %>
|
13
|
-
<div class="comment_error_explanation">
|
14
|
-
<h3><%= t "commontator.comment.errors.#{comment.id.blank? ? 'create' : 'update'}" %></h3>
|
15
|
-
|
16
|
-
<ul>
|
17
|
-
<% comment.errors.full_messages.each do |msg| %>
|
18
|
-
<li><%= msg %></li>
|
19
|
-
<% end %>
|
20
|
-
</ul>
|
21
|
-
</div>
|
22
|
-
<% end %>
|
23
|
-
|
24
|
-
<%= form_for([commontator, thread, comment],
|
25
|
-
:remote => !no_remote) do |f| %>
|
26
|
-
|
27
|
-
<%= f.hidden_field :per_page, per_page %>
|
28
|
-
|
29
|
-
<div class="comment_form_field">
|
30
|
-
<%= f.text_area :body, :rows => '7' %>
|
31
|
-
</div>
|
32
|
-
|
33
|
-
<div class="comment_form_actions">
|
34
|
-
<%= f.submit t("commontator.comment.actions.#{comment.id.blank? ? 'create' : 'update'}") %>
|
35
|
-
<%= f.submit t('commontator.comment.actions.cancel'), :name => 'cancel' %>
|
36
|
-
</div>
|
37
|
-
|
38
|
-
<% end %>
|
39
|
-
|
@@ -1,49 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variables:
|
2
|
-
# comment
|
3
|
-
# user
|
4
|
-
%>
|
5
|
-
|
6
|
-
<% creator = comment.creator
|
7
|
-
name = Commontator.commontator_name(creator) || ''
|
8
|
-
link = Commontator.commontator_link(creator) || ''
|
9
|
-
avatar = Commontator.commontator_avatar(creator, self) || ''
|
10
|
-
%>
|
11
|
-
|
12
|
-
<div id="comment_<%= comment.id.to_s %>_div" class="comment">
|
13
|
-
<div id="comment_<%= comment.id.to_s %>_top_div" class="comment_div">
|
14
|
-
<span id="comment_<%= comment.id.to_s %>_commontator_span" class="comment_commontator">
|
15
|
-
<%= link.blank? ? name : link_to(name, link) %>
|
16
|
-
</span>
|
17
|
-
<span id="comment_<%= comment.id.to_s %>_actions_span" class="comment_actions">
|
18
|
-
<%= render :partial => 'commontator/comments/actions',
|
19
|
-
:locals => {:comment => comment,
|
20
|
-
:user => user} %>
|
21
|
-
</span>
|
22
|
-
</div>
|
23
|
-
<div id="comment_<%= comment.id.to_s %>_middle_div" class="comment_div">
|
24
|
-
<span id="comment_<%= comment.id.to_s %>_avatar_span" class="comment_avatar">
|
25
|
-
<%= avatar %>
|
26
|
-
</span>
|
27
|
-
<span id="comment_<%= comment.id.to_s %>_votes_span" class="comment_votes">
|
28
|
-
<%= render :partial => 'commontator/comments/votes',
|
29
|
-
:locals => {:comment => comment,
|
30
|
-
:user => user} %>
|
31
|
-
</span>
|
32
|
-
<div id="comment_<%= comment.id.to_s %>_body_div" class="comment_body">
|
33
|
-
<%= render :partial => 'commontator/comments/body',
|
34
|
-
:locals => {:comment => comment} %>
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
<div id="comment_<%= comment.id.to_s %>_bottom_div" class="comment_div">
|
38
|
-
<span id="comment_<%= comment.id.to_s %>_created_timestamp_span" class="comment_timestamp">
|
39
|
-
<%= comment.created_timestamp %>
|
40
|
-
</span>
|
41
|
-
<br/>
|
42
|
-
<span id="comment_<%= comment.id.to_s %>_updated_timestamp_span" class="comment_timestamp">
|
43
|
-
<% if comment.is_modified? %>
|
44
|
-
<%= comment.updated_timestamp %>
|
45
|
-
<% end %>
|
46
|
-
</span>
|
47
|
-
</div>
|
48
|
-
</div>
|
49
|
-
|
@@ -1,69 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must provide the following variables:
|
2
|
-
# comment
|
3
|
-
# user
|
4
|
-
%>
|
5
|
-
|
6
|
-
<% if comment.can_be_voted_on? %>
|
7
|
-
<% can_vote = comment.can_be_voted_on_by?(user) %>
|
8
|
-
<% vote = comment.get_vote_by(user) %>
|
9
|
-
<% comment_voting = comment.thread.config.comment_voting.to_sym %>
|
10
|
-
|
11
|
-
<% if comment_voting == :ld || comment_voting == :l %>
|
12
|
-
<% vtype = (comment_voting == :ld) ? 'upvote' : 'like' %>
|
13
|
-
<span id="comment_<%= comment.id %>_<%= vtype %>_span"
|
14
|
-
class="comment_<%= vtype %>">
|
15
|
-
<% if can_vote && (vote.blank? || !vote.vote_flag) %>
|
16
|
-
<%= form_tag commontator.upvote_comment_path(comment),
|
17
|
-
:method => :put,
|
18
|
-
:remote => true do %>
|
19
|
-
<%= image_submit_tag "commontator/upvote.png",
|
20
|
-
:onmouseover => "this.src='/assets/commontator/upvote_hover.png'",
|
21
|
-
:onmouseout => "this.src='/assets/commontator/upvote.png'" %>
|
22
|
-
<% end %>
|
23
|
-
<% elsif can_vote %>
|
24
|
-
<%= form_tag commontator.unvote_comment_path(comment),
|
25
|
-
:method => :put,
|
26
|
-
:remote => true do %>
|
27
|
-
<%= image_submit_tag "commontator/upvote_active.png",
|
28
|
-
:onmouseover => "this.src='/assets/commontator/upvote.png'",
|
29
|
-
:onmouseout => "this.src='/assets/commontator/upvote_active.png'"
|
30
|
-
%>
|
31
|
-
<% end %>
|
32
|
-
<% else %>
|
33
|
-
<%= image_tag "commontator/upvote_disabled.png" %>
|
34
|
-
<% end %>
|
35
|
-
</span>
|
36
|
-
<% end %>
|
37
|
-
|
38
|
-
<span id="comment_<%= comment.id %>_vote_count_span" class="comment_vote_count">
|
39
|
-
<% config = comment.thread.config %>
|
40
|
-
<%= config.vote_count_proc.call(config.comment_voting,
|
41
|
-
comment.upvotes.size, comment.downvotes.size) %>
|
42
|
-
</span>
|
43
|
-
|
44
|
-
<% if comment_voting == :ld %>
|
45
|
-
<span id="comment_<%= comment.id %>_downvote_span" class="comment_downvote">
|
46
|
-
<% if can_vote && (vote.blank? || vote.vote_flag) %>
|
47
|
-
<%= form_tag commontator.downvote_comment_path(comment),
|
48
|
-
:method => :put,
|
49
|
-
:remote => true do %>
|
50
|
-
<%= image_submit_tag "commontator/downvote.png",
|
51
|
-
:onmouseover => "this.src='/assets/commontator/downvote_hover.png'",
|
52
|
-
:onmouseout => "this.src='/assets/commontator/downvote.png'" %>
|
53
|
-
<% end %>
|
54
|
-
<% elsif can_vote %>
|
55
|
-
<%= form_tag commontator.unvote_comment_path(comment),
|
56
|
-
:method => :put,
|
57
|
-
:remote => true do %>
|
58
|
-
<%= image_submit_tag "commontator/downvote_active.png",
|
59
|
-
:onmouseover => "this.src='/assets/commontator/downvote.png'",
|
60
|
-
:onmouseout => "this.src='/assets/commontator/downvote_active.png'"
|
61
|
-
%>
|
62
|
-
<% end %>
|
63
|
-
<% else %>
|
64
|
-
<%= image_tag "commontator/downvote_disabled.png" %>
|
65
|
-
<% end %>
|
66
|
-
</span>
|
67
|
-
<% end %>
|
68
|
-
<% end %>
|
69
|
-
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<%= render :partial => 'commontator/threads/show',
|
2
|
-
:locals => {:thread => @thread,
|
3
|
-
:user => @user,
|
4
|
-
:page => @thread.new_comment_page_for(@comment, @per_page),
|
5
|
-
:per_page => @per_page} %>
|
6
|
-
|
7
|
-
$("#thread_<%= @thread.id %>_new_comment_div").hide();
|
8
|
-
|
9
|
-
$("#thread_<%= @thread.id %>_new_comment_link_span").fadeIn();
|
10
|
-
|
11
|
-
$("#comment_<%= @comment.id.to_s %>_div").hide().fadeIn()[0].scrollIntoView();
|
12
|
-
|
13
|
-
<%= javascript_proc %>
|
14
|
-
|
@@ -1,13 +0,0 @@
|
|
1
|
-
$("#thread_<%= @thread.id %>_new_comment_div").html("<%= escape_javascript(
|
2
|
-
render :partial => 'form',
|
3
|
-
:locals => {
|
4
|
-
:comment => @comment,
|
5
|
-
:thread => @thread
|
6
|
-
}) %>");
|
7
|
-
|
8
|
-
$("#thread_<%= @thread.id %>_new_comment_div").fadeIn()[0].scrollIntoView();
|
9
|
-
|
10
|
-
$("#thread_<%= @thread.id %>_new_comment_link_span").hide();
|
11
|
-
|
12
|
-
<%= javascript_proc %>
|
13
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variables:
|
2
|
-
# thread
|
3
|
-
# user
|
4
|
-
%>
|
5
|
-
|
6
|
-
<% is_subscribed = thread.subscription_for(user) %>
|
7
|
-
<% sub_string = is_subscribed ? "unsubscribe" : "subscribe" %>
|
8
|
-
<%= link_to t("commontator.subscription.actions.#{sub_string}"),
|
9
|
-
commontator.polymorphic_path([sub_string, thread]),
|
10
|
-
:confirm => (is_subscribed ? t('commontator.subscription.actions.confirm_unsubscribe') : \
|
11
|
-
nil),
|
12
|
-
:method => :put,
|
13
|
-
:id => "thread_#{thread.id.to_s}_#{sub_string}_link",
|
14
|
-
:class => "thread_#{sub_string}_link",
|
15
|
-
:remote => true %>
|
16
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variables:
|
2
|
-
# thread
|
3
|
-
# user
|
4
|
-
# per_page
|
5
|
-
%>
|
6
|
-
|
7
|
-
<% if thread.is_closed? %>
|
8
|
-
<p><%= t 'commontator.thread.status.cannot_post' %></p>
|
9
|
-
<% elsif !user %>
|
10
|
-
<p><%= t 'commontator.require_login' %>.</p>
|
11
|
-
<% else %>
|
12
|
-
<div id="thread_<%= thread.id %>_new_comment_div" class="thread_new_comment"></div>
|
13
|
-
|
14
|
-
<span id="thread_<%= thread.id %>_new_comment_link_span" class="thread_new_comment_link">
|
15
|
-
<%= link_to t('commontator.comment.actions.new'),
|
16
|
-
commontator.new_thread_comment_path(thread, :per_page => @commontator_per_page), :remote => true %>
|
17
|
-
</span>
|
18
|
-
<% end %>
|
19
|
-
|
@@ -1,95 +0,0 @@
|
|
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 %>_actions_span" class="thread_actions">
|
14
|
-
<% if can_subscribe %>
|
15
|
-
<span id="thread_<%= thread.id.to_s %>_subscription_span" class="thread_subscription">
|
16
|
-
<%= render :partial => 'commontator/subscriptions/link',
|
17
|
-
:locals => {:thread => thread,
|
18
|
-
:user => user} %>
|
19
|
-
</span>
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<% if can_edit %>
|
25
|
-
<% filter_string = show_all ? 'filter' : 'show_all'
|
26
|
-
is_closed = thread.is_closed?
|
27
|
-
close_string = is_closed ? 'reopen' : 'close' %>
|
28
|
-
|
29
|
-
<% if thread.is_filtered? %>
|
30
|
-
<%= link_to t("commontator.thread.actions.#{filter_string}"),
|
31
|
-
commontator.thread_path(thread, :show_all => (show_all ? nil : true)),
|
32
|
-
:id => "thread_#{thread.id.to_s}_#{filter_string}_link",
|
33
|
-
:class => "thread_#{filter_string}_link",
|
34
|
-
:remote => true %>
|
35
|
-
|
36
|
-
|
37
|
-
<% end %>
|
38
|
-
|
39
|
-
<%= link_to t("commontator.thread.actions.#{close_string}"),
|
40
|
-
commontator.polymorphic_path([close_string, thread]),
|
41
|
-
:confirm => (!is_closed ? t('commontator.thread.actions.confirm_close') : nil),
|
42
|
-
:method => :put,
|
43
|
-
:id => "thread_#{thread.id.to_s}_#{close_string}_link",
|
44
|
-
:class => "thread_#{close_string}_link",
|
45
|
-
:remote => true %>
|
46
|
-
<% end %>
|
47
|
-
</span>
|
48
|
-
|
49
|
-
<span id="thread_<%= thread.id.to_s %>_header_span" class="thread_header">
|
50
|
-
<%= t "commontator.thread.status.#{thread.is_closed? ? 'closed' : 'open'}",
|
51
|
-
:closer_name => Commontator.commontator_name(thread.closer) %>
|
52
|
-
</span>
|
53
|
-
|
54
|
-
<% if thread.config.comment_order == :l %>
|
55
|
-
<%= render :partial => 'commontator/threads/reply',
|
56
|
-
:locals => {:thread => thread, :user => user, :per_page => per_page} %>
|
57
|
-
<% end %>
|
58
|
-
|
59
|
-
<div id="thread_<%= thread.id.to_s %>_comment_list_div" class="thread_comment_list">
|
60
|
-
<% comments = show_all ? thread.ordered_comments(true) : thread.paginated_comments(page, per_page) %>
|
61
|
-
<%= render :partial => 'commontator/comments/list',
|
62
|
-
:locals => {:comments => comments,
|
63
|
-
:user => user} %>
|
64
|
-
</div>
|
65
|
-
|
66
|
-
<% if thread.will_paginate? && !show_all %>
|
67
|
-
<div id="thread_<%= thread.id.to_s %>_pagination_div" class="thread_pagination">
|
68
|
-
<div id="thread_<%= thread.id.to_s %>_page_entries_info_div" class="thread_page_entries_info">
|
69
|
-
<%= page_entries_info comments,
|
70
|
-
:params => {:controller => 'commontator/threads',
|
71
|
-
:action => 'show',
|
72
|
-
:id => thread.id,
|
73
|
-
:page => page,
|
74
|
-
:per_page => per_page} %>
|
75
|
-
</div>
|
76
|
-
|
77
|
-
<div id="thread_<%= thread.id.to_s %>_will_paginate_div" class="thread_will_paginate">
|
78
|
-
<%= will_paginate comments,
|
79
|
-
:renderer => Commontator::LinkRenderer,
|
80
|
-
:routes_proxy => commontator,
|
81
|
-
:remote => true,
|
82
|
-
:params => {:controller => 'commontator/threads',
|
83
|
-
:action => 'show',
|
84
|
-
:id => thread.id,
|
85
|
-
:page => page,
|
86
|
-
:per_page => per_page} %>
|
87
|
-
</div>
|
88
|
-
</div>
|
89
|
-
<% end %>
|
90
|
-
|
91
|
-
<% if thread.config.comment_order != :l %>
|
92
|
-
<%= render :partial => 'commontator/threads/reply',
|
93
|
-
:locals => {:thread => thread, :user => user, :per_page => per_page} %>
|
94
|
-
<% end %>
|
95
|
-
|
@@ -1,238 +0,0 @@
|
|
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
|
-
|