commontator 0.2.4 → 0.3.10

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.
Files changed (70) hide show
  1. data/app/assets/stylesheets/commontator/threads.css +4 -0
  2. data/app/assets/stylesheets/commontator/threads.css~ +1 -1
  3. data/app/controllers/commontator/application_controller.rb +5 -0
  4. data/app/controllers/commontator/application_controller.rb~ +8 -1
  5. data/app/controllers/commontator/comments_controller.rb +24 -31
  6. data/app/controllers/commontator/comments_controller.rb~ +25 -32
  7. data/app/controllers/commontator/subscriptions_controller.rb +8 -18
  8. data/app/controllers/commontator/subscriptions_controller.rb~ +10 -16
  9. data/app/controllers/commontator/threads_controller.rb +3 -5
  10. data/app/controllers/commontator/threads_controller.rb~ +3 -6
  11. data/app/helpers/commontator/application_helper.rb +2 -6
  12. data/app/helpers/commontator/application_helper.rb~ +4 -4
  13. data/app/helpers/commontator/commontator_helper.rb +2 -2
  14. data/app/helpers/commontator/commontator_helper.rb~ +2 -2
  15. data/app/helpers/commontator/threads_helper.rb +1 -1
  16. data/app/helpers/commontator/threads_helper.rb~ +5 -12
  17. data/app/mailers/commontator/subscriptions_mailer.rb +15 -11
  18. data/app/mailers/commontator/subscriptions_mailer.rb~ +15 -12
  19. data/app/models/commontator/comment.rb +2 -2
  20. data/app/models/commontator/thread.rb +11 -11
  21. data/app/models/commontator/thread.rb~ +7 -9
  22. data/app/views/commontator/comments/_actions.html.erb +13 -16
  23. data/app/views/commontator/comments/_actions.html.erb~ +13 -17
  24. data/app/views/commontator/comments/create.js.erb +1 -1
  25. data/app/views/commontator/comments/create.js.erb~ +2 -2
  26. data/app/views/commontator/comments/delete.js.erb +1 -1
  27. data/app/views/commontator/comments/delete.js.erb~ +2 -2
  28. data/app/views/commontator/comments/edit.js.erb +1 -1
  29. data/app/views/commontator/comments/edit.js.erb~ +2 -2
  30. data/app/views/commontator/comments/new.js.erb +1 -1
  31. data/app/views/commontator/comments/new.js.erb~ +2 -2
  32. data/app/views/commontator/comments/update.js.erb +1 -1
  33. data/app/views/commontator/comments/update.js.erb~ +2 -2
  34. data/app/views/commontator/comments/vote.js.erb +1 -1
  35. data/app/views/commontator/comments/vote.js.erb~ +2 -2
  36. data/app/views/commontator/{commontator/_thread.html.erb~ → shared/_thread_link.html.erb} +1 -3
  37. data/app/views/commontator/subscriptions/{index.html.erb → _index.html.erb~} +0 -0
  38. data/app/views/commontator/subscriptions/_link.html.erb +15 -0
  39. data/app/views/commontator/subscriptions/_link.html.erb~ +15 -0
  40. data/app/views/commontator/subscriptions/_subscription_link.html.erb~ +8 -7
  41. data/app/views/commontator/subscriptions/create.js.erb~ +4 -2
  42. data/app/views/commontator/subscriptions/subscribe.js.erb +5 -0
  43. data/app/views/commontator/subscriptions/subscribe.js.erb~ +5 -0
  44. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb +4 -12
  45. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb~ +4 -12
  46. data/app/views/commontator/threads/_actions.html.erb~ +28 -0
  47. data/app/views/commontator/{commontator/_thread.html.erb → threads/_link.html.erb~} +1 -1
  48. data/app/views/commontator/threads/_show.html.erb +30 -2
  49. data/app/views/commontator/threads/_show.html.erb~ +31 -3
  50. data/app/views/commontator/threads/close.js.erb~ +5 -0
  51. data/app/views/commontator/threads/{show.html.erb → show.html.erb~} +0 -0
  52. data/app/views/commontator/threads/show.js.erb +1 -1
  53. data/app/views/commontator/threads/show.js.erb~ +6 -0
  54. data/config/initializers/commontator.rb +17 -11
  55. data/config/initializers/commontator.rb~ +16 -11
  56. data/config/routes.rb +2 -4
  57. data/config/routes.rb~ +4 -2
  58. data/lib/commontator.rb +1 -1
  59. data/lib/commontator.rb~ +2 -2
  60. data/lib/commontator/version.rb +1 -1
  61. data/lib/commontator/version.rb~ +1 -1
  62. data/test/dummy/config/initializers/commontator.rb +23 -12
  63. data/test/dummy/config/initializers/commontator.rb~ +174 -0
  64. data/test/dummy/log/development.log +6 -0
  65. metadata +15 -11
  66. data/app/views/commontator/comments/edit.html.erb +0 -6
  67. data/app/views/commontator/comments/new.html.erb +0 -8
  68. data/app/views/commontator/subscriptions/_subscription_link.html.erb +0 -12
  69. data/app/views/commontator/subscriptions/create.js.erb +0 -5
  70. data/app/views/commontator/subscriptions/destroy.js.erb +0 -5
@@ -1,4 +1,4 @@
1
- <% @thread.comments.each do |comment|
1
+ <% @thread.comments.each do |comment| %>
2
2
  $("#comment_<%= comment.id.to_s %>_actions_span").html("<%= escape_javascript(
3
3
  render :partial => 'actions',
4
4
  :locals => {:comment => comment}) %>");
@@ -12,4 +12,4 @@ $("#thread_<%= @thread.id %>_new_comment_div").hide();
12
12
 
13
13
  $("#thread_<%= @thread.id %>_new_comment_link_span").show();
14
14
 
15
- <%= javascript_callback %>
15
+ <%= javascript_proc(self) %>
@@ -12,4 +12,4 @@ $("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
12
12
  render :partial => 'votes',
13
13
  :locals => {:comment => @comment}) %>");
14
14
 
15
- <%= javascript_callback %>
15
+ <%= javascript_proc %>
@@ -6,10 +6,10 @@ $("#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
10
 
11
11
  $("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
12
12
  render :partial => 'votes',
13
13
  :locals => {:comment => @comment}) %>");
14
14
 
15
- <%= javascript_callback %>
15
+ <%= javascript_proc(self) %>
@@ -2,4 +2,4 @@ $("#comment_<%= @comment.id.to_s %>_body_div").html("<%= escape_javascript(
2
2
  render :partial => 'form',
3
3
  :locals => {:comment => @comment}) %>");
4
4
 
5
- <%= javascript_callback %>
5
+ <%= javascript_proc %>
@@ -1,5 +1,5 @@
1
- $("#comment_<%= @comment.id.to_s %>_div").html("<%= escape_javascript(
1
+ $("#comment_<%= @comment.id.to_s %>_body_div").html("<%= escape_javascript(
2
2
  render :partial => 'form',
3
3
  :locals => {:comment => @comment}) %>");
4
4
 
5
- <%= javascript_callback %>
5
+ <%= javascript_proc(self) %>
@@ -9,4 +9,4 @@ $("#thread_<%= @thread.id %>_new_comment_div").show();
9
9
 
10
10
  $("#thread_<%= @thread.id %>_new_comment_link_span").hide();
11
11
 
12
- <%= javascript_callback %>
12
+ <%= javascript_proc %>
@@ -5,8 +5,8 @@ $("#thread_<%= @thread.id %>_new_comment_div").html("<%= escape_javascript(
5
5
  :thread => @thread
6
6
  }) %>");
7
7
 
8
- $("#thread_<%= @thread.id %>_new_comment_div").hide();
8
+ $("#thread_<%= @thread.id %>_new_comment_div").show();
9
9
 
10
10
  $("#thread_<%= @thread.id %>_new_comment_link_span").hide();
11
11
 
12
- <%= javascript_callback %>
12
+ <%= javascript_proc(self) %>
@@ -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_callback %>
7
+ <%= javascript_proc %>
@@ -1,7 +1,7 @@
1
- $("#comment_<%= @comment.id.to_s %>_body_span").html("<%= escape_javascript(
1
+ $("#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
5
  comment_timestamp(@comment)) %>");
6
6
 
7
- <%= javascript_callback %>
7
+ <%= javascript_proc(self) %>
@@ -2,4 +2,4 @@ $("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
2
2
  render :partial => 'votes',
3
3
  :locals => {:comment => @comment}) %>");
4
4
 
5
- <%= javascript_callback %>
5
+ <%= javascript_proc %>
@@ -1,5 +1,5 @@
1
1
  $("#comment_<%= @comment.id %>_votes_span").html("<%= escape_javascript(
2
2
  render :partial => 'votes',
3
- :locals => { :comment => @comment }) %>");
3
+ :locals => {:comment => @comment}) %>");
4
4
 
5
- <%= javascript_callback %>
5
+ <%= javascript_proc(self) %>
@@ -1,13 +1,11 @@
1
1
  <% # Clients of this partial must supply the following variable:
2
- # commontable
2
+ # thread
3
3
  %>
4
4
 
5
5
  <% user = send(Commontator.current_user_method) %>
6
- <% thread = commontable.thread %>
7
6
 
8
7
  <% if thread.can_be_read_by?(user) %>
9
8
  <%= stylesheet_link_tag "commontator/application", :media => "all" %>
10
- <%= javascript_include_tag "commontator/application" %>
11
9
 
12
10
  <div id="thread_<%= thread.id %>_div" class="thread">
13
11
  <%= link_to 'View ' + thread.config.comment_name.pluralize, commontator.thread_path(thread), :remote => true %>
@@ -0,0 +1,15 @@
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?" : \
11
+ nil),
12
+ :method => :put,
13
+ :id => "thread_#{thread.id.to_s}_#{sub_string}_link",
14
+ :class => "thread_#{sub_string}_link",
15
+ :remote => true %>
@@ -0,0 +1,15 @@
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,12 +1,13 @@
1
1
  <% # Clients of this partial must supply the following variable:
2
- # comment_commontable_thread
2
+ # thread
3
3
  %>
4
4
 
5
- <% subscription = comment_commontable_thread.is_subscribed?(@user)
6
- <% sub_string = subscription ? "unsubscribe" : "subscribe" %>
5
+ <% is_subscribed = thread.is_subscribed?(@commontator)
6
+ <% sub_string = is_subscribed ? "unsubscribe" : "subscribe" %>
7
7
  <%= link_to sub_string.capitalize,
8
- polymorphic_path([sub_string, commontable, :comments]),
9
- :confirm => (subscription ? \
10
- "Are you sure you want to unsubscribe from ' + commontable_name(comment_commontable_thread) + '?\n" : \
11
- nil),
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,
12
13
  :remote => true %>
@@ -1,3 +1,5 @@
1
- $("#subscription_link_span").html("<%= escape_javascript(
1
+ $("#subscription_span").html("<%= escape_javascript(
2
2
  render :partial => 'subscription_link',
3
- :locals => {:comment_commontable_thread => @comment_commontable_thread}) %>");
3
+ :locals => {:thread => @thread}) %>");
4
+
5
+ <%= javascript_callback %>
@@ -0,0 +1,5 @@
1
+ $("#thread_<%= @thread.id.to_s %>_subscription_span").html("<%= escape_javascript(
2
+ render :partial => 'link',
3
+ :locals => {:thread => @thread}) %>");
4
+
5
+ <%= javascript_proc %>
@@ -0,0 +1,5 @@
1
+ $("#thread_<%= @thread.id.to_s %>_subscription_span").html("<%= escape_javascript(
2
+ render :partial => 'link',
3
+ :locals => {:thread => @thread}) %>");
4
+
5
+ <%= javascript_proc(self) %>
@@ -1,14 +1,6 @@
1
- <h4><%= @commontator_name %>'s <%= @thread.config.comment_name %> on <%= @commontable_name %> #<%= @commontable_id %></h4>
1
+ <h4><%= @commontator_name %>'s <%= @thread.config.comment_name %> on <%= @commontable_name %> #<%= @commontable_id %>:</h4>
2
2
 
3
- <pre style="white-space: pre-wrap;
4
- white-space: -moz-pre-wrap !important;
5
- white-space: -pre-wrap;
6
- white-space: -o-pre-wrap;
7
- word-wrap: break-word;"><%= @comment.body %></pre>
3
+ <%= render :partial => 'commontator/comments/body',
4
+ :locals => { :comment => @comment } %>
8
5
 
9
- <p>Please use the links below to reply to this message:</p>
10
-
11
- <p><%= link_to "Visit " + @commontable_name, main_app.polymorphic_path(@commontable) %></p>
12
- <p><%= link_to "View " + @thread.config.comment_name.pluralize + " on " + @commontable_name, @thread %></p>
13
- <p><%= link_to "Post a new " + @thread.config.comment_name, new_thread_comment_path(@thread) %></p>
14
- <p><%= link_to "Unsubscribe from this thread", unsubscribe_thread_path(@thread) %></p>
6
+ <p><a href="<%= @commontable_url %>">Click here</a> to visit this thread.</p>
@@ -1,14 +1,6 @@
1
- <h4><%= @commontator_name %>'s <%= @thread.config.comment_name %> on <%= @commontable_name %> #<%= @commontable_id %></h4>
1
+ <h4><%= @commontator_name %>'s <%= @thread.config.comment_name %> on <%= @commontable_name %> #<%= @commontable_id %>:</h4>
2
2
 
3
- <pre style="white-space: pre-wrap;
4
- white-space: -moz-pre-wrap !important;
5
- white-space: -pre-wrap;
6
- white-space: -o-pre-wrap;
7
- word-wrap: break-word;"><%= @comment.body %></pre>
3
+ <%= render :partial => 'commontator/comments/body',
4
+ :locals => { :comment => @comment } %>
8
5
 
9
- <p>Please use the links below to reply to this message:</p>
10
-
11
- <p><%= link_to "Visit " + @commontable_name, @commontable %></p>
12
- <p><%= link_to "View " + @thread.config.comment_name.pluralize + " on " + @commontable_name, @thread %></p>
13
- <p><%= link_to "Post a new " + @thread.config.comment_name, new_thread_comment_path(@thread) %></p>
14
- <p><%= link_to "Unsubscribe from this thread", unsubscribe_thread_path(@thread) %></p>
6
+ <p><a href="<%= @commontable_url %>">click here</a> to visit this thread.</p>
@@ -0,0 +1,28 @@
1
+ <% # Clients of this partial must supply the following variables:
2
+ # thread
3
+ %>
4
+
5
+ <% can_subscribe = thread.can_subscribe?(@commontator) %>
6
+ <% can_edit = thread.can_be_edited_by?(@commontator) %>
7
+
8
+ <% if can_subscribe %>
9
+ <span id="thread_<%= thread.id.to_s %>_subscription_span" class="thread_subscription">
10
+ <%= render :partial => 'commontator/subscriptions/link',
11
+ :locals => {:thread => thread} %>
12
+ </span>
13
+ <% end %>
14
+
15
+ &nbsp;
16
+
17
+ <% if can_edit %>
18
+ <% is_closed = thread.is_closed?
19
+ <% close_string = is_closed ? "reopen" : "close" %>
20
+ <%= link_to close_string.capitalize,
21
+ polymorphic_path([close_string, thread]),
22
+ :confirm => (!is_closed ? \
23
+ 'Are you sure you want to close this thread' : nil),
24
+ :method => :put,
25
+ :id => "thread_#{thread.id.to_s}_#{close_string}_link",
26
+ :class => "thread_#{close_string}_link",
27
+ :remote => true %>
28
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  <% # Clients of this partial must supply the following variable:
2
- # commontable
2
+ # thread
3
3
  %>
4
4
 
5
5
  <% user = send(Commontator.current_user_method) %>
@@ -2,11 +2,37 @@
2
2
  # thread
3
3
  %>
4
4
 
5
- <span id="thread_<%= thread.id %>_header_span" class="thread_header">
5
+ <% can_subscribe = thread.can_subscribe?(@commontator) %>
6
+ <% can_edit = thread.can_be_edited_by?(@commontator) %>
7
+
8
+ <span id="thread_<%= thread.id.to_s %>_header_span" class="thread_header">
6
9
  <%= thread.config.comment_name.capitalize.pluralize %>
7
10
  </span>
8
11
 
9
- <div id="thread_<%= thread.id %>_comment_list_div" class="thread_comment_list">
12
+ <span id="thread_<%= thread.id.to_s %>_actions_span" class="thread_actions">
13
+ <% if can_subscribe %>
14
+ <span id="thread_<%= thread.id.to_s %>_subscription_span" class="thread_subscription">
15
+ <%= render :partial => 'commontator/subscriptions/link',
16
+ :locals => {:thread => thread} %>
17
+ </span>
18
+ <% end %>
19
+
20
+ &nbsp;
21
+
22
+ <% if can_edit %>
23
+ <% is_closed = thread.is_closed? %>
24
+ <% close_string = is_closed ? "reopen" : "close" %>
25
+ <%= link_to close_string.capitalize,
26
+ polymorphic_path([close_string, thread]),
27
+ :confirm => (!is_closed ? \
28
+ 'Are you sure you want to close this thread?' : nil),
29
+ :method => :put,
30
+ :id => "thread_#{thread.id.to_s}_#{close_string}_link",
31
+ :class => "thread_#{close_string}_link" %>
32
+ <% end %>
33
+ </span>
34
+
35
+ <div id="thread_<%= thread.id.to_s %>_comment_list_div" class="thread_comment_list">
10
36
  <% thread.ordered_comments.each do |comment| %>
11
37
  <% next unless comment.can_be_read_by?(@commontator) %>
12
38
  <%= render :partial => 'commontator/comments/show',
@@ -16,6 +42,8 @@
16
42
 
17
43
  <% unless thread.is_closed? %>
18
44
 
45
+ <br/>
46
+
19
47
  <div id="thread_<%= thread.id %>_new_comment_div" class="thread_new_comment"></div>
20
48
 
21
49
  <span id="thread_<%= thread.id %>_new_comment_link_span" class="thread_new_comment_link">
@@ -2,12 +2,38 @@
2
2
  # thread
3
3
  %>
4
4
 
5
- <span id="thread_<%= thread.id %>_header_span" class="thread_header">
5
+ <% can_subscribe = thread.can_subscribe?(@commontator) %>
6
+ <% can_edit = thread.can_be_edited_by?(@commontator) %>
7
+
8
+ <span id="thread_<%= thread.id.to_s %>_header_span" class="thread_header">
6
9
  <%= thread.config.comment_name.capitalize.pluralize %>
7
10
  </span>
8
11
 
9
- <div id="thread_<%= thread.id %>_comment_list_div" class="thread_comment_list">
10
- <% thread.comments.each do |comment| %>
12
+ <span id="thread_<%= thread.id.to_s %>_actions_span" class="thread_actions">
13
+ <% if can_subscribe %>
14
+ <span id="thread_<%= thread.id.to_s %>_subscription_span" class="thread_subscription">
15
+ <%= render :partial => 'commontator/subscriptions/link',
16
+ :locals => {:thread => thread} %>
17
+ </span>
18
+ <% end %>
19
+
20
+ &nbsp;
21
+
22
+ <% if can_edit %>
23
+ <% is_closed = thread.is_closed? %>
24
+ <% close_string = is_closed ? "reopen" : "close" %>
25
+ <%= link_to close_string.capitalize,
26
+ polymorphic_path([close_string, thread]),
27
+ :confirm => (!is_closed ? \
28
+ 'Are you sure you want to close this thread' : nil),
29
+ :method => :put,
30
+ :id => "thread_#{thread.id.to_s}_#{close_string}_link",
31
+ :class => "thread_#{close_string}_link" %>
32
+ <% end %>
33
+ </span>
34
+
35
+ <div id="thread_<%= thread.id.to_s %>_comment_list_div" class="thread_comment_list">
36
+ <% thread.ordered_comments.each do |comment| %>
11
37
  <% next unless comment.can_be_read_by?(@commontator) %>
12
38
  <%= render :partial => 'commontator/comments/show',
13
39
  :locals => {:comment => comment} %>
@@ -16,6 +42,8 @@
16
42
 
17
43
  <% unless thread.is_closed? %>
18
44
 
45
+ <br/>
46
+
19
47
  <div id="thread_<%= thread.id %>_new_comment_div" class="thread_new_comment"></div>
20
48
 
21
49
  <span id="thread_<%= thread.id %>_new_comment_link_span" class="thread_new_comment_link">
@@ -0,0 +1,5 @@
1
+ $("#thread_<%= @thread.id.to_s %>_actions_span").html("<%= escape_javascript(
2
+ render :partial => 'actions',
3
+ :locals => {:thread => @thread}) %>");
4
+
5
+ <%= javascript_proc(self) %>
@@ -3,4 +3,4 @@ $("#thread_<%= @thread.id %>_div").html(
3
3
  render :partial => 'show',
4
4
  :locals => {:thread => @thread}) %>");
5
5
 
6
- <%= javascript_callback %>
6
+ <%= javascript_proc %>
@@ -0,0 +1,6 @@
1
+ $("#thread_<%= @thread.id %>_div").html(
2
+ "<%= escape_javascript(
3
+ render :partial => 'show',
4
+ :locals => {:thread => @thread}) %>");
5
+
6
+ <%= javascript_proc(self) %>
@@ -8,13 +8,12 @@ Commontator.configure do |config|
8
8
  # Default: 'current_user'
9
9
  config.current_user_method = 'current_user'
10
10
 
11
- # Proc that is called when a view wants to set the page heading.
12
- # Default: nil
13
- config.heading_proc = nil
14
-
15
- # Proc that is called after any javascript runs (e.g. to clear flash notices)
16
- # Default: nil
17
- config.javascript_proc = nil
11
+ # Proc that is called after any javascript runs (e.g. to clear flash)
12
+ # It is passed the 'self' object 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
+ # Should return a string containing JS to be appended to all Commontator JS responses
15
+ # Default: lambda { |view| '$("#error_explanation").remove();' }
16
+ config.javascript_proc = lambda { |view| '$("#error_explanation").remove();' }
18
17
 
19
18
 
20
19
  # Commontator (User model) Configuration
@@ -57,14 +56,20 @@ Commontator.configure do |config|
57
56
  # as an argument to acts_as_commontable in each one
58
57
  # Default: 'commontable'
59
58
  config.commontable_name = 'commontable'
59
+
60
+ # Proc that returns the commontable url that contains the thread
61
+ # (defaults to the commontable show url)
62
+ # Main application's routes can be accessed using main_app object
63
+ # Default: lambda { |main_app, commontable| main_app.polymorphic_url(commontable) }
64
+ config.commontable_url_proc = lambda { |main_app, commontable| main_app.polymorphic_url(commontable) }
60
65
 
61
66
  # Proc that returns the subscription email subject
62
67
  # Default:
63
- # Proc.new do |params|
68
+ # lambda do |params|
64
69
  # "#{params[:commontator_name]} #{params[:config].comment_create_verb_past} a " + \
65
70
  # "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}"
66
71
  # end
67
- config.subscription_email_subject_proc = Proc.new do |params|
72
+ config.subscription_email_subject_proc = lambda do |params|
68
73
  "#{params[:commontator_name]} #{params[:config].comment_create_verb_past} a " + \
69
74
  "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}"
70
75
  end
@@ -128,8 +133,9 @@ Commontator.configure do |config|
128
133
  config.commontable_id_method = 'id'
129
134
 
130
135
  # Method called on commontable and passed user as argument
131
- # If true, that user is an admin for that particular commontable's thread
132
- # Default: '' (no thread-specific admins)
136
+ # If true, that user is a moderator for that particular commontable's thread
137
+ # and is given admin-like capabilities for that thread only
138
+ # Default: '' (no thread-specific moderators)
133
139
  config.can_edit_thread_method = ''
134
140
 
135
141
  # Method called on commontable and passed user as argument