commontator 0.4.1 → 0.5.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/README.md +35 -23
  2. data/app/assets/stylesheets/commontator/comments.css +1 -1
  3. data/app/assets/stylesheets/commontator/comments.css~ +0 -4
  4. data/app/controllers/commontator/application_controller.rb +4 -5
  5. data/app/controllers/commontator/application_controller.rb~ +5 -5
  6. data/app/controllers/commontator/comments_controller.rb +30 -30
  7. data/app/controllers/commontator/comments_controller.rb~ +31 -31
  8. data/app/controllers/commontator/subscriptions_controller.rb +8 -7
  9. data/app/controllers/commontator/subscriptions_controller.rb~ +6 -7
  10. data/app/controllers/commontator/threads_controller.rb +8 -9
  11. data/app/controllers/commontator/threads_controller.rb~ +9 -10
  12. data/app/helpers/commontator/comments_helper.rb~ +14 -24
  13. data/app/helpers/commontator/subscriptions_helper.rb~ +3 -3
  14. data/app/helpers/commontator/threads_helper.rb +0 -8
  15. data/app/helpers/commontator/threads_helper.rb~ +5 -5
  16. data/app/mailers/commontator/subscriptions_mailer.rb +8 -8
  17. data/app/mailers/commontator/subscriptions_mailer.rb~ +9 -10
  18. data/app/models/commontator/comment.rb +14 -6
  19. data/app/models/commontator/comment.rb~ +15 -12
  20. data/app/views/commontator/comments/_actions.html.erb +6 -5
  21. data/app/views/commontator/comments/_actions.html.erb~ +6 -5
  22. data/app/views/commontator/comments/_body.html.erb +2 -1
  23. data/app/views/commontator/comments/_body.html.erb~ +1 -2
  24. data/app/views/commontator/comments/_form.html.erb +8 -3
  25. data/app/views/commontator/comments/_form.html.erb~ +7 -4
  26. data/app/views/commontator/comments/_show.html.erb +11 -8
  27. data/app/views/commontator/comments/_show.html.erb~ +11 -8
  28. data/app/views/commontator/comments/_votes.html.erb +7 -6
  29. data/app/views/commontator/comments/create.js.erb +4 -2
  30. data/app/views/commontator/comments/delete.js.erb +5 -3
  31. data/app/views/commontator/comments/delete.js.erb~ +5 -3
  32. data/app/views/commontator/comments/update.js.erb +1 -1
  33. data/app/views/commontator/comments/update.js.erb~ +1 -1
  34. data/app/views/commontator/comments/vote.js.erb +2 -1
  35. data/app/views/commontator/shared/_thread.html.erb +17 -0
  36. data/app/views/commontator/shared/_thread.html.erb~ +16 -0
  37. data/app/views/commontator/shared/_thread_link.html.erb~ +16 -0
  38. data/app/views/commontator/subscriptions/_link.html.erb +3 -2
  39. data/app/views/commontator/subscriptions/subscribe.js.erb +2 -1
  40. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb +1 -1
  41. data/app/views/commontator/threads/_show.html.erb +18 -11
  42. data/app/views/commontator/threads/_show.html.erb~ +18 -11
  43. data/app/views/commontator/threads/show.js.erb +2 -1
  44. data/config/initializers/commontator.rb +14 -14
  45. data/db/migrate/0_install_commontator.rb +3 -3
  46. data/lib/commontator.rb +5 -6
  47. data/lib/commontator.rb~ +5 -6
  48. data/lib/commontator/acts_as_commontable.rb +2 -0
  49. data/lib/commontator/acts_as_commontator.rb +2 -0
  50. data/lib/commontator/controller_includes.rb +23 -0
  51. data/lib/commontator/controller_includes.rb~ +23 -0
  52. data/lib/commontator/shared_helper.rb +42 -0
  53. data/lib/commontator/shared_helper.rb~ +42 -0
  54. data/lib/commontator/shared_methods.rb~ +24 -0
  55. data/lib/commontator/version.rb +1 -1
  56. data/lib/commontator/version.rb~ +1 -1
  57. data/test/dummy/config/initializers/commontator.rb +15 -15
  58. data/test/dummy/db/development.sqlite3 +0 -0
  59. data/test/dummy/db/migrate/1_install_commontator.commontator.rb +3 -3
  60. data/test/dummy/db/schema.rb +3 -3
  61. data/test/dummy/log/development.log +64 -0
  62. metadata +10 -70
  63. data/app/assets/stylesheets/commontator/application.css~ +0 -88
  64. data/app/assets/stylesheets/commontator/threads.css~ +0 -13
  65. data/app/helpers/commontator/application_helper.rb~ +0 -11
  66. data/app/helpers/commontator/comments_helper.rb +0 -51
  67. data/app/helpers/commontator/commontable_helper.rb~ +0 -9
  68. data/app/helpers/commontator/commontator_helper.rb +0 -8
  69. data/app/helpers/commontator/commontator_helper.rb~ +0 -8
  70. data/app/helpers/commontator/subscriptions_helper.rb +0 -8
  71. data/app/mailers/commontator/subscription_mailer.rb~ +0 -38
  72. data/app/models/commontator/subscription.rb~ +0 -21
  73. data/app/models/commontator/thread.rb~ +0 -143
  74. data/app/views/commontator/comments/_votes.html.erb~ +0 -62
  75. data/app/views/commontator/comments/create.js.erb~ +0 -15
  76. data/app/views/commontator/comments/destroy.js.erb~ +0 -1
  77. data/app/views/commontator/comments/edit.html.erb~ +0 -6
  78. data/app/views/commontator/comments/edit.js.erb~ +0 -5
  79. data/app/views/commontator/comments/new.html.erb~ +0 -8
  80. data/app/views/commontator/comments/new.js.erb~ +0 -12
  81. data/app/views/commontator/comments/vote.js.erb~ +0 -5
  82. data/app/views/commontator/shared/_thread_link.html.erb +0 -13
  83. data/app/views/commontator/subscriptions/_index.html.erb~ +0 -16
  84. data/app/views/commontator/subscriptions/_link.html.erb~ +0 -15
  85. data/app/views/commontator/subscriptions/_subscription_link.html.erb~ +0 -13
  86. data/app/views/commontator/subscriptions/create.js.erb~ +0 -5
  87. data/app/views/commontator/subscriptions/destroy.js.erb~ +0 -3
  88. data/app/views/commontator/subscriptions/index.html.erb~ +0 -16
  89. data/app/views/commontator/subscriptions/subscribe.js.erb~ +0 -5
  90. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb~ +0 -6
  91. data/app/views/commontator/threads/_actions.html.erb~ +0 -28
  92. data/app/views/commontator/threads/_link.html.erb~ +0 -14
  93. data/app/views/commontator/threads/close.js.erb~ +0 -5
  94. data/app/views/commontator/threads/show.html.erb~ +0 -3
  95. data/app/views/commontator/threads/show.js.erb~ +0 -6
  96. data/config/initializers/commontator.rb~ +0 -179
  97. data/config/routes.rb~ +0 -24
  98. data/db/migrate/0_install_commontator.rb~ +0 -48
  99. data/lib/commontator/acts_as_commontable.rb~ +0 -39
  100. data/lib/commontator/acts_as_commontator.rb~ +0 -28
  101. data/lib/commontator/commontable_config.rb~ +0 -13
  102. data/lib/commontator/commontator_config.rb~ +0 -13
  103. data/lib/commontator/routes.rb~ +0 -37
  104. data/lib/tasks/commontator_tasks.rake~ +0 -41
  105. data/test/dummy/config/initializers/commontator.rb~ +0 -179
  106. data/test/dummy/config/routes.rb~ +0 -3
  107. data/test/functional/comment_thread_subscriptions_controller_test.rb~ +0 -125
  108. data/test/functional/comments_controller_test.rb~ +0 -184
  109. data/test/functional/subscriptions_controller_test.rb~ +0 -122
  110. data/test/unit/comment_test.rb~ +0 -38
  111. data/test/unit/comment_thread_subscription_test.rb~ +0 -18
  112. data/test/unit/comment_thread_test.rb~ +0 -60
  113. data/test/unit/helpers/comment_thread_subscriptions_helper_test.rb~ +0 -7
  114. data/test/unit/helpers/comments_helper_test.rb~ +0 -7
  115. data/test/unit/helpers/subscriptions_helper_test.rb~ +0 -4
  116. data/test/unit/subscription_test.rb~ +0 -15
  117. data/test/unit/thread_test.rb~ +0 -57
@@ -1,12 +1,13 @@
1
1
  <% # Clients of this partial must supply the following variables:
2
2
  # comment
3
+ # user
3
4
  %>
4
5
 
5
- <% can_edit = comment.can_be_edited_by?(@commontator)
6
- can_delete = comment.can_be_deleted_by?(@commontator) %>
6
+ <% can_edit = comment.can_be_edited_by?(user)
7
+ can_delete = comment.can_be_deleted_by?(user) %>
7
8
 
8
9
  <% if can_edit %>
9
- <%= link_to 'Edit', edit_comment_path(comment),
10
+ <%= link_to 'Edit', commontator.edit_comment_path(comment),
10
11
  :id => "comment_#{comment.id.to_s}_edit_link",
11
12
  :class => "comment_edit_link",
12
13
  :remote => true %>
@@ -18,10 +19,10 @@
18
19
  <% is_deleted = comment.is_deleted? %>
19
20
  <% del_string = is_deleted ? "undelete" : "delete" %>
20
21
  <%= link_to del_string.capitalize,
21
- polymorphic_path([del_string, comment]),
22
+ commontator.polymorphic_path([del_string, comment]),
22
23
  :confirm => (!is_deleted ? \
23
24
  "Are you sure you want to delete this " + \
24
- "#{@thread.config.comment_name}?" : nil),
25
+ "#{comment.thread.config.comment_name}?" : nil),
25
26
  :method => :put,
26
27
  :id => "comment_#{comment.id.to_s}_#{del_string}_link",
27
28
  :class => "comment_#{del_string}_link",
@@ -1,12 +1,13 @@
1
1
  <% # Clients of this partial must supply the following variables:
2
2
  # comment
3
+ # user
3
4
  %>
4
5
 
5
- <% can_edit = comment.can_be_edited_by?(@commontator)
6
- can_delete = comment.can_be_deleted_by?(@commontator) %>
6
+ <% can_edit = comment.can_be_edited_by?(user)
7
+ can_delete = comment.can_be_deleted_by?(user) %>
7
8
 
8
9
  <% if can_edit %>
9
- <%= link_to 'Edit', edit_comment_path(comment),
10
+ <%= link_to 'Edit', commontator.edit_comment_path(comment),
10
11
  :id => "comment_#{comment.id.to_s}_edit_link",
11
12
  :class => "comment_edit_link",
12
13
  :remote => true %>
@@ -15,10 +16,10 @@
15
16
  &nbsp;
16
17
 
17
18
  <% if can_delete %>
18
- <% is_deleted = comment.is_deleted?
19
+ <% is_deleted = comment.is_deleted? %>
19
20
  <% del_string = is_deleted ? "undelete" : "delete" %>
20
21
  <%= link_to del_string.capitalize,
21
- polymorphic_path([del_string, comment]),
22
+ commontator.polymorphic_path([del_string, comment]),
22
23
  :confirm => (!is_deleted ? \
23
24
  "Are you sure you want to delete this " + \
24
25
  "#{@thread.config.comment_name}?" : nil),
@@ -4,4 +4,5 @@
4
4
 
5
5
  <%= simple_format comment.is_deleted? ? \
6
6
  comment.thread.config.comment_name.capitalize + \
7
- ' deleted by ' + deleter_name(comment) : comment.body %>
7
+ ' deleted by ' + commontator_name(comment.deleter) : \
8
+ comment.body %>
@@ -4,5 +4,4 @@
4
4
 
5
5
  <%= simple_format comment.is_deleted? ? \
6
6
  comment.thread.config.comment_name.capitalize + \
7
- ' deleted by ' + deleter_name(comment) : comment.body,
8
- {:id => "comment_#{comment.id}_body_pre", :class => 'comment_body'} %>
7
+ ' deleted by ' + commontator_name(comment.deleter) : comment.body %>
@@ -1,12 +1,14 @@
1
1
  <% # Clients of this partial must provide the following variables:
2
2
  # comment
3
3
  #
4
- # Additionally, they can override the following variable:
4
+ # Additionally, they can override the following variables:
5
5
  thread ||= nil
6
6
  no_remote ||= false
7
7
  %>
8
8
 
9
- <%= form_for([thread, comment],
9
+ <% config = comment.thread.config %>
10
+
11
+ <%= form_for([commontator, thread, comment],
10
12
  :remote => !no_remote) do |f| %>
11
13
 
12
14
  <p>
@@ -14,7 +16,10 @@
14
16
  </p>
15
17
 
16
18
  <p>
17
- <%= f.submit %>
19
+ <%= f.submit (comment.id.blank? ? \
20
+ config.comment_create_verb_present : \
21
+ 'update').capitalize + \
22
+ ' ' + config.comment_name %>
18
23
  </p>
19
24
 
20
25
  <% end %>
@@ -1,13 +1,14 @@
1
1
  <% # Clients of this partial must provide the following variables:
2
2
  # comment
3
3
  #
4
- # Additionally, they can override the following variable:
4
+ # Additionally, they can override the following variables:
5
5
  thread ||= nil
6
6
  no_remote ||= false
7
7
  %>
8
8
 
9
- <%= form_for([thread, comment],
10
- :id => 'new_comment_form',
9
+ <% config = comment.thread.config %>
10
+
11
+ <%= form_for([commontator, thread, comment],
11
12
  :remote => !no_remote) do |f| %>
12
13
 
13
14
  <p>
@@ -15,7 +16,9 @@
15
16
  </p>
16
17
 
17
18
  <p>
18
- <%= f.submit %>
19
+ <%= f.submit (comment.id.blank? ? \
20
+ config.comment_create_verb_present : \
21
+ 'update').capitalize + ' ' + config.comment_name %>
19
22
  </p>
20
23
 
21
24
  <% end %>
@@ -1,34 +1,37 @@
1
1
  <% # Clients of this partial must supply the following variables:
2
2
  # comment
3
+ # user
3
4
  %>
4
5
 
5
6
  <div id="comment_<%= comment.id.to_s %>_div" class="comment" style="clear:both">
6
7
  <span id="comment_<%= comment.id.to_s %>_commontator_span" class="comment_commontator">
7
- <% if !commontator.nil? && commontator.commontator_config.commontator_name_clickable %>
8
- <%= link_to commontator_name(comment), main_app.polymorphic_path(comment.commontator) %>
8
+ <% if !user.nil? && user.commontator_config.user_name_clickable %>
9
+ <%= link_to commontator_name(comment.creator), main_app.polymorphic_path(comment.creator) %>
9
10
  <% else %>
10
- <%= commontator_name(comment) %>
11
+ <%= commontator_name(comment.creator) %>
11
12
  <% end %>
12
13
  &nbsp;&nbsp;
13
14
  <span id="comment_<%= comment.id.to_s %>_timestamp_span" class="comment_timestamp">
14
- <%= comment_timestamp(comment) %>
15
+ <%= comment.timestamp %>
15
16
  </span>
16
17
  </span>
17
18
 
18
19
  <span id="comment_<%= comment.id.to_s %>_actions_span" class="comment_actions">
19
20
  <%= render :partial => 'commontator/comments/actions',
20
- :locals => { :comment => comment } %>
21
+ :locals => {:comment => comment,
22
+ :user => user} %>
21
23
  </span>
22
24
 
23
25
  <br clear="all"/>
24
26
 
25
- <span id="comment_<%= comment.id.to_s %>_profile_picture_span" class="comment_profile_picture">
26
- <%= gravatar_image comment %>
27
+ <span id="comment_<%= comment.id.to_s %>_gravatar_image_span" class="comment_gravatar_image">
28
+ <%= commontator_gravatar_image comment.creator %>
27
29
  </span>
28
30
 
29
31
  <span id="comment_<%= comment.id.to_s %>_votes_span" class="comment_votes">
30
32
  <%= render :partial => 'commontator/comments/votes',
31
- :locals => {:comment => comment} %>
33
+ :locals => {:comment => comment,
34
+ :user => user} %>
32
35
  </span>
33
36
 
34
37
  <div id="comment_<%= comment.id.to_s %>_body_div" class="comment_body">
@@ -1,34 +1,37 @@
1
1
  <% # Clients of this partial must supply the following variables:
2
2
  # comment
3
+ # user
3
4
  %>
4
5
 
5
6
  <div id="comment_<%= comment.id.to_s %>_div" class="comment" style="clear:both">
6
7
  <span id="comment_<%= comment.id.to_s %>_commontator_span" class="comment_commontator">
7
- <% if !commontator.nil? && commontator.commontator_config.commontator_name_clickable && %>
8
- <%= link_to commontator_name(comment), main_app.polymorphic_path(comment.commontator) %>
8
+ <% if !user.nil? && user.commontator_config.user_name_clickable %>
9
+ <%= link_to commontator_name(comment.creator), main_app.polymorphic_path(comment.creator) %>
9
10
  <% else %>
10
- <%= commontator_name(comment) %>
11
+ <%= commontator_name(comment.creator) %>
11
12
  <% end %>
12
13
  &nbsp;&nbsp;
13
14
  <span id="comment_<%= comment.id.to_s %>_timestamp_span" class="comment_timestamp">
14
- <%= comment_timestamp(comment) %>
15
+ <%= comment.timestamp %>
15
16
  </span>
16
17
  </span>
17
18
 
18
19
  <span id="comment_<%= comment.id.to_s %>_actions_span" class="comment_actions">
19
20
  <%= render :partial => 'commontator/comments/actions',
20
- :locals => { :comment => comment } %>
21
+ :locals => {:comment => comment,
22
+ :user => user} %>
21
23
  </span>
22
24
 
23
25
  <br clear="all"/>
24
26
 
25
- <span id="comment_<%= comment.id.to_s %>_profile_picture_span" class="comment_profile_picture">
26
- <%= gravatar_image comment %>
27
+ <span id="comment_<%= comment.id.to_s %>_gravatar_image_span" class="comment_profile_picture">
28
+ <%= commontator_gravatar_image comment.creator %>
27
29
  </span>
28
30
 
29
31
  <span id="comment_<%= comment.id.to_s %>_votes_span" class="comment_votes">
30
32
  <%= render :partial => 'commontator/comments/votes',
31
- :locals => {:comment => comment} %>
33
+ :locals => {:comment => comment,
34
+ :user => user} %>
32
35
  </span>
33
36
 
34
37
  <div id="comment_<%= comment.id.to_s %>_body_div" class="comment_body">
@@ -1,14 +1,15 @@
1
1
  <% # Clients of this partial must provide the following variable:
2
2
  # comment
3
+ # user
3
4
  %>
4
5
 
5
6
  <% if comment.can_be_voted_on? %>
6
- <% can_vote = comment.can_be_voted_on_by?(@commontator) %>
7
- <% vote = comment.votes.find_by_voter_id_and_voter_type(@commontator.id, @commontator.class.name) %>
7
+ <% can_vote = comment.can_be_voted_on_by?(user) %>
8
+ <% vote = comment.votes.find_by_voter_id_and_voter_type(user.id, user.class.name) %>
8
9
 
9
10
  <span id="comment_<%= comment.id %>_upvote_span" class="comment_upvote">
10
11
  <% if can_vote && (vote.blank? || !vote.vote_flag) %>
11
- <%= form_tag upvote_comment_path(comment),
12
+ <%= form_tag commontator.upvote_comment_path(comment),
12
13
  :method => :put,
13
14
  :remote => true do %>
14
15
  <%= image_submit_tag "commontator/upvote.png",
@@ -16,7 +17,7 @@
16
17
  :onmouseout => "this.src='/assets/commontator/upvote.png'" %>
17
18
  <% end %>
18
19
  <% elsif can_vote %>
19
- <%= form_tag unvote_comment_path(comment),
20
+ <%= form_tag commontator.unvote_comment_path(comment),
20
21
  :method => :put,
21
22
  :remote => true do %>
22
23
  <%= image_submit_tag "commontator/upvote_hover.png",
@@ -35,7 +36,7 @@
35
36
 
36
37
  <span id="comment_<%= comment.id %>_downvote_span" class="comment_downvote">
37
38
  <% if can_vote && (vote.blank? || vote.vote_flag) %>
38
- <%= form_tag downvote_comment_path(comment),
39
+ <%= form_tag commontator.downvote_comment_path(comment),
39
40
  :method => :put,
40
41
  :remote => true do %>
41
42
  <%= image_submit_tag "commontator/downvote.png",
@@ -43,7 +44,7 @@
43
44
  :onmouseout => "this.src='/assets/commontator/downvote.png'" %>
44
45
  <% end %>
45
46
  <% elsif can_vote %>
46
- <%= form_tag unvote_comment_path(comment),
47
+ <%= form_tag commontator.unvote_comment_path(comment),
47
48
  :method => :put,
48
49
  :remote => true do %>
49
50
  <%= image_submit_tag "commontator/downvote_hover.png",
@@ -1,12 +1,14 @@
1
1
  <% @thread.comments.each do |comment| %>
2
2
  $("#comment_<%= comment.id.to_s %>_actions_span").html("<%= escape_javascript(
3
3
  render :partial => 'actions',
4
- :locals => {:comment => comment}) %>");
4
+ :locals => {:comment => comment,
5
+ :user => @user}) %>");
5
6
  <% end %>
6
7
 
7
8
  $("#thread_<%= @thread.id %>_comment_list_div").append("<%= escape_javascript(
8
9
  render :partial => 'show',
9
- :locals => {:comment => @comment}) %>");
10
+ :locals => {:comment => @comment,
11
+ :user => @user}) %>");
10
12
 
11
13
  $("#thread_<%= @thread.id %>_new_comment_div").hide();
12
14
 
@@ -2,14 +2,16 @@ $("#comment_<%= @comment.id.to_s %>_body_div").html("<%= escape_javascript(
2
2
  render :partial => 'body', :locals => {:comment => @comment}) %>");
3
3
 
4
4
  $("#comment_<%= @comment.id.to_s %>_timestamp_span").html("<%= escape_javascript(
5
- comment_timestamp(@comment)) %>");
5
+ @comment.timestamp) %>");
6
6
 
7
7
  $("#comment_<%= @comment.id.to_s %>_actions_span").html("<%= escape_javascript(
8
8
  render :partial => 'actions',
9
- :locals => {:comment => @comment}) %>");
9
+ :locals => {:comment => @comment,
10
+ :user => @user}) %>");
10
11
 
11
12
  $("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
12
13
  render :partial => 'votes',
13
- :locals => {:comment => @comment}) %>");
14
+ :locals => {:comment => @comment,
15
+ :user => @user}) %>");
14
16
 
15
17
  <%= javascript_proc %>
@@ -6,10 +6,12 @@ $("#comment_<%= @comment.id.to_s %>_timestamp_span").html("<%= escape_javascript
6
6
 
7
7
  $("#comment_<%= @comment.id.to_s %>_actions_span").html("<%= escape_javascript(
8
8
  render :partial => 'actions',
9
- :locals => {:comment => @comment}) %>");
9
+ :locals => {:comment => @comment,
10
+ :user => @user}) %>");
10
11
 
11
12
  $("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
12
13
  render :partial => 'votes',
13
- :locals => {:comment => @comment}) %>");
14
+ :locals => {:comment => @comment,
15
+ :user => @user}) %>");
14
16
 
15
- <%= javascript_proc(self) %>
17
+ <%= javascript_proc %>
@@ -2,6 +2,6 @@ $("#comment_<%= @comment.id.to_s %>_body_div").html("<%= escape_javascript(
2
2
  render :partial => 'body', :locals => {:comment => @comment}) %>");
3
3
 
4
4
  $("#comment_<%= @comment.id.to_s %>_timestamp_span").html("<%= escape_javascript(
5
- comment_timestamp(@comment)) %>");
5
+ @comment.timestamp) %>");
6
6
 
7
7
  <%= javascript_proc %>
@@ -4,4 +4,4 @@ $("#comment_<%= @comment.id.to_s %>_body_div").html("<%= escape_javascript(
4
4
  $("#comment_<%= @comment.id.to_s %>_timestamp_span").html("<%= escape_javascript(
5
5
  comment_timestamp(@comment)) %>");
6
6
 
7
- <%= javascript_proc(self) %>
7
+ <%= javascript_proc %>
@@ -1,5 +1,6 @@
1
1
  $("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
2
2
  render :partial => 'votes',
3
- :locals => {:comment => @comment}) %>");
3
+ :locals => {:comment => @comment,
4
+ :user => @user}) %>");
4
5
 
5
6
  <%= javascript_proc %>
@@ -0,0 +1,17 @@
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_thread_show %>
11
+ <%= render :partial => 'commontator/threads/show', :locals => {:thread => thread,
12
+ :user => user} %>
13
+ <% else %>
14
+ <%= link_to "Show #{thread.config.comment_name.pluralize} (#{thread.comments.count})", commontator.thread_path(thread), :remote => true %>
15
+ <% end %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,16 @@
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_thread_show %>
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 %>
@@ -0,0 +1,16 @@
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,11 +1,12 @@
1
1
  <% # Clients of this partial must supply the following variable:
2
2
  # thread
3
+ # user
3
4
  %>
4
5
 
5
- <% is_subscribed = thread.is_subscribed?(@commontator) %>
6
+ <% is_subscribed = thread.is_subscribed?(user) %>
6
7
  <% sub_string = is_subscribed ? "unsubscribe" : "subscribe" %>
7
8
  <%= link_to sub_string.capitalize,
8
- polymorphic_path([sub_string, thread]),
9
+ commontator.polymorphic_path([sub_string, thread]),
9
10
  :confirm => (is_subscribed ? \
10
11
  "Are you sure you want to unsubscribe from this thread?" : \
11
12
  nil),
@@ -1,5 +1,6 @@
1
1
  $("#thread_<%= @thread.id.to_s %>_subscription_span").html("<%= escape_javascript(
2
2
  render :partial => 'link',
3
- :locals => {:thread => @thread}) %>");
3
+ :locals => {:thread => @thread,
4
+ :user => @user}) %>");
4
5
 
5
6
  <%= javascript_proc %>
@@ -1,4 +1,4 @@
1
- <h4><%= @commontator_name %>'s <%= @thread.config.comment_name %> on <%= @commontable_name %> #<%= @commontable_id %>:</h4>
1
+ <h4><%= @creator_name %>'s <%= @thread.config.comment_name %> on <%= @commontable_name %> #<%= @commontable_id %>:</h4>
2
2
 
3
3
  <%= render :partial => 'commontator/comments/body',
4
4
  :locals => { :comment => @comment } %>
@@ -1,19 +1,21 @@
1
- <% # Clients of this partial must supply the following variable:
1
+ <% # Clients of this partial must supply the following variables:
2
2
  # thread
3
+ # user
3
4
  %>
4
5
 
5
- <% can_subscribe = thread.can_subscribe?(@commontator) %>
6
- <% can_edit = thread.can_be_edited_by?(@commontator) %>
6
+ <% can_subscribe = thread.can_subscribe?(user) %>
7
+ <% can_edit = thread.can_be_edited_by?(user) %>
7
8
 
8
9
  <span id="thread_<%= thread.id.to_s %>_header_span" class="thread_header">
9
- <%= thread.config.comment_name.capitalize.pluralize %>
10
+ <%= thread.config.comment_name.capitalize.pluralize + (thread.is_closed? ? ' (closed)' : '') %>
10
11
  </span>
11
12
 
12
13
  <span id="thread_<%= thread.id.to_s %>_actions_span" class="thread_actions">
13
14
  <% if can_subscribe %>
14
15
  <span id="thread_<%= thread.id.to_s %>_subscription_span" class="thread_subscription">
15
16
  <%= render :partial => 'commontator/subscriptions/link',
16
- :locals => {:thread => thread} %>
17
+ :locals => {:thread => thread,
18
+ :user => user} %>
17
19
  </span>
18
20
  <% end %>
19
21
 
@@ -23,7 +25,7 @@
23
25
  <% is_closed = thread.is_closed? %>
24
26
  <% close_string = is_closed ? "reopen" : "close" %>
25
27
  <%= link_to close_string.capitalize,
26
- polymorphic_path([close_string, thread]),
28
+ commontator.polymorphic_path([close_string, thread]),
27
29
  :confirm => (!is_closed ? \
28
30
  'Are you sure you want to close this thread?' : nil),
29
31
  :method => :put,
@@ -34,21 +36,26 @@
34
36
 
35
37
  <div id="thread_<%= thread.id.to_s %>_comment_list_div" class="thread_comment_list">
36
38
  <% thread.ordered_comments.each do |comment| %>
37
- <% next unless comment.can_be_read_by?(@commontator) %>
39
+ <% next unless comment.can_be_read_by?(user) %>
38
40
  <%= render :partial => 'commontator/comments/show',
39
- :locals => {:comment => comment} %>
41
+ :locals => {:comment => comment,
42
+ :user => user} %>
40
43
  <% end %>
41
44
  </div>
42
45
 
43
- <% unless thread.is_closed? %>
46
+ <br/>
44
47
 
45
- <br/>
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 %>
46
53
 
47
54
  <div id="thread_<%= thread.id %>_new_comment_div" class="thread_new_comment"></div>
48
55
 
49
56
  <span id="thread_<%= thread.id %>_new_comment_link_span" class="thread_new_comment_link">
50
57
  <%= link_to thread.config.comment_create_verb_present.capitalize + ' ' + thread.config.comment_name,
51
- new_thread_comment_path(thread), :remote => true %>
58
+ commontator.new_thread_comment_path(thread), :remote => true %>
52
59
  </span>
53
60
 
54
61
  <% end %>