commontator 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/Rakefile +2 -20
- data/lib/commontator.rb +4 -2
- data/lib/commontator.rb~ +7 -5
- data/lib/commontator/acts_as_commontable.rb +1 -1
- data/lib/commontator/acts_as_commontable.rb~ +2 -2
- data/lib/commontator/security_transgression.rb +2 -1
- data/lib/commontator/security_transgression.rb~ +3 -0
- data/lib/commontator/version.rb +1 -1
- data/lib/commontator/version.rb~ +1 -1
- data/lib/tasks/commontator_tasks.rake +1 -0
- data/lib/tasks/commontator_tasks.rake~ +41 -0
- data/spec/app/controllers/commontator/comments_controller_spec.rb +1 -1
- data/spec/app/controllers/commontator/comments_controller_spec.rb~ +8 -8
- data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +1 -1
- data/spec/app/controllers/commontator/subscriptions_controller_spec.rb~ +1 -1
- data/spec/app/controllers/commontator/threads_controller_spec.rb +1 -1
- data/spec/app/controllers/commontator/threads_controller_spec.rb~ +110 -110
- data/spec/app/helpers/commontator/application_helper_spec.rb +2 -0
- data/spec/app/helpers/commontator/application_helper_spec.rb~ +1 -1
- data/spec/app/helpers/commontator/threads_helper_spec.rb +1 -1
- data/spec/app/helpers/commontator/threads_helper_spec.rb~ +1 -1
- data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb +1 -1
- data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb~ +2 -2
- data/spec/app/models/commontator/comment_observer_spec.rb +1 -1
- data/spec/app/models/commontator/comment_observer_spec.rb~ +1 -1
- data/spec/app/models/commontator/comment_spec.rb +1 -1
- data/spec/app/models/commontator/comment_spec.rb~ +1 -1
- data/spec/app/models/commontator/subscription_spec.rb +1 -1
- data/spec/app/models/commontator/subscription_spec.rb~ +22 -22
- data/spec/app/models/commontator/thread_spec.rb +1 -1
- data/spec/app/models/commontator/thread_spec.rb~ +2 -2
- data/spec/dummy/README.md +1 -1
- data/spec/dummy/README.md~ +1 -1
- data/spec/dummy/Rakefile~ +7 -0
- data/spec/dummy/config/initializers/commontator.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{0_create_dummy_models.rb → 1_create_dummy_models.rb} +0 -0
- data/spec/dummy/db/migrate/{1_create_dummy_users.rb → 2_create_dummy_users.rb} +0 -0
- data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb +4 -1
- data/spec/dummy/db/schema.rb +3 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +466 -15153
- data/spec/dummy/log/test.log +7183 -178543
- data/spec/lib/commontator/acts_as_commontable_spec.rb +1 -1
- data/spec/lib/commontator/acts_as_commontable_spec.rb~ +1 -1
- data/spec/lib/commontator/acts_as_commontator_spec.rb +1 -1
- data/spec/lib/commontator/acts_as_commontator_spec.rb~ +1 -1
- data/spec/lib/commontator/commontable_config_spec.rb +1 -1
- data/spec/lib/commontator/commontable_config_spec.rb~ +6 -6
- data/spec/lib/commontator/commontator_config_spec.rb +1 -1
- data/spec/lib/commontator/commontator_config_spec.rb~ +6 -6
- data/spec/lib/commontator/controller_includes_spec.rb +1 -1
- data/spec/lib/commontator/controller_includes_spec.rb~ +1 -1
- data/spec/lib/commontator/shared_helper_spec.rb +1 -1
- data/spec/lib/commontator/shared_helper_spec.rb~ +1 -1
- data/spec/lib/commontator_spec.rb +1 -1
- data/spec/lib/commontator_spec.rb~ +4 -4
- data/spec/{spec_helper.rb → minitest_helper.rb} +0 -1
- data/spec/minitest_helper.rb~ +35 -0
- data/spec/spec_helper.rb~ +7 -1
- metadata +153 -241
- data/app/assets/stylesheets/commontator/comments.css~ +0 -83
- data/app/assets/stylesheets/commontator/threads.css~ +0 -18
- data/app/controllers/commontator/application_controller.rb~ +0 -28
- data/app/controllers/commontator/comments_controller.rb~ +0 -135
- data/app/controllers/commontator/commontator_controller.rb~ +0 -22
- data/app/controllers/commontator/subscriptions_controller.rb~ +0 -33
- data/app/controllers/commontator/threads_controller.rb~ +0 -41
- data/app/helpers/commontator/comments_helper.rb~ +0 -41
- data/app/helpers/commontator/commontator_helper.rb~ +0 -7
- data/app/helpers/commontator/subscriptions_helper.rb~ +0 -8
- data/app/helpers/commontator/threads_helper.rb~ +0 -22
- data/app/mailers/commontator/subscriptions_mailer.rb~ +0 -49
- data/app/models/commontator/comment.rb~ +0 -89
- data/app/models/commontator/comment_observer.rb~ +0 -13
- data/app/models/commontator/subscription.rb~ +0 -19
- data/app/models/commontator/thread.rb~ +0 -123
- data/app/views/commontator/comments/_actions.html.erb~ +0 -30
- data/app/views/commontator/comments/_body.html.erb~ +0 -7
- data/app/views/commontator/comments/_form.html.erb~ +0 -36
- data/app/views/commontator/comments/_show.html.erb~ +0 -44
- data/app/views/commontator/comments/_votes.html.erb~ +0 -57
- data/app/views/commontator/comments/delete.js.erb~ +0 -17
- data/app/views/commontator/comments/update.js.erb~ +0 -7
- data/app/views/commontator/shared/_thread.html.erb~ +0 -20
- data/app/views/commontator/shared/_thread_link.html.erb~ +0 -16
- data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb~ +0 -6
- data/app/views/commontator/threads/_show.html.erb~ +0 -61
- data/config/initializers/commontator.rb~ +0 -164
- data/db/migrate/0_install_commontator.rb~ +0 -48
- data/lib/commontator/commontable_config.rb~ +0 -13
- data/lib/commontator/commontator_config.rb~ +0 -13
- data/lib/commontator/controller_includes.rb~ +0 -23
- data/lib/commontator/engine.rb~ +0 -7
- data/lib/commontator/shared_helper.rb~ +0 -42
- data/lib/commontator/shared_methods.rb~ +0 -24
- data/spec/app/controllers/comments_controller_spec.rb~ +0 -7
- data/spec/app/controllers/commontator/application_controller_spec.rb~ +0 -30
- data/spec/app/controllers/threads_controller_spec.rb~ +0 -12
- data/spec/dummy/Gemfile~ +0 -3
- data/spec/dummy/app/controllers/application_controller.rb~ +0 -7
- data/spec/dummy/app/controllers/dummies_controller.rb~ +0 -17
- data/spec/dummy/app/controllers/dummy_models_controller.rb~ +0 -29
- data/spec/dummy/app/helpers/application_helper.rb~ +0 -15
- data/spec/dummy/app/models/dummy.rb~ +0 -3
- data/spec/dummy/app/models/dummy_user.rb~ +0 -9
- data/spec/dummy/app/models/user.rb~ +0 -5
- data/spec/dummy/app/views/dummy_model/show.html.erb~ +0 -1
- data/spec/dummy/config/application.rb~ +0 -59
- data/spec/dummy/config/initializers/commontator.rb~ +0 -164
- data/spec/dummy/config/routes.rb~ +0 -7
- data/spec/dummy/db/migrate/0_create_dummies.rb~ +0 -48
- data/spec/dummy/db/migrate/0_create_dummy_models.rb~ +0 -7
- data/spec/dummy/db/migrate/1_create_dummy_users.rb~ +0 -7
- data/spec/dummy/db/migrate/1_create_users.rb~ +0 -7
- data/spec/dummy/db/migrate/2_install_commontator.rb +0 -49
- data/spec/dummy/db/migrate/2_install_commontator.rb~ +0 -49
- data/spec/dummy/db/schema.rb~ +0 -71
- data/spec/dummy/tmp/cache/assets/CCB/1D0/sprockets%2F02d4b791eb831cf2057bf4703a1218d1 +0 -0
- data/spec/dummy/tmp/cache/assets/CD1/510/sprockets%2Fc69ee3cc5796188d873574179290a6ef +0 -0
- data/spec/dummy/tmp/cache/assets/D01/8B0/sprockets%2F0f196a1a50363b0a076ec6e1ee5417f6 +0 -0
- data/spec/dummy/tmp/cache/assets/D06/2F0/sprockets%2Fe1f674c11941d62aac1764ef3a7134e4 +0 -0
- data/spec/dummy/tmp/cache/assets/D54/060/sprockets%2Fe85565206c3e5fdf9dfeb367c85557b1 +0 -0
- data/spec/dummy/tmp/cache/assets/D9B/550/sprockets%2Fa41c8be5379abec3c0d0d98e2f0d5609 +0 -0
- data/spec/dummy/tmp/cache/assets/E01/2E0/sprockets%2Fa3fb9025f90ff05a6fd4afc7ded2692c +0 -0
@@ -1,17 +0,0 @@
|
|
1
|
-
$("#comment_<%= @comment.id.to_s %>_body_div").html("<%= escape_javascript(
|
2
|
-
render :partial => 'body', :locals => {:comment => @comment}) %>");
|
3
|
-
|
4
|
-
$("#comment_<%= @comment.id.to_s %>_timestamp_span").html("<%= escape_javascript(
|
5
|
-
comment_timestamp(@comment)) %>");
|
6
|
-
|
7
|
-
$("#comment_<%= @comment.id.to_s %>_actions_span").html("<%= escape_javascript(
|
8
|
-
render :partial => 'actions',
|
9
|
-
:locals => {:comment => @comment,
|
10
|
-
:user => @user}) %>");
|
11
|
-
|
12
|
-
$("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
|
13
|
-
render :partial => 'votes',
|
14
|
-
:locals => {:comment => @comment,
|
15
|
-
:user => @user}) %>");
|
16
|
-
|
17
|
-
<%= javascript_proc %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
$("#comment_<%= @comment.id.to_s %>_body_div").html("<%= escape_javascript(
|
2
|
-
render :partial => 'body', :locals => {:comment => @comment}) %>");
|
3
|
-
|
4
|
-
$("#comment_<%= @comment.id.to_s %>_timestamp_span").html("<%= escape_javascript(
|
5
|
-
comment_timestamp(@comment)) %>");
|
6
|
-
|
7
|
-
<%= javascript_proc %>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variables:
|
2
|
-
# thread
|
3
|
-
# user
|
4
|
-
%>
|
5
|
-
|
6
|
-
<% subscription = thread.subscription_for(user) %>
|
7
|
-
|
8
|
-
<% if thread.can_be_read_by?(user) %>
|
9
|
-
<%= stylesheet_link_tag "commontator/application", :media => "all" %>
|
10
|
-
|
11
|
-
<div id="thread_<%= thread.id %>_div" class="thread" style="display: none;">
|
12
|
-
<% if @commontator_thread_show %>
|
13
|
-
<%= render :partial => 'commontator/threads/show', :locals => {:thread => thread,
|
14
|
-
:user => user} %>
|
15
|
-
<% else %>
|
16
|
-
<%= link_to "Show #{thread.config.comment_name.pluralize} (#{subscription ? subscription.unread + '/' + thread.comments.count : thread.comments.count})", \
|
17
|
-
commontator.thread_path(thread), :remote => true %>
|
18
|
-
<% end %>
|
19
|
-
</div>
|
20
|
-
<% end %>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variables:
|
2
|
-
# thread
|
3
|
-
# user
|
4
|
-
%>
|
5
|
-
|
6
|
-
<% if thread.can_be_read_by?(user) %>
|
7
|
-
<%= stylesheet_link_tag "commontator/application", :media => "all" %>
|
8
|
-
|
9
|
-
<div id="thread_<%= thread.id %>_div" class="thread">
|
10
|
-
<% if @commontator_show_thread %>
|
11
|
-
<%= render :partial => 'commontator/threads/show', :locals => {:thread => thread} %>
|
12
|
-
<% else %>
|
13
|
-
<%= link_to "Show #{thread.config.comment_name.pluralize} (#{thread.comments.count})", commontator.thread_path(thread), :remote => true %>
|
14
|
-
<% end %>
|
15
|
-
</div>
|
16
|
-
<% end %>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<h4><%= @creator_name %>'s <%= @thread.config.comment_name %> on <%= @commontable_name %> #<%= @commontable_id %>:</h4>
|
2
|
-
|
3
|
-
<%= render :partial => 'commontator/comments/body',
|
4
|
-
:locals => { :comment => @comment } %>
|
5
|
-
|
6
|
-
<p><a href="<%= @commontable_url %>">Click here</a> to visit this thread.</p>
|
@@ -1,61 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variables:
|
2
|
-
# thread
|
3
|
-
# user
|
4
|
-
%>
|
5
|
-
|
6
|
-
<% can_subscribe = thread.can_subscribe?(user) %>
|
7
|
-
<% can_edit = thread.can_be_edited_by?(user) %>
|
8
|
-
|
9
|
-
<span id="thread_<%= thread.id.to_s %>_header_span" class="thread_header">
|
10
|
-
<%= thread.config.comment_name.capitalize.pluralize + (thread.is_closed? ? ' (closed)' : '') %>
|
11
|
-
</span>
|
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
|
-
<% is_closed = thread.is_closed? %>
|
26
|
-
<% close_string = is_closed ? "reopen" : "close" %>
|
27
|
-
<%= link_to close_string.capitalize,
|
28
|
-
commontator.polymorphic_path([close_string, thread]),
|
29
|
-
:confirm => (!is_closed ? \
|
30
|
-
'Are you sure you want to close this thread?' : nil),
|
31
|
-
:method => :put,
|
32
|
-
:id => "thread_#{thread.id.to_s}_#{close_string}_link",
|
33
|
-
:class => "thread_#{close_string}_link" %>
|
34
|
-
<% end %>
|
35
|
-
</span>
|
36
|
-
|
37
|
-
<div id="thread_<%= thread.id.to_s %>_comment_list_div" class="thread_comment_list">
|
38
|
-
<% thread.ordered_comments.each do |comment| %>
|
39
|
-
<% next unless comment.can_be_read_by?(user) %>
|
40
|
-
<%= render :partial => 'commontator/comments/show',
|
41
|
-
:locals => {:comment => comment,
|
42
|
-
:user => user} %>
|
43
|
-
<% end %>
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<br/>
|
47
|
-
|
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 %>
|
53
|
-
|
54
|
-
<div id="thread_<%= thread.id %>_new_comment_div" class="thread_new_comment"></div>
|
55
|
-
|
56
|
-
<span id="thread_<%= thread.id %>_new_comment_link_span" class="thread_new_comment_link">
|
57
|
-
<%= link_to thread.config.comment_create_verb_present.capitalize + ' ' + thread.config.comment_name,
|
58
|
-
commontator.new_thread_comment_path(thread), :remote => true %>
|
59
|
-
</span>
|
60
|
-
|
61
|
-
<% end %>
|
@@ -1,164 +0,0 @@
|
|
1
|
-
# Change the settings below to suit your needs
|
2
|
-
# All settings are initially set to their default values
|
3
|
-
Commontator.configure do |config|
|
4
|
-
|
5
|
-
# Engine Configuration
|
6
|
-
|
7
|
-
# Name of the ApplicationController helper method that returns the current user
|
8
|
-
# Default: 'current_user'
|
9
|
-
config.current_user_method = 'current_user'
|
10
|
-
|
11
|
-
# Proc that is called after any javascript runs (e.g. to display/clear flash messages)
|
12
|
-
# It is passed the view_context object (self from the view template), so you should be able to
|
13
|
-
# access anything you normally could in a view template (by using, e.g. view.flash)
|
14
|
-
# However, be aware that it does not have access to the main application's helpers
|
15
|
-
# Should return a string containing JS to be appended to all Commontator JS responses
|
16
|
-
# Default: lambda { |view| '$("#error_explanation").remove();' }
|
17
|
-
config.javascript_proc = lambda { |view| '$("#error_explanation").hide();' }
|
18
|
-
|
19
|
-
|
20
|
-
# User (acts_as_commontator) Configuration
|
21
|
-
|
22
|
-
# The name used if the user's name cannot be retrieved
|
23
|
-
# Default: 'Anonymous'
|
24
|
-
config.user_missing_name = 'Anonymous'
|
25
|
-
|
26
|
-
# Whether the comment creator's name is clickable in the comment view
|
27
|
-
# If enabled, the link will point to the comment creator's show page
|
28
|
-
# Default: false
|
29
|
-
config.user_name_clickable = false
|
30
|
-
|
31
|
-
# The method that returns the user's email address
|
32
|
-
# Default: 'email'
|
33
|
-
config.user_email_method = 'email'
|
34
|
-
|
35
|
-
# The method that returns the user's name
|
36
|
-
# Default: '' (use user_missing_name)
|
37
|
-
config.user_name_method = ''
|
38
|
-
|
39
|
-
# Proc called with user as argument that returns true if the user is an admin
|
40
|
-
# Admins can always delete other users' comments and close threads
|
41
|
-
# Note: user can be nil
|
42
|
-
# Default: lambda { |user| false } (no admins)
|
43
|
-
config.user_admin_proc = lambda { |user| false }
|
44
|
-
|
45
|
-
# Proc called with user as argument that returns true
|
46
|
-
# if the user should receive subscription emails
|
47
|
-
# Default: lambda { |user| true } (always receive subscription emails)
|
48
|
-
config.subscription_email_enable_proc = lambda { |user| true }
|
49
|
-
|
50
|
-
|
51
|
-
# Commontable (acts_as_commontable) Configuration
|
52
|
-
|
53
|
-
# What a comment is called in your application
|
54
|
-
# Default: 'comment'
|
55
|
-
config.comment_name = 'comment'
|
56
|
-
|
57
|
-
# Verb used when creating comments (present)
|
58
|
-
# Default: 'post'
|
59
|
-
config.comment_create_verb_present = 'post'
|
60
|
-
|
61
|
-
# Verb used when creating comments (past)
|
62
|
-
# Default: 'posted'
|
63
|
-
config.comment_create_verb_past = 'posted'
|
64
|
-
|
65
|
-
# What a commontable is called in your application
|
66
|
-
# If you have multiple commontable models,
|
67
|
-
# you might want to pass this configuration value
|
68
|
-
# as an argument to acts_as_commontable in each one
|
69
|
-
# Default: 'commontable'
|
70
|
-
config.commontable_name = 'commontable'
|
71
|
-
|
72
|
-
# The format of the timestamps used by Commontator
|
73
|
-
# Default: '%b %d %Y, %I:%M %p'
|
74
|
-
config.timestamp_format = '%b %d %Y, %I:%M %p'
|
75
|
-
|
76
|
-
# Whether admins can edit other users' comments
|
77
|
-
# Default: false
|
78
|
-
config.admin_can_edit_comments = false
|
79
|
-
|
80
|
-
# Whether users automatically subscribe to a thread when commenting
|
81
|
-
# Default: false
|
82
|
-
config.auto_subscribe_on_comment = false
|
83
|
-
|
84
|
-
# Whether users can edit their own comments
|
85
|
-
# Default: true
|
86
|
-
config.can_edit_own_comments = true
|
87
|
-
|
88
|
-
# Whether users can edit their own comments
|
89
|
-
# after someone posted a newer comment
|
90
|
-
# Default: false
|
91
|
-
config.can_edit_old_comments = false
|
92
|
-
|
93
|
-
# Whether users can delete their own comments
|
94
|
-
# Default: true
|
95
|
-
config.can_delete_own_comments = true
|
96
|
-
|
97
|
-
# Whether users can delete their own comments
|
98
|
-
# after someone posted a newer comment
|
99
|
-
# Default: false
|
100
|
-
config.can_delete_old_comments = false
|
101
|
-
|
102
|
-
# Whether users can manually subscribe or unsubscribe to threads
|
103
|
-
# Default: true
|
104
|
-
config.can_subscribe_to_thread = true
|
105
|
-
|
106
|
-
# Whether users can vote on other users' comments
|
107
|
-
# Note: requires acts_as_votable gem installed
|
108
|
-
# and configured for your application
|
109
|
-
# Default: false
|
110
|
-
config.can_vote_on_comments = false
|
111
|
-
|
112
|
-
# Whether comments should be ordered by vote score
|
113
|
-
# instead of by order posted
|
114
|
-
# Default: false
|
115
|
-
config.comments_ordered_by_votes = false
|
116
|
-
|
117
|
-
# Whether users can read threads closed by admins
|
118
|
-
# Default: true
|
119
|
-
config.closed_threads_are_readable = true
|
120
|
-
|
121
|
-
# Whether comments deleted by admins can be seen
|
122
|
-
# (the content will still be hidden)
|
123
|
-
# Default: true
|
124
|
-
config.deleted_comments_are_visible = true
|
125
|
-
|
126
|
-
# The method which returns the commontable's id, sent to users in email messages
|
127
|
-
# Default: 'id'
|
128
|
-
config.commontable_id_method = 'id'
|
129
|
-
|
130
|
-
# Proc called with thread and user as arguments
|
131
|
-
# If it returns true, that user is a moderator for that particular thread
|
132
|
-
# and is given admin-like capabilities for that thread only
|
133
|
-
# Note: user can be nil
|
134
|
-
# Default: lambda { |thread, user| false } (no thread-specific moderators)
|
135
|
-
config.can_edit_thread_proc = lambda { |thread, user| false }
|
136
|
-
|
137
|
-
# Proc called with thread and user as arguments
|
138
|
-
# If it returns true, that user is allowed to read that thread
|
139
|
-
# Note: user can be nil
|
140
|
-
# Default: lambda { |thread, user| true } (no read restrictions)
|
141
|
-
config.can_read_thread_proc = lambda { |thread, user| true }
|
142
|
-
|
143
|
-
# Proc that returns the commontable url that contains the thread
|
144
|
-
# (defaults to the commontable show url)
|
145
|
-
# Main application's routes can be accessed using main_app object
|
146
|
-
# Default: lambda { |main_app, commontable| main_app.polymorphic_url(commontable) }
|
147
|
-
config.commontable_url_proc = lambda { |main_app, commontable| main_app.polymorphic_url(commontable) }
|
148
|
-
|
149
|
-
# Proc that returns the subscription email 'from' address
|
150
|
-
# Default:
|
151
|
-
# lambda { |params| 'no-reply@example.com' }
|
152
|
-
config.subscription_email_from_proc = lambda { |params| 'no-reply@example.com' }
|
153
|
-
|
154
|
-
# Proc that returns the subscription email 'subject' string
|
155
|
-
# Default:
|
156
|
-
# lambda do |params|
|
157
|
-
# "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \
|
158
|
-
# "#{params[:config].comment_name} on #{params[:commontable_name]} #{params[:commontable_id]}"
|
159
|
-
# end
|
160
|
-
config.subscription_email_subject_proc = lambda do |params|
|
161
|
-
"#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \
|
162
|
-
"#{params[:config].comment_name} on #{params[:commontable_name]} #{params[:commontable_id]}"
|
163
|
-
end
|
164
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
class InstallCommontator < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table "commontator_comments" do |t|
|
4
|
-
t.text "body"
|
5
|
-
t.integer "creator_id"
|
6
|
-
t.string "creator_type"
|
7
|
-
t.datetime "deleted_at"
|
8
|
-
t.integer "deleter_id"
|
9
|
-
t.string "deleter_type"
|
10
|
-
t.integer "thread_id"
|
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
|
15
|
-
|
16
|
-
t.timestamps
|
17
|
-
end
|
18
|
-
|
19
|
-
create_table "commontator_subscriptions" do |t|
|
20
|
-
t.integer "subscriber_id"
|
21
|
-
t.string "subscriber_type"
|
22
|
-
t.integer "thread_id"
|
23
|
-
t.integer "unread"
|
24
|
-
|
25
|
-
t.timestamps
|
26
|
-
end
|
27
|
-
|
28
|
-
create_table "commontator_threads" do |t|
|
29
|
-
t.integer "commontable_id"
|
30
|
-
t.string "commontable_type"
|
31
|
-
t.datetime "closed_at"
|
32
|
-
t.integer "closer_id"
|
33
|
-
t.string "closer_type"
|
34
|
-
|
35
|
-
t.timestamps
|
36
|
-
end
|
37
|
-
|
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
|
-
add_index :commontator_comments, :thread_id
|
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
|
-
add_index :commontator_subscriptions, :thread_id
|
42
|
-
add_index :commontator_threads, [:commontable_id, :commontable_type]
|
43
|
-
|
44
|
-
add_index :commontator_comments, :cached_votes_total
|
45
|
-
add_index :commontator_comments, :cached_votes_up
|
46
|
-
add_index :commontator_comments, :cached_votes_down
|
47
|
-
end
|
48
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class CommontableConfig
|
3
|
-
Commontator::COMMONTABLE_ATTRIBUTES.each do |attribute|
|
4
|
-
cattr_accessor attribute
|
5
|
-
end
|
6
|
-
|
7
|
-
def initialize(options = {})
|
8
|
-
Commontator::COMMONTABLE_ATTRIBUTES.each do |attribute|
|
9
|
-
self.send attribute.to_s + '=', options[attribute] || Commontator.send(attribute)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class CommontatorConfig
|
3
|
-
Commontator::COMMONTATOR_ATTRIBUTES.each do |attribute|
|
4
|
-
cattr_accessor attribute
|
5
|
-
end
|
6
|
-
|
7
|
-
def initialize(options = {})
|
8
|
-
Commontator::COMMONTATOR_ATTRIBUTES.each do |attribute|
|
9
|
-
self.send attribute.to_s + '=', options[attribute] || Commontator.send(attribute)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,23 +0,0 @@
|
|
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
|
data/lib/commontator/engine.rb~
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
module SharedHelper
|
3
|
-
def commontator_thread(commontable)
|
4
|
-
user = Commontator.current_user_proc.call
|
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
|