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,83 +0,0 @@
|
|
1
|
-
.comment {
|
2
|
-
font-size: 12px;
|
3
|
-
font-weight: normal;
|
4
|
-
font-style: normal;
|
5
|
-
|
6
|
-
border-top: 1px solid;
|
7
|
-
border-left: 1px solid;
|
8
|
-
|
9
|
-
margin-top: 15px;
|
10
|
-
margin-bottom: 15px;
|
11
|
-
|
12
|
-
padding-top: 8px;
|
13
|
-
padding-left: 15px;
|
14
|
-
|
15
|
-
color: #000;
|
16
|
-
border-color: #ddd;
|
17
|
-
background-color: #fff;
|
18
|
-
|
19
|
-
clear: both;
|
20
|
-
}
|
21
|
-
|
22
|
-
.comment_actions {
|
23
|
-
float: right;
|
24
|
-
}
|
25
|
-
|
26
|
-
.comment_body {
|
27
|
-
margin-left: 55px;
|
28
|
-
margin-top: -60px;
|
29
|
-
margin-right: 45px;
|
30
|
-
|
31
|
-
padding: 8px;
|
32
|
-
}
|
33
|
-
|
34
|
-
.comment_body p {
|
35
|
-
margin: 0px;
|
36
|
-
|
37
|
-
overflow: hidden;
|
38
|
-
}
|
39
|
-
|
40
|
-
.comment_body textarea {
|
41
|
-
|
42
|
-
}
|
43
|
-
|
44
|
-
.comment_form_actions {
|
45
|
-
margin-top: 15px;
|
46
|
-
}
|
47
|
-
|
48
|
-
.comment_form_field > .field_with_errors {
|
49
|
-
display: block;
|
50
|
-
padding-right: 4px;
|
51
|
-
}
|
52
|
-
|
53
|
-
.comment_form_field textarea {
|
54
|
-
padding: 0px;
|
55
|
-
|
56
|
-
width: 100%;
|
57
|
-
}
|
58
|
-
|
59
|
-
.comment_gravatar_image img {
|
60
|
-
margin-top: 5px;
|
61
|
-
}
|
62
|
-
|
63
|
-
.comment_timestamp {
|
64
|
-
color: #777;
|
65
|
-
}
|
66
|
-
|
67
|
-
.comment_votes {
|
68
|
-
float: right;
|
69
|
-
|
70
|
-
text-align: center;
|
71
|
-
}
|
72
|
-
|
73
|
-
.comment_votes input,
|
74
|
-
.comment_votes img {
|
75
|
-
border: none;
|
76
|
-
background-color: transparent;
|
77
|
-
padding: 0px;
|
78
|
-
margin: 0px;
|
79
|
-
}
|
80
|
-
|
81
|
-
.comment_vote_count p {
|
82
|
-
margin: 0px;
|
83
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
.thread {
|
2
|
-
display: block !important;
|
3
|
-
}
|
4
|
-
|
5
|
-
.thread_actions {
|
6
|
-
float: right;
|
7
|
-
}
|
8
|
-
|
9
|
-
.thread_header {
|
10
|
-
font-size: 16px;
|
11
|
-
font-weight: bold;
|
12
|
-
font-style: normal;
|
13
|
-
}
|
14
|
-
|
15
|
-
.thread_new_comment {
|
16
|
-
display: none;
|
17
|
-
padding-left: 15px;
|
18
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class ApplicationController < ActionController::Base
|
3
|
-
before_filter :get_user
|
4
|
-
|
5
|
-
cattr_accessor :commontable_url
|
6
|
-
|
7
|
-
rescue_from SecurityTransgression, :with => lambda { head(:forbidden) }
|
8
|
-
|
9
|
-
protected
|
10
|
-
|
11
|
-
def get_user
|
12
|
-
@user = self.send Commontator.current_user_method
|
13
|
-
raise SecurityTransgression unless (@user.nil? || @user.is_commontator)
|
14
|
-
end
|
15
|
-
|
16
|
-
def get_thread
|
17
|
-
@thread = params[:thread_id].blank? ? \
|
18
|
-
Commontator::Thread.find(params[:id]) : \
|
19
|
-
Commontator::Thread.find(params[:thread_id])
|
20
|
-
raise SecurityTransgression if @thread.commontable.nil?
|
21
|
-
set_commontable_url
|
22
|
-
end
|
23
|
-
|
24
|
-
def set_commontable_url
|
25
|
-
self.commontable_url = @thread.config.commontable_url_proc.call(main_app, @thread.commontable)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class CommentsController < ApplicationController
|
3
|
-
before_filter :get_thread, :only => [:new, :create]
|
4
|
-
before_filter :get_comment_and_thread, :except => [:new, :create]
|
5
|
-
before_filter :set_commontable_url, :only => :create
|
6
|
-
|
7
|
-
# GET /1/comments/new
|
8
|
-
def new
|
9
|
-
@comment = Comment.new
|
10
|
-
@comment.thread = @thread
|
11
|
-
@comment.creator = @user
|
12
|
-
|
13
|
-
raise SecurityTransgression unless @comment.can_be_created_by?(@user)
|
14
|
-
|
15
|
-
respond_to do |format|
|
16
|
-
format.html { redirect_to @thread }
|
17
|
-
format.js
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
# POST /1/comments
|
23
|
-
def create
|
24
|
-
@comment = Comment.new(params[:comment])
|
25
|
-
@comment.thread = @thread
|
26
|
-
@comment.creator = @user
|
27
|
-
CommentObserver.instance
|
28
|
-
raise SecurityTransgression unless @comment.can_be_created_by?(@user)
|
29
|
-
|
30
|
-
respond_to do |format|
|
31
|
-
if @comment.save
|
32
|
-
format.html { redirect_to @thread }
|
33
|
-
format.js
|
34
|
-
else
|
35
|
-
format.html { redirect_to @thread }
|
36
|
-
format.js { render :new }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# GET /comments/1/edit
|
42
|
-
def edit
|
43
|
-
raise SecurityTransgression unless @comment.can_be_edited_by?(@user)
|
44
|
-
|
45
|
-
respond_to do |format|
|
46
|
-
format.html { redirect_to @thread }
|
47
|
-
format.js
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# PUT /comments/1
|
52
|
-
def update
|
53
|
-
raise SecurityTransgression unless @comment.can_be_edited_by?(@user)
|
54
|
-
|
55
|
-
respond_to do |format|
|
56
|
-
if @comment.update_attributes(params[:comment])
|
57
|
-
format.html { redirect_to @thread }
|
58
|
-
format.js
|
59
|
-
else
|
60
|
-
format.html { redirect_to @thread }
|
61
|
-
format.js { render :edit }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# PUT /comments/1/delete
|
67
|
-
def delete
|
68
|
-
raise SecurityTransgression unless @comment.can_be_deleted_by?(@user)
|
69
|
-
|
70
|
-
@comment.errors.add(:base, 'This comment has already been deleted.') \
|
71
|
-
unless @comment.delete(@user)
|
72
|
-
|
73
|
-
respond_to do |format|
|
74
|
-
format.html { redirect_to @thread }
|
75
|
-
format.js { render :delete }
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# PUT /comments/1/undelete
|
80
|
-
def undelete
|
81
|
-
raise SecurityTransgression unless @comment.can_be_deleted_by?(@user)
|
82
|
-
|
83
|
-
@comment.errors.add(:base, 'This comment is not deleted.') \
|
84
|
-
unless @comment.undelete
|
85
|
-
|
86
|
-
respond_to do |format|
|
87
|
-
format.html { redirect_to @thread }
|
88
|
-
format.js { render :delete }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# PUT /comments/1/upvote
|
93
|
-
def upvote
|
94
|
-
raise SecurityTransgression unless @comment.can_be_voted_on_by?(@user)
|
95
|
-
|
96
|
-
@comment.upvote_from @user
|
97
|
-
|
98
|
-
respond_to do |format|
|
99
|
-
format.html { redirect_to @thread }
|
100
|
-
format.js { render :vote }
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# PUT /comments/1/downvote
|
105
|
-
def downvote
|
106
|
-
raise SecurityTransgression unless @comment.can_be_voted_on_by?(@user)
|
107
|
-
|
108
|
-
@comment.downvote_from @user
|
109
|
-
|
110
|
-
respond_to do |format|
|
111
|
-
format.html { redirect_to @thread }
|
112
|
-
format.js { render :vote }
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
# PUT /comments/1/unvote
|
117
|
-
def unvote
|
118
|
-
raise SecurityTransgression unless @comment.can_be_voted_on_by?(@user)
|
119
|
-
|
120
|
-
@comment.unvote :voter => @user
|
121
|
-
|
122
|
-
respond_to do |format|
|
123
|
-
format.html { redirect_to @thread }
|
124
|
-
format.js { render :vote }
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
protected
|
129
|
-
|
130
|
-
def get_comment_and_thread
|
131
|
-
@comment = Comment.find(params[:id])
|
132
|
-
@thread = @comment.thread
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class CommontatorController < ActionController::Base
|
3
|
-
before_filter :get_user
|
4
|
-
|
5
|
-
protected
|
6
|
-
|
7
|
-
def get_user
|
8
|
-
@user = ApplicationController.send Commontator.current_user_method
|
9
|
-
raise SecurityTransgression unless (@user.nil? || @user.is_commontator)
|
10
|
-
end
|
11
|
-
|
12
|
-
def get_thread
|
13
|
-
@thread = params[:thread_id].blank? ? \
|
14
|
-
Commontator::Thread.find(params[:id]) : \
|
15
|
-
Commontator::Thread.find(params[:thread_id])
|
16
|
-
end
|
17
|
-
|
18
|
-
def get_commontable_url
|
19
|
-
@commontable_url = @thread.config.commontable_url_proc.call(main_app, @thread.commontable)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class SubscriptionsController < ApplicationController
|
3
|
-
before_filter :get_thread
|
4
|
-
before_filter :get_commontable_url
|
5
|
-
|
6
|
-
# POST /1/subscribe
|
7
|
-
def create
|
8
|
-
raise SecurityTransgression unless @thread.can_subscribe?(@user)
|
9
|
-
|
10
|
-
@thread.errors.add(:subscription, "You are already subscribed to this thread") \
|
11
|
-
unless @thread.subscribe(@user)
|
12
|
-
|
13
|
-
respond_to do |format|
|
14
|
-
format.html { redirect_to @thread }
|
15
|
-
format.js { render :subscribe }
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
# POST /1/unsubscribe
|
21
|
-
def destroy
|
22
|
-
raise SecurityTransgression unless @thread.can_subscribe?(@user)
|
23
|
-
|
24
|
-
@thread.errors.add(:subscription, "You are not subscribed to this thread") \
|
25
|
-
unless @thread.unsubscribe(@user)
|
26
|
-
|
27
|
-
respond_to do |format|
|
28
|
-
format.html { redirect_to @thread }
|
29
|
-
format.js { render :subscribe }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class ThreadsController < ApplicationController
|
3
|
-
before_filter :get_thread
|
4
|
-
|
5
|
-
# GET /threads/1
|
6
|
-
def show
|
7
|
-
commontator_thread_show(@thread.commontable)
|
8
|
-
|
9
|
-
respond_to do |format|
|
10
|
-
format.html { redirect_to commontable_url }
|
11
|
-
format.js
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# PUT /threads/1/close
|
16
|
-
def close
|
17
|
-
raise SecurityTransgression unless @thread.can_be_edited_by?(@user)
|
18
|
-
|
19
|
-
@thread.errors.add(:base, 'This thread has already been closed.') \
|
20
|
-
unless @thread.close(@user)
|
21
|
-
|
22
|
-
respond_to do |format|
|
23
|
-
format.html { redirect_to @thread }
|
24
|
-
format.js { render :show }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# PUT /threads/1/reopen
|
29
|
-
def reopen
|
30
|
-
raise SecurityTransgression unless @thread.can_be_edited_by?(@user)
|
31
|
-
|
32
|
-
@thread.errors.add(:base, 'This thread is not closed.') \
|
33
|
-
unless @thread.reopen
|
34
|
-
|
35
|
-
respond_to do |format|
|
36
|
-
format.html { redirect_to @thread }
|
37
|
-
format.js { render :show }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
module CommentsHelper
|
3
|
-
def commontator_name(user)
|
4
|
-
return Commontator.user_missing_name if user.nil?
|
5
|
-
config = user.commontator_config
|
6
|
-
config.user_name_method.blank? ? config.user_missing_name : \
|
7
|
-
user.send(config.user_name_method)
|
8
|
-
end
|
9
|
-
|
10
|
-
def comment_timestamp(comment)
|
11
|
-
config = comment.thread.config
|
12
|
-
(comment.is_modified? ? 'Last modified on ' : \
|
13
|
-
config.comment_create_verb_past.capitalize + \
|
14
|
-
' on ') + comment.updated_at.strftime(config.timestamp_format)
|
15
|
-
end
|
16
|
-
|
17
|
-
def commontator_gravatar_url(user, options = {})
|
18
|
-
return '' if user.nil?
|
19
|
-
config = user.commontator_config
|
20
|
-
|
21
|
-
options[:secure] ||= request.ssl?
|
22
|
-
options[:size] ||= 50
|
23
|
-
|
24
|
-
hash = Digest::MD5.hexdigest(user.send(config.user_email_method))
|
25
|
-
base = options[:secure] ? "s://secure" : "://www"
|
26
|
-
|
27
|
-
"http#{base}.gravatar.com/avatar/#{hash}?s=#{options[:size]}"
|
28
|
-
end
|
29
|
-
|
30
|
-
def commontator_gravatar_image(comment, options = {})
|
31
|
-
user = comment.creator
|
32
|
-
return '' if user.nil?
|
33
|
-
config = user.commontator_config
|
34
|
-
name = user.send(config.user_name_method)
|
35
|
-
image_tag(gravatar_url(comment, options),
|
36
|
-
{ :alt => name,
|
37
|
-
:title => name,
|
38
|
-
:border => 1 })
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
module ThreadsHelper
|
3
|
-
def commontable_name(thread)
|
4
|
-
config = thread.config
|
5
|
-
config.commontable_name.blank? ? \
|
6
|
-
thread.commontable.class.name : \
|
7
|
-
config.commontable_name
|
8
|
-
end
|
9
|
-
|
10
|
-
def commontable_id(thread)
|
11
|
-
thread.commontable.send(thread.config.commontable_id_method)
|
12
|
-
end
|
13
|
-
|
14
|
-
def closer_name(thread)
|
15
|
-
user = thread.closer
|
16
|
-
return Commontator.user_missing_name if user.nil?
|
17
|
-
config = user.commontator_config
|
18
|
-
config.user_name_method.blank? ? config.user_missing_name : \
|
19
|
-
user.send(config.user_name_method)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|