config/initializers/commontator.rb in commontator-4.2.2 vs config/initializers/commontator.rb in commontator-4.3.0

- old
+ new

@@ -7,78 +7,71 @@ # Returns the current user # Default: lambda { |controller| controller.current_user } config.current_user_proc = lambda { |controller| controller.current_user } # Proc called with the view_context object as argument - # Returns a string to be appended to all JavaScript responses from commontator + # Returns a string to be appended to all JavaScript responses from Commontator # Can be used, for example, to display/clear Rails error messages # Objects visible in view templates can be accessed through # the view_context object (for example, view_context.flash) # However, the view_context does not include the main application's helpers # Default: lambda { |view_context| '$("#error_explanation").remove();' } config.javascript_proc = lambda { |view_context| '$("#error_explanation").remove();' } # User (acts_as_commontator) Configuration + # Proc called with a user as argument + # Returns the user's name + # Important: change this to return the users' display names + # Default: lambda { |user| t('commontator.anonymous') } (all users are Anonymous) + config.user_name_proc = lambda { |user| I18n.t('commontator.anonymous') } + # Whether the comment creator's name is clickable in the comment view # If enabled, the link will point to the comment creator's 'show' page # Default: false config.user_name_clickable = false - # Proc called with user as argument - # Returns the user's name - # Default: lambda { |user| 'Anonymous' } (all users are Anonymous) - config.user_name_proc = lambda { |user| 'Anonymous' } - - # Proc called with user as argument + # Proc called with a user as argument # Returns the user's email address - # Used in the subscription mailer + # Used in mailers # Default: lambda { |user| user.email } config.user_email_proc = lambda { |user| user.email } - # Proc called with user as argument - # Returns true iif the user is an admin - # Admins can delete other users' comments and close threads + # Proc called with a user as argument + # Returns true iif the user is an admin (a moderator for all threads) + # Moderators can delete other users' comments and close threads # Default: lambda { |user| false } (no admins) config.user_admin_proc = lambda { |user| false } - # Proc called with user as argument - # Returns true iif the user should receive subscription emails - # Default: lambda { |user| true } (always receive subscription emails) - config.subscription_email_enable_proc = lambda { |user| true } + # Proc called with a user and the view_context object as arguments + # Returns an HTML image tag containing the user's avatar image + # The commontator_gravatar_image_tag helper takes a user object, + # a border size, and an options hash for gravatar + # See available options at http://en.gravatar.com/site/implement/images/) + # Default: lambda { |user, view_context| view_context.commontator_gravatar_image_tag(user, 1, :s => 60, :d => 'mm') } + config.user_avatar_proc = lambda { |user, view_context| view_context.commontator_gravatar_image_tag(user, 1, :s => 60, :d => 'mm') } + + # Proc called with a user as argument + # Returns true iif emails should be sent to this user + # Currently, only the subscription email exists + # Default: lambda { |user| true } (emails can be sent to all users) + config.user_email_enable_proc = lambda { |user| true } - # Commontable (acts_as_commontable) Configuration + # Thread/Commontable (acts_as_commontable) Configuration - # What a comment is called in your application - # Default: 'comment' - config.comment_name = 'comment' + # Proc called with a mailer as argument + # Returns the address emails are sent 'from' + # Important: Change this to at least match your domain name + # Default: + # lambda { |mailer| 'no-reply@example.com' } + config.email_from_proc = lambda { |mailer| 'no-reply@example.com' } - # Verb used when creating comments (present) - # Default: 'post' - config.comment_create_verb_present = 'post' - - # Verb used when creating comments (past) - # Default: 'posted' - config.comment_create_verb_past = 'posted' - - # Verb used when editing comments (present) - # Default: 'modify' - config.comment_edit_verb_present = 'modify' - - # Verb used when editing comments (past) - # Default: 'modified' - config.comment_edit_verb_past = 'modified' - - # The format of the timestamps used by Commontator - # Default: '%b %d %Y at %I:%M %p' - config.timestamp_format = '%b %d %Y at %I:%M %p' - - # Whether admins can edit other users' comments + # Whether moderators can edit other users' comments # Default: false - config.admin_can_edit_comments = false + config.moderators_can_edit_comments = false # Whether users automatically subscribe to a thread when commenting # Default: false config.auto_subscribe_on_comment = false @@ -107,10 +100,15 @@ # Whether users can vote on other users' comments # Note: requires acts_as_votable gem installed # and configured for your application # Default: false config.can_vote_on_comments = false + + # Whether to display upvotes and downvotes separately, as two numbers, + # or together, as their difference + # Default: false (display as two numbers) + config.combine_upvotes_and_downvotes = false # What order to use for comments # Valid values: # :e (earliest comment first) # :l (latest comment first) @@ -126,59 +124,32 @@ # Whether to show that comments deleted by a moderator actually existed # (the content will be hidden either way) # Default: true config.deleted_comments_are_visible = true - # Proc called with thread and user as arguments + # Proc called with a thread and a user as arguments # Returns true iif the user should be allowed to read that thread # Note: can be called with a user object that is false or nil if not logged in # Default: lambda { |thread, user| true } (anyone can read threads even if not logged in) config.can_read_thread_proc = lambda { |thread, user| true } - # Proc called with thread and user as arguments + # Proc called with a thread and a user as arguments # Returns true iif the user is a moderator for that particular thread # and can delete users' comments in the thread or close it - # Default: lambda { |thread, user| false } (no thread-specific moderators) + # Default: lambda { |thread, user| false } + # (no thread-specific moderators, but there can still be admins) config.can_edit_thread_proc = lambda { |thread, user| false } # Proc called with the commontable object as argument # Returns the name by which the commontable object will be called in email messages # If you have multiple commontable models, you may want to pass this # configuration value as an argument to acts_as_commontable in each one # Default: lambda { |commontable| "#{commontable.class.name} ##{commontable.id}" } config.commontable_name_proc = lambda { |commontable| "#{commontable.class.name} ##{commontable.id}" } - # Proc called with main_app and commontable objects as arguments - # Return the url that contains the commontable's thread to be used in the subscription email + # Proc called with main_app and a commontable object as arguments + # Return the url that contains the commontable's thread (to be used in the subscription email) # The application's routes can be accessed using the main_app object # Default: lambda { |main_app, commontable| main_app.polymorphic_url(commontable) } # (defaults to the commontable's show url) config.commontable_url_proc = lambda { |main_app, commontable| main_app.polymorphic_url(commontable) } - - # Proc called with params from the subscription mailer as arguments - # Returns the subscription email 'to' addresses - # Available params can be seen in the subscription mailer - # Note that the actual addresses are already set in the BCC field - # Default: - # lambda { |params| 'Undisclosed Recipients' } - config.subscription_email_to_proc = lambda { |params| 'Undisclosed Recipients' } - - # Proc called with params from the subscription mailer as arguments - # Returns the subscription email 'from' address - # Available params can be seen in the subscription mailer - # Default: - # lambda { |params| 'no-reply@example.com' } - config.subscription_email_from_proc = lambda { |params| 'no-reply@example.com' } - - # Proc called with params from the subscription mailer as arguments - # Returns the subscription email 'subject' string - # Available params can be seen in the subscription mailer - # Default: - # lambda do |params| - # "#{params[:creator_name]} #{params[:config].comment_create_verb_past} a " + \ - # "#{params[:config].comment_name} on #{params[:commontable_name]}" - # 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]}" - end end