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,38 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class SubscriptionMailer < ActionMailer::Base
|
3
|
-
|
4
|
-
include CommentsHelper
|
5
|
-
include ThreadsHelper
|
6
|
-
|
7
|
-
def comment_created_email(comment)
|
8
|
-
setup_variables(comment)
|
9
|
-
|
10
|
-
mail(:bcc => @bcc,
|
11
|
-
:subject => @subject,
|
12
|
-
:body => @body)
|
13
|
-
end
|
14
|
-
|
15
|
-
protected
|
16
|
-
|
17
|
-
def setup_variables(comment)
|
18
|
-
@comment = comment
|
19
|
-
@thread = @comment.thread
|
20
|
-
@commontator = @comment.commontator
|
21
|
-
@commontable = @thread.commontable
|
22
|
-
@config = @thread.config
|
23
|
-
@bcc = @thread.subscribers.reject{|s| s == @commontator}\
|
24
|
-
.collect{|s| email(s)}
|
25
|
-
|
26
|
-
@commontator_name = commontator_name(@commontator)
|
27
|
-
@comment_timestamp = comment_timestamp(@comment)
|
28
|
-
|
29
|
-
@commontable_name = commontable_name(@thread)
|
30
|
-
@commontable_id = commontable_id(@thread).to_s
|
31
|
-
|
32
|
-
@subject = eval(@config.subscription_email_subject)
|
33
|
-
@body = @config.subscription_email_body.blank? ? nil : \
|
34
|
-
eval(@config.subscription_email_body)
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class Subscription < ActiveRecord::Base
|
3
|
-
|
4
|
-
belongs_to :subscriber, :polymorphic => true
|
5
|
-
belongs_to :thread
|
6
|
-
|
7
|
-
validates_presence_of :subscriber, :thread
|
8
|
-
validates_uniqueness_of :thread_id, :scope => [:subscriber_id, :subscriber_type]
|
9
|
-
|
10
|
-
attr_accessible :subscriber, :thread
|
11
|
-
|
12
|
-
def mark_as_read
|
13
|
-
self.update_attribute(:is_unread, false)
|
14
|
-
end
|
15
|
-
|
16
|
-
def mark_as_unread
|
17
|
-
self.update_attribute(:is_unread, true)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
module Commontator
|
2
|
-
class Thread < ActiveRecord::Base
|
3
|
-
belongs_to :closer, :polymorphic => true
|
4
|
-
belongs_to :commontable, :polymorphic => true
|
5
|
-
|
6
|
-
has_many :comments, :dependent => :destroy
|
7
|
-
has_many :subscriptions, :dependent => :destroy
|
8
|
-
|
9
|
-
validates_presence_of :commontable, :on => :create
|
10
|
-
|
11
|
-
attr_accessible :is_closed
|
12
|
-
|
13
|
-
def config
|
14
|
-
commontable.try(:commontable_config)
|
15
|
-
end
|
16
|
-
|
17
|
-
def ordered_comments
|
18
|
-
(!commontable.blank? && config.comments_can_be_voted_on && config.comments_ordered_by_votes) ? \
|
19
|
-
comments.order("cached_votes_down - cached_votes_up") : comments
|
20
|
-
end
|
21
|
-
|
22
|
-
def subscribers
|
23
|
-
subscriptions.collect{|s| s.subscriber}
|
24
|
-
end
|
25
|
-
|
26
|
-
def subscription_for(subscriber)
|
27
|
-
Subscription.find_by_thread_id_and_subscriber_id_and_subscriber_type(self.id, subscriber.id, subscriber.class.name)
|
28
|
-
end
|
29
|
-
|
30
|
-
def is_closed?
|
31
|
-
!closed_at.blank?
|
32
|
-
end
|
33
|
-
|
34
|
-
def is_subscribed?(subscriber)
|
35
|
-
!subscription_for(subscriber).blank?
|
36
|
-
end
|
37
|
-
|
38
|
-
def subscribe(subscriber)
|
39
|
-
return false if is_subscribed?(subscriber)
|
40
|
-
subscription = Subscription.create(
|
41
|
-
:subscriber => subscriber, :thread => self)
|
42
|
-
subscribe_callback(subscriber)
|
43
|
-
end
|
44
|
-
|
45
|
-
def unsubscribe(subscriber)
|
46
|
-
subscription = subscription_for(subscriber)
|
47
|
-
return false if subscription.blank?
|
48
|
-
subscription.destroy
|
49
|
-
unsubscribe_callback(subscriber)
|
50
|
-
end
|
51
|
-
|
52
|
-
def mark_as_read_for(subscriber)
|
53
|
-
return if !subscription_for(subscriber)
|
54
|
-
subscription_for(subscriber).mark_as_read
|
55
|
-
end
|
56
|
-
|
57
|
-
def mark_as_unread_except_for(subscriber)
|
58
|
-
Subscription.transaction do
|
59
|
-
subscriptions.each{|s| s.mark_as_unread unless s.subscriber == subscriber}
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def close(user = nil)
|
64
|
-
self.closed_at = Time.now
|
65
|
-
self.closer = user
|
66
|
-
self.save!
|
67
|
-
end
|
68
|
-
|
69
|
-
def reopen
|
70
|
-
self.closed_at = nil
|
71
|
-
self.save!
|
72
|
-
end
|
73
|
-
|
74
|
-
# Creates a new empty thread and assigns it to the commontable
|
75
|
-
# The old thread is kept in the database for archival purposes
|
76
|
-
|
77
|
-
def clear(user = nil)
|
78
|
-
return if commontable.blank?
|
79
|
-
new_thread = Thread.new
|
80
|
-
new_thread.commontable = commontable
|
81
|
-
self.with_lock do
|
82
|
-
new_thread.save!
|
83
|
-
commontable.thread = new_thread
|
84
|
-
commontable.save!
|
85
|
-
subscriptions.each do |s|
|
86
|
-
s.thread = new_thread
|
87
|
-
s.save!
|
88
|
-
s.mark_as_read
|
89
|
-
end
|
90
|
-
self.commontable = nil
|
91
|
-
self.close(user)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
####################
|
96
|
-
# Callback methods #
|
97
|
-
####################
|
98
|
-
|
99
|
-
def comment_created_callback(user, comment)
|
100
|
-
commontable.blank? || config.comment_created_callback.blank? || commontable.send(config.comment_created_callback, user, comment)
|
101
|
-
end
|
102
|
-
|
103
|
-
def comment_edited_callback(user, comment)
|
104
|
-
commontable.send(config.comment_edited_callback, user, comment) unless commontable.blank? || config.comment_edited_callback.blank?
|
105
|
-
end
|
106
|
-
|
107
|
-
def comment_deleted_callback(user, comment)
|
108
|
-
commontable.send(config.comment_deleted_callback, user, comment) unless commontable.blank? || config.comment_deleted_callback.blank?
|
109
|
-
end
|
110
|
-
|
111
|
-
def thread_closed_callback(user)
|
112
|
-
commontable.send(config.thread_closed_callback, user) unless commontable.blank? || config.thread_closed_callback.blank?
|
113
|
-
end
|
114
|
-
|
115
|
-
def subscribe_callback(user)
|
116
|
-
commontable.send(config.subscribe_callback, user) unless commontable.blank? || config.subscribe_callback.blank?
|
117
|
-
end
|
118
|
-
|
119
|
-
def unsubscribe_callback(user)
|
120
|
-
commontable.send(config.unsubscribe_callback, user) unless commontable.blank? || config.unsubscribe_callback.blank?
|
121
|
-
end
|
122
|
-
|
123
|
-
##########################
|
124
|
-
# Access control methods #
|
125
|
-
##########################
|
126
|
-
|
127
|
-
def can_be_read_by?(user) # Reader and poster capabilities
|
128
|
-
(!commontable.blank? && (!is_closed? || config.closed_threads_are_readable) &&\
|
129
|
-
config.can_read_thread_method.blank? ? true : commontable.send(config.can_read_thread_method, user)) ||\
|
130
|
-
can_be_edited_by?(user)
|
131
|
-
end
|
132
|
-
|
133
|
-
def can_be_edited_by?(user) # Thread admin capabilities
|
134
|
-
!commontable.blank? && (config.can_edit_thread_method.blank? ?
|
135
|
-
(user.commontator_config.is_admin_method.blank? ? false : user.send(user.commontator_config.is_admin_method)) :
|
136
|
-
commontable.send(config.can_edit_thread_method, user))
|
137
|
-
end
|
138
|
-
|
139
|
-
def can_subscribe?(user)
|
140
|
-
!commontable.blank? && config.can_subscribe_to_thread && !is_closed? && can_be_read_by?(user)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must provide the following variable:
|
2
|
-
# comment
|
3
|
-
%>
|
4
|
-
|
5
|
-
<% enable_votes = comment.can_be_voted_on? %>
|
6
|
-
|
7
|
-
<% if comment.can_be_voted_on? %>
|
8
|
-
<% can_vote = comment.can_be_voted_on_by?(@commontator) %>
|
9
|
-
<% vote = comment.votes.find_by_voter_id_and_voter_type(@commontator.id, @commontator.class.name) %>
|
10
|
-
|
11
|
-
<span id="comment_<%= comment.id %>_upvote_span" class="comment_upvote">
|
12
|
-
<% if can_vote && (vote.blank? || !vote.vote_flag) %>
|
13
|
-
<%= form_tag upvote_comment_path(comment),
|
14
|
-
:method => :put,
|
15
|
-
:remote => true do %>
|
16
|
-
<%= image_submit_tag "commontator/upvote.png",
|
17
|
-
:onmouseover => "this.src='/assets/commontator/upvote_hover.png'",
|
18
|
-
:onmouseout => "this.src='/assets/commontator/upvote.png'" %>
|
19
|
-
<% end %>
|
20
|
-
<% elsif can_vote %>
|
21
|
-
<%= form_tag unvote_comment_path(comment),
|
22
|
-
:method => :put,
|
23
|
-
:remote => true do %>
|
24
|
-
<%= image_submit_tag "commontator/upvote_hover.png",
|
25
|
-
:onmouseover => "this.src='/assets/commontator/upvote.png'",
|
26
|
-
:onmouseout => "this.src='/assets/commontator/upvote_hover.png'" %>
|
27
|
-
<% end %>
|
28
|
-
<% else %>
|
29
|
-
<%= image_tag "commontator/upvote_hover.png" %>
|
30
|
-
<% end %>
|
31
|
-
<span id="comment_<%= comment.id %>_upvote_count_span" class="comment_upvote_count">
|
32
|
-
<%= comment.upvotes.size %>
|
33
|
-
</span>
|
34
|
-
</span>
|
35
|
-
|
36
|
-
<br/>
|
37
|
-
|
38
|
-
<span id="comment_<%= comment.id %>_downvote_span" class="comment_downvote">
|
39
|
-
<% if can_vote && (vote.blank? || vote.vote_flag) %>
|
40
|
-
<%= form_tag downvote_comment_path(comment),
|
41
|
-
:method => :put,
|
42
|
-
:remote => true do %>
|
43
|
-
<%= image_submit_tag "commontator/downvote.png",
|
44
|
-
:onmouseover => "this.src='/assets/commontator/downvote_hover.png'",
|
45
|
-
:onmouseout => "this.src='/assets/commontator/downvote.png'" %>
|
46
|
-
<% end %>
|
47
|
-
<% elsif can_vote %>
|
48
|
-
<%= form_tag unvote_comment_path(comment),
|
49
|
-
:method => :put,
|
50
|
-
:remote => true do %>
|
51
|
-
<%= image_submit_tag "commontator/downvote_hover.png",
|
52
|
-
:onmouseover => "this.src='/assets/commontator/downvote.png'",
|
53
|
-
:onmouseout => "this.src='/assets/commontator/downvote_hover.png'" %>
|
54
|
-
<% end %>
|
55
|
-
<% else %>
|
56
|
-
<%= image_tag "commontator/downvote_hover.png" %>
|
57
|
-
<% end %>
|
58
|
-
<span id="comment_<%= comment.id %>_downvote_count_span" class="comment_downvote_count">
|
59
|
-
<%= comment.downvotes.size %>
|
60
|
-
</span>
|
61
|
-
</span>
|
62
|
-
<% end %>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<% @thread.comments.each do |comment| %>
|
2
|
-
$("#comment_<%= comment.id.to_s %>_actions_span").html("<%= escape_javascript(
|
3
|
-
render :partial => 'actions',
|
4
|
-
:locals => {:comment => comment}) %>");
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
$("#thread_<%= @thread.id %>_comment_list_div").append("<%= escape_javascript(
|
8
|
-
render :partial => 'show',
|
9
|
-
:locals => {:comment => @comment}) %>");
|
10
|
-
|
11
|
-
$("#thread_<%= @thread.id %>_new_comment_div").hide();
|
12
|
-
|
13
|
-
$("#thread_<%= @thread.id %>_new_comment_link_span").show();
|
14
|
-
|
15
|
-
<%= javascript_proc(self) %>
|
@@ -1 +0,0 @@
|
|
1
|
-
$("#comment_<%= @comment.id.to_s %>_div").remove();
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<%= heading(@comment_commontable_thread.config.comment_update_verb_present.capitalize + " " +\
|
2
|
-
@comment_commontable_thread.config.comment_name + " #" + @comment.id.to_s) %>
|
3
|
-
|
4
|
-
<%= render :partial => 'form', :locals => {:comment => @comment} %>
|
5
|
-
|
6
|
-
<%= link_to 'Back to comment_commontable_thread', @comment_commontable_thread %>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<%= heading(@comment_commontable_thread.config.comment_create_verb_present.capitalize + " " +\
|
2
|
-
@comment_commontable_thread.config.comment_name + " for " + commontable_name(@comment_commontable_thread)) %>
|
3
|
-
|
4
|
-
<%= render :partial => 'form', :locals => {:comment_commontable_thread => @comment_commontable_thread,
|
5
|
-
:comment => @comment,
|
6
|
-
:no_remote => true} %>
|
7
|
-
|
8
|
-
<%= link_to 'Back to CommentCommontableThread', @comment_commontable_thread %>
|
@@ -1,12 +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").show();
|
9
|
-
|
10
|
-
$("#thread_<%= @thread.id %>_new_comment_link_span").hide();
|
11
|
-
|
12
|
-
<%= javascript_proc(self) %>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variable:
|
2
|
-
# thread
|
3
|
-
%>
|
4
|
-
|
5
|
-
<% user = send(Commontator.current_user_method) %>
|
6
|
-
|
7
|
-
<% if thread.can_be_read_by?(user) %>
|
8
|
-
<%= stylesheet_link_tag "commontator/application", :media => "all" %>
|
9
|
-
|
10
|
-
<div id="thread_<%= thread.id %>_div" class="thread">
|
11
|
-
<%= link_to 'View ' + thread.config.comment_name.pluralize, commontator.thread_path(thread), :remote => true %>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<%= heading("Listing your subscriptions") %>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<th width="100%"></th>
|
6
|
-
<th></th>
|
7
|
-
</tr>
|
8
|
-
|
9
|
-
<% @threads.each do |thread| %>
|
10
|
-
<tr>
|
11
|
-
<td><%= commontable_name(thread) %></td>
|
12
|
-
<td><%= link_to 'Unsubscribe', polymorphic_path([:unsubscribe, thread.commontable, :comments]),
|
13
|
-
:confirm => 'Are you sure you want to unsubscribe from ' + commontable_name(thread) + '?' %></td>
|
14
|
-
</tr>
|
15
|
-
<% end %>
|
16
|
-
</table>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variable:
|
2
|
-
# thread
|
3
|
-
%>
|
4
|
-
|
5
|
-
<% is_subscribed = thread.is_subscribed?(@commontator) %>
|
6
|
-
<% sub_string = is_subscribed ? "unsubscribe" : "subscribe" %>
|
7
|
-
<%= link_to sub_string.capitalize,
|
8
|
-
polymorphic_path([sub_string, thread]),
|
9
|
-
:confirm => (is_subscribed ? \
|
10
|
-
"Are you sure you want to unsubscribe from this thread?\n" : \
|
11
|
-
nil),
|
12
|
-
:method => :put,
|
13
|
-
:id => "thread_#{thread.id.to_s}_#{sub_string}_link",
|
14
|
-
:class => "thread_#{sub_string}_link",
|
15
|
-
:remote => true %>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<% # Clients of this partial must supply the following variable:
|
2
|
-
# thread
|
3
|
-
%>
|
4
|
-
|
5
|
-
<% is_subscribed = thread.is_subscribed?(@commontator)
|
6
|
-
<% sub_string = is_subscribed ? "unsubscribe" : "subscribe" %>
|
7
|
-
<%= link_to sub_string.capitalize,
|
8
|
-
polymorphic_path([sub_string, thread]),
|
9
|
-
:confirm => (is_subscribed ? \
|
10
|
-
"Are you sure you want to unsubscribe from ' + \
|
11
|
-
commontable_name(thread) + '?\n" : nil),
|
12
|
-
:method => :put,
|
13
|
-
:remote => true %>
|