config/initializers/commontator.rb in commontator-0.5.14 vs config/initializers/commontator.rb in commontator-1.0.0

- old
+ new

@@ -2,11 +2,11 @@ # All settings are initially set to their default values Commontator.configure do |config| # Engine Configuration - # Method called on ApplicationController to return the current user + # Name of the ApplicationController helper method that returns the current user # Default: 'current_user' config.current_user_method = 'current_user' # Proc that is called after any javascript runs (e.g. to clear flash) # It is passed the 'self' object from the view template, so you should be able to @@ -23,23 +23,29 @@ config.user_missing_name = 'Anonymous' # Whether the user's name is clickable in the comment view # Default: false config.user_name_clickable = false + + # Whether automated emails are sent to the user whenever + # a comment is posted on a thread they subscribe to + # Default: true + config.subscription_emails = true # The method that returns the user's email address # Default: 'email' config.user_email_method = 'email' # The method that returns the user's name # Default: '' (use user_missing_name) config.user_name_method = '' - # Method that returns true if the user is an admin for all threads + # Proc called with user as argument that returns true if the user is an admin # Admins can always delete other users' comments and close threads - # Default: '' (no admins) - config.is_admin_method = '' + # Note: user can be nil + # Default: lambda { |user| false } (no admins) + config.user_admin_proc = lambda { |user| false } # Commontable (acts_as_commontable) Configuration # What a comment is called in your application @@ -58,28 +64,11 @@ # If you have multiple commontable models, # you might want to pass this configuration value # as an argument to acts_as_commontable in each one # Default: 'commontable' config.commontable_name = 'commontable' - - # Proc that returns the commontable url that contains the thread - # (defaults to the commontable show url) - # Main application's routes can be accessed using main_app object - # Default: lambda { |main_app, commontable| main_app.polymorphic_url(commontable) } - config.commontable_url_proc = lambda { |main_app, commontable| main_app.polymorphic_url(commontable) } - # Proc that returns the subscription email subject - # Default: - # lambda do |params| - # "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \ - # "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}" - # end - config.subscription_email_subject_proc = lambda do |params| - "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \ - "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}" - end - # The format of the timestamps used by Commontator # Default: '%b %d %Y, %I:%M %p' config.timestamp_format = '%b %d %Y, %I:%M %p' # Whether admins can edit other users' comments @@ -98,12 +87,12 @@ # after someone posted a newer comment # Default: false config.can_edit_old_comments = false # Whether users can delete their own comments - # Default: false - config.can_delete_own_comments = false + # Default: true + config.can_delete_own_comments = true # Whether users can delete their own comments # after someone posted a newer comment # Default: false config.can_delete_old_comments = false @@ -114,11 +103,11 @@ # Whether users can vote on other users' comments # Note: requires acts_as_votable gem installed # and configured for your application # Default: false - config.comments_can_be_voted_on = false + config.can_vote_on_comments = false # Whether comments should be ordered by vote score # instead of by order posted # Default: false config.comments_ordered_by_votes = false @@ -130,50 +119,39 @@ # Whether comments deleted by admins can be seen # (the content will still be hidden) # Default: true config.deleted_comments_are_visible = true - # Method called on commontable to return its id + # The method which returns the commontable's id that is sent to users in email messages # Default: 'id' config.commontable_id_method = 'id' - # Method called on commontable and passed user as argument - # If true, that user is a moderator for that particular commontable's thread + # Proc called with thread and user as arguments + # If it returns true, that user is a moderator for that particular thread # and is given admin-like capabilities for that thread only - # Default: '' (no thread-specific moderators) - config.can_edit_thread_method = '' + # Note: user can be nil + # Default: lambda { |thread, user| false } (no thread-specific moderators) + config.can_edit_thread_proc = lambda { |thread, user| false } - # Method called on commontable and passed user as argument - # If true, that user is allowed to read that commontable's thread - # Default: '' (no read restrictions) - config.can_read_thread_method = '' + # Proc called with thread and user as arguments + # If it returns true, that user is allowed to read that thread + # Note: user can be nil + # Default: lambda { |thread, user| true } (no read restrictions) + config.can_read_thread_proc = lambda { |thread, user| true } - # Method called on commontable when a comment is created - # Passed user, comment as arguments - # Default: '' (no callback) - config.comment_created_callback = '' + # Proc that returns the commontable url that contains the thread + # (defaults to the commontable show url) + # Main application's routes can be accessed using main_app object + # Default: lambda { |main_app, commontable| main_app.polymorphic_url(commontable) } + config.commontable_url_proc = lambda { |main_app, commontable| main_app.polymorphic_url(commontable) } - # Method called on commontable when a comment is edited - # Passed user, comment as arguments - # Default: '' (no callback) - config.comment_edited_callback = '' - - # Method called on commontable when a comment is deleted - # Passed user, comment as arguments - # Default: '' (no callback) - config.comment_deleted_callback = '' - - # Method called on commontable when a thread is closed - # Passed user as argument - # Default: '' (no callback) - config.thread_closed_callback = '' - - # Method called on commontable when a thread is subscribed to - # Passed user as argument - # Default: '' (no callback) - config.subscribe_callback = '' - - # Method called on commontable when a thread is unsubscribed to - # Passed user as argument - # Default: '' (no callback) - config.unsubscribe_callback = '' + # Proc that returns the subscription email subject string + # Default: + # lambda do |params| + # "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \ + # "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}" + # end + config.subscription_email_subject_proc = lambda do |params| + "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \ + "#{params[:config].comment_name} on #{params[:commontable_name]} ##{params[:commontable_id]}" + end end