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,104 +0,0 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization
|
2
|
-
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
-
# than English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t 'hello'
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t('hello') %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more, please read the Rails Internationalization guide
|
20
|
-
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
-
|
22
|
-
---
|
23
|
-
en:
|
24
|
-
activerecord:
|
25
|
-
attributes:
|
26
|
-
commontator/comment:
|
27
|
-
body: Comment
|
28
|
-
creator: Creator
|
29
|
-
editor: Editor
|
30
|
-
thread: Discussion
|
31
|
-
commontator/subscription:
|
32
|
-
subscriber: Subscriber
|
33
|
-
thread: Discussion
|
34
|
-
commontator/thread:
|
35
|
-
commontable: Commontable
|
36
|
-
models:
|
37
|
-
commontator/comment:
|
38
|
-
zero: comments
|
39
|
-
one: comment
|
40
|
-
other: comments
|
41
|
-
commontator/subscription:
|
42
|
-
zero: subscriptions
|
43
|
-
one: subscription
|
44
|
-
other: subscriptions
|
45
|
-
commontator/thread:
|
46
|
-
zero: threads
|
47
|
-
one: thread
|
48
|
-
other: threads
|
49
|
-
commontator:
|
50
|
-
anonymous: Anonymous
|
51
|
-
comment:
|
52
|
-
actions:
|
53
|
-
cancel: Cancel
|
54
|
-
confirm_delete: "Are you sure you want to delete this comment?"
|
55
|
-
create: "Post Comment"
|
56
|
-
delete: Delete
|
57
|
-
edit: Edit
|
58
|
-
new: "New Comment"
|
59
|
-
undelete: Undelete
|
60
|
-
update: "Modify Comment"
|
61
|
-
errors:
|
62
|
-
already_deleted: "This comment has already been deleted."
|
63
|
-
create: "This comment could not be posted because:"
|
64
|
-
double_posted: "is a duplicate of another comment."
|
65
|
-
not_deleted: "This comment is not deleted."
|
66
|
-
update: "This comment could not be modified because:"
|
67
|
-
status:
|
68
|
-
created_at: "Posted on %{created_at}."
|
69
|
-
deleted_by: "Comment deleted by %{deleter_name}."
|
70
|
-
updated_at: "Last modified by %{editor_name} on %{updated_at}."
|
71
|
-
email:
|
72
|
-
comment_created:
|
73
|
-
body: "%{creator_name} commented on %{commontable_name}:"
|
74
|
-
subject: "%{creator_name} posted a comment on %{commontable_name}"
|
75
|
-
thread_link_html: "<a href=\"%{commontable_url}\">Click here</a> to view all comments on %{commontable_name}."
|
76
|
-
undisclosed_recipients: "Undisclosed Recipients"
|
77
|
-
require_login: "You must login before you can post a comment."
|
78
|
-
subscription:
|
79
|
-
actions:
|
80
|
-
confirm_unsubscribe: "Are you sure you want to unsubscribe from this discussion?"
|
81
|
-
subscribe: Subscribe
|
82
|
-
unsubscribe: Unsubscribe
|
83
|
-
errors:
|
84
|
-
already_subscribed: "You are already subscribed to this discussion."
|
85
|
-
not_subscribed: "You are not subscribed to this discussion."
|
86
|
-
thread:
|
87
|
-
actions:
|
88
|
-
show_all: "Show All Comments"
|
89
|
-
filter: "Filter Comments"
|
90
|
-
close: "Close Discussion"
|
91
|
-
confirm_close: "Are you sure you want to close this discussion?"
|
92
|
-
reopen: "Reopen Discussion"
|
93
|
-
show: "Show Comments"
|
94
|
-
errors:
|
95
|
-
already_closed: "This discussion has already been closed."
|
96
|
-
not_closed: "This discussion is not closed."
|
97
|
-
status:
|
98
|
-
cannot_post: "New comments cannot be posted at this time."
|
99
|
-
closed: "Comments (Closed by %{closer_name})"
|
100
|
-
open: Comments
|
101
|
-
time:
|
102
|
-
formats:
|
103
|
-
commontator: "%b %d %Y at %I:%M%p %Z"
|
104
|
-
|
@@ -1,54 +0,0 @@
|
|
1
|
-
class InstallCommontator < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table 'commontator_comments' do |t|
|
4
|
-
t.string 'creator_type'
|
5
|
-
t.integer 'creator_id'
|
6
|
-
t.string 'editor_type'
|
7
|
-
t.integer 'editor_id'
|
8
|
-
t.integer 'thread_id', :null => false
|
9
|
-
t.text 'body', :null => false
|
10
|
-
t.datetime 'deleted_at'
|
11
|
-
|
12
|
-
t.integer :cached_votes_total, :default => 0
|
13
|
-
t.integer :cached_votes_score, :default => 0
|
14
|
-
t.integer :cached_votes_up, :default => 0
|
15
|
-
t.integer :cached_votes_down, :default => 0
|
16
|
-
t.integer :cached_weighted_score, :default => 0
|
17
|
-
|
18
|
-
t.timestamps
|
19
|
-
end
|
20
|
-
|
21
|
-
add_index :commontator_comments, [:creator_id, :creator_type, :thread_id], :name => 'index_commontator_comments_on_c_id_and_c_type_and_t_id'
|
22
|
-
add_index :commontator_comments, :thread_id
|
23
|
-
|
24
|
-
add_index :commontator_comments, :cached_votes_total
|
25
|
-
add_index :commontator_comments, :cached_votes_score
|
26
|
-
add_index :commontator_comments, :cached_votes_up
|
27
|
-
add_index :commontator_comments, :cached_votes_down
|
28
|
-
add_index :commontator_comments, :cached_weighted_score
|
29
|
-
|
30
|
-
create_table 'commontator_subscriptions' do |t|
|
31
|
-
t.string 'subscriber_type', :null => false
|
32
|
-
t.integer 'subscriber_id', :null => false
|
33
|
-
t.integer 'thread_id', :null => false
|
34
|
-
|
35
|
-
t.timestamps
|
36
|
-
end
|
37
|
-
|
38
|
-
add_index :commontator_subscriptions, [:subscriber_id, :subscriber_type, :thread_id], :unique => true, :name => 'index_commontator_subscriptions_on_s_id_and_s_type_and_t_id'
|
39
|
-
add_index :commontator_subscriptions, :thread_id
|
40
|
-
|
41
|
-
create_table 'commontator_threads' do |t|
|
42
|
-
t.string 'commontable_type'
|
43
|
-
t.integer 'commontable_id'
|
44
|
-
t.datetime 'closed_at'
|
45
|
-
t.string 'closer_type'
|
46
|
-
t.integer 'closer_id'
|
47
|
-
|
48
|
-
t.timestamps
|
49
|
-
end
|
50
|
-
|
51
|
-
add_index :commontator_threads, [:commontable_id, :commontable_type], :unique => true, :name => 'index_commontator_threads_on_c_id_and_c_type'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
data/lib/commontator.rb~
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'commontator/engine'
|
2
|
-
require 'commontator/controller_includes'
|
3
|
-
|
4
|
-
module Commontator
|
5
|
-
# Attributes
|
6
|
-
|
7
|
-
# Can be set in initializer only
|
8
|
-
ENGINE_ATTRIBUTES = [
|
9
|
-
:current_user_proc,
|
10
|
-
:javascript_proc
|
11
|
-
]
|
12
|
-
|
13
|
-
# Can be set in initializer or passed as an option to acts_as_commontator
|
14
|
-
COMMONTATOR_ATTRIBUTES = [
|
15
|
-
:user_name_proc,
|
16
|
-
:user_link_proc,
|
17
|
-
:user_avatar_proc,
|
18
|
-
:user_email_proc
|
19
|
-
]
|
20
|
-
|
21
|
-
# Can be set in initializer or passed as an option to acts_as_commontable
|
22
|
-
COMMONTABLE_ATTRIBUTES = [
|
23
|
-
:comment_filter,
|
24
|
-
:thread_read_proc,
|
25
|
-
:thread_moderator_proc,
|
26
|
-
:comment_editing,
|
27
|
-
:comment_deletion,
|
28
|
-
:moderator_permissions,
|
29
|
-
:comment_voting,
|
30
|
-
:vote_count_proc,
|
31
|
-
:comment_order,
|
32
|
-
:comments_per_page,
|
33
|
-
:thread_subscription,
|
34
|
-
:email_from_proc,
|
35
|
-
:commontable_name_proc,
|
36
|
-
:commontable_url_proc
|
37
|
-
]
|
38
|
-
|
39
|
-
DEPRECATED_ATTRIBUTES = [
|
40
|
-
[:moderators_can_edit_comments, :moderator_permissions],
|
41
|
-
[:hide_deleted_comments, :comment_filter],
|
42
|
-
[:hide_closed_threads, :thread_read_proc],
|
43
|
-
[:wp_link_renderer_proc],
|
44
|
-
[:voting_text_proc, :vote_count_proc],
|
45
|
-
[:user_name_clickable, :user_link_proc],
|
46
|
-
[:user_admin_proc, :thread_moderator_proc],
|
47
|
-
[:auto_subscribe_on_comment, :thread_subscription],
|
48
|
-
[:can_edit_own_comments, :comment_editing],
|
49
|
-
[:can_edit_old_comments, :comment_editing],
|
50
|
-
[:can_delete_own_comments, :comment_deletion],
|
51
|
-
[:can_delete_old_comments, :comment_deletion],
|
52
|
-
[:can_subscribe_to_thread, :thread_subscription],
|
53
|
-
[:can_vote_on_comments, :comment_voting],
|
54
|
-
[:combine_upvotes_and_downvotes, :vote_count_proc],
|
55
|
-
[:comments_order, :comment_order],
|
56
|
-
[:closed_threads_are_readable, :thread_read_proc],
|
57
|
-
[:deleted_comments_are_visible, :comment_filter],
|
58
|
-
[:can_read_thread_proc, :thread_read_proc],
|
59
|
-
[:can_edit_thread_proc, :thread_moderator_proc],
|
60
|
-
[:admin_can_edit_comments, :moderator_permissions],
|
61
|
-
[:subscription_email_enable_proc, :user_email_proc],
|
62
|
-
[:comment_name, 'config/locales'],
|
63
|
-
[:comment_create_verb_present, 'config/locales'],
|
64
|
-
[:comment_create_verb_past, 'config/locales'],
|
65
|
-
[:comment_edit_verb_present, 'config/locales'],
|
66
|
-
[:comment_edit_verb_past, 'config/locales'],
|
67
|
-
[:timestamp_format, 'config/locales'],
|
68
|
-
[:subscription_email_to_proc, 'config/locales'],
|
69
|
-
[:subscription_email_from_proc, :email_from_proc],
|
70
|
-
[:subscription_email_subject_proc, 'config/locales'],
|
71
|
-
[:comments_ordered_by_votes, :comment_order],
|
72
|
-
[:current_user_method, :current_user_proc],
|
73
|
-
[:user_missing_name, 'config/locales'],
|
74
|
-
[:user_email_method, :user_email_proc],
|
75
|
-
[:user_name_method, :user_name_proc],
|
76
|
-
[:commontable_name, :commontable_name_proc],
|
77
|
-
[:commontable_id_method]
|
78
|
-
]
|
79
|
-
|
80
|
-
(ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES + \
|
81
|
-
COMMONTABLE_ATTRIBUTES).each do |attribute|
|
82
|
-
mattr_accessor attribute
|
83
|
-
end
|
84
|
-
|
85
|
-
DEPRECATED_ATTRIBUTES.each do |deprecated, replacement|
|
86
|
-
define_singleton_method(deprecated) do
|
87
|
-
@deprecated_method_called = true
|
88
|
-
replacement_string = (replacement.nil? ? 'No replacement is available. You can safely remove it from your configuration file.' : "Use `#{replacement.to_s}` instead.")
|
89
|
-
warn "\n[COMMONTATOR] Deprecation: `config.#{deprecated.to_s}` is deprecated and has been disabled. #{replacement_string}\n"
|
90
|
-
end
|
91
|
-
|
92
|
-
define_singleton_method("#{deprecated.to_s}=") do |obj|
|
93
|
-
send(deprecated)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.configure
|
98
|
-
@deprecated_method_called = false
|
99
|
-
yield self
|
100
|
-
warn "\n[COMMONTATOR] We recommend that you backup the config/initializers/commontator.rb file, rename or remove it, run rake commontator:install:initializers to copy the new default one, then configure it to your liking.\n" if @deprecated_method_called
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.commontator_config(user)
|
104
|
-
(user && user.is_commontator) ? user.commontator_config : self
|
105
|
-
end
|
106
|
-
|
107
|
-
def self.commontable_config(user)
|
108
|
-
(user && user.is_commontable) ? user.commontable_config : self
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.app_routes
|
112
|
-
Commontator::ApplicationController.app_routes
|
113
|
-
end
|
114
|
-
|
115
|
-
def self.commontator_name(user)
|
116
|
-
commontator_config(user).user_name_proc.call(user)
|
117
|
-
end
|
118
|
-
|
119
|
-
def self.commontator_link(user, routing_proxy = app_routes)
|
120
|
-
commontator_config(user).user_link_proc.call(user, routing_proxy)
|
121
|
-
end
|
122
|
-
|
123
|
-
def self.commontator_email(user, mailer = nil)
|
124
|
-
commontator_config(user).user_email_proc.call(user, mailer)
|
125
|
-
end
|
126
|
-
|
127
|
-
def self.commontator_avatar(user, view)
|
128
|
-
commontator_config(user).user_avatar_proc.call(user, view)
|
129
|
-
end
|
130
|
-
|
131
|
-
def self.commontable_name(commontable)
|
132
|
-
commontable_config(commontable).commontable_name_proc.call(commontable)
|
133
|
-
end
|
134
|
-
|
135
|
-
def self.commontable_url(commontable, routing_proxy = app_routes)
|
136
|
-
commontable_config(commontable).commontable_url_proc.call(commontable, app_routes)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
require 'commontator/acts_as_commontator'
|
141
|
-
require 'commontator/acts_as_commontable'
|
142
|
-
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'acts_as_votable'
|
3
|
-
|
4
|
-
module Commontator
|
5
|
-
describe Comment do
|
6
|
-
before do
|
7
|
-
setup_model_spec
|
8
|
-
@comment = Comment.new
|
9
|
-
@comment.thread = @thread
|
10
|
-
@comment.creator = @user
|
11
|
-
@comment.body = 'Something'
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'must be votable if acts_as_votable is installed' do
|
15
|
-
Comment.must_respond_to(:acts_as_votable)
|
16
|
-
@comment.is_votable?.must_equal true
|
17
|
-
@comment.acts_as_votable_initialized.must_equal true
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'must know if it has been modified' do
|
21
|
-
@comment.save!
|
22
|
-
|
23
|
-
@comment.is_modified?.must_equal false
|
24
|
-
|
25
|
-
@comment.body = 'Something else'
|
26
|
-
@comment.editor = @user
|
27
|
-
@comment.save!
|
28
|
-
|
29
|
-
@comment.is_modified?.must_equal true
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'must know if it has been deleted' do
|
33
|
-
user = DummyUser.new
|
34
|
-
|
35
|
-
@comment.is_deleted?.must_equal false
|
36
|
-
@comment.editor.must_be_nil
|
37
|
-
|
38
|
-
@comment.delete_by(user)
|
39
|
-
|
40
|
-
@comment.is_deleted?.must_equal true
|
41
|
-
@comment.editor.must_equal user
|
42
|
-
|
43
|
-
@comment.undelete_by(user)
|
44
|
-
|
45
|
-
@comment.is_deleted?.must_equal false
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'must make proper timestamps' do
|
49
|
-
@comment.save!
|
50
|
-
|
51
|
-
@comment.created_timestamp.must_equal I18n.t('commontator.comment.status.created_at',
|
52
|
-
:created_at => I18n.l(@comment.created_at,
|
53
|
-
:format => :commontator))
|
54
|
-
@comment.updated_timestamp.must_equal I18n.t('commontator.comment.status.updated_at',
|
55
|
-
:editor_name => @user.name,
|
56
|
-
:updated_at => I18n.l(@comment.updated_at,
|
57
|
-
:format => :commontator))
|
58
|
-
|
59
|
-
user2 = @user = DummyUser.create
|
60
|
-
@comment.body = 'Something else'
|
61
|
-
@comment.editor = user2
|
62
|
-
@comment.save!
|
63
|
-
|
64
|
-
@comment.created_timestamp.must_equal I18n.t('commontator.comment.status.created_at',
|
65
|
-
:created_at => I18n.l(@comment.created_at,
|
66
|
-
:format => :commontator))
|
67
|
-
@comment.updated_timestamp.must_equal I18n.t('commontator.comment.status.updated_at',
|
68
|
-
:editor_name => user2.name,
|
69
|
-
:updated_at => I18n.l(@comment.updated_at,
|
70
|
-
:format => :commontator))
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Dummy application configuration file
|
2
|
-
Commontator.configure do |config|
|
3
|
-
config.javascript_proc = lambda { |view| '// Some javascript' }
|
4
|
-
|
5
|
-
config.user_name_proc = lambda { |user| user.try(:name) || }
|
6
|
-
|
7
|
-
config.thread_read_proc = lambda { |thread, user| user && user.can_read }
|
8
|
-
|
9
|
-
config.thread_moderator_proc = lambda { |thread, user| user.is_admin || user.can_edit }
|
10
|
-
|
11
|
-
config.comment_voting = :ld
|
12
|
-
|
13
|
-
config.thread_subscription = :m
|
14
|
-
end
|
15
|
-
|
Binary file
|