jQuery.fn.evolutionModerate
This plugin implements a control which enables a user to report a piece of content as abusive via a drop-down menu which displays when hovered over. When reported, a notification is displayed to the reporting user. It also supports displaying other actions alongside abuse reporting. Raises and responds to ui.reportabuse messages. It is typically not invoked directly, but rather by the moderate UI component.
Usage
Initializes the moderation plugin where SELECTOR
is a <span>
.
$('SELECTOR').evolutionModerate(options)
Options
contentId
: (string) Content IdcontentTypeId
: (string) Content Type IdinitialState
: (boolean) Currently reported by the accessing userlinkClassName
: (string) CSS class to apply to the link-
onReport
: function which implements abuse reporting. Passed parameters:contentId
: Content Id being reportedcontentTypeId
: Content Type Id being reportedcomplete
: Callback to invoke when reporting has completed.
-
onGetAdditionalLinks
: function which, when invoked, can asynchronously provide additional links to display alongside abuse reporting within the same menu. Passed parameters:complete
: Callback to invoke to pass an array of link objects back to the plugin. Each object should contain keys defining the link'shref
andtext
, and optionally theclassName
.
-
notificationDuration
: (number) milliseconds to display notification after reporting abuse.- default:
5000
- default:
-
supportsAbuse
: (boolean) whether the content supports abuse and should embed abuse reporting within its menu- default:
true
- default:
-
reportLinkText
: (string) menu label to display when content is not reported. Evolution sets this automatically, localized.- default:
'Report as abusive'
- default:
-
reportedLinkText
: (string) menu label to display when content has already been reported. Evolution sets this automatically, localized.- default:
'Reported as abusive'
- default:
-
reportedNotificationMessageText
: (string) message to display in the notification after reporting. Evolution sets this automatically, localized.- default:
'{NAME}'s post has been reported. <strong>Thank you for your feedback.</strong>'
- default:
-
moderationLinkTemplate
: (string) Template to use when rendering a moderation link. Evolution sets this automatically.- default:
'<a href="#" class="<%: linkClassName %>"><span></span><%= resources.moderateLinkText %></a>'
- default:
-
notificationTemplate
: (string) Template to use when rendering a notification of reporting back to the reporting user. Evolution sets this automatically.- default:
'<p><%= resources.reportedNotificationMessageText %></p>'
- default:
moderationMenuTemplate
: (string) Template to use when rendering a moderation menu. Evolution sets this automatically.
Default:
<ul class="navigation-list">
<% foreach(links, function(link){ %>
<li class="navigation-item">
<a href="<%: (link.href || "#") %>" class="<%: (link.className || "") %>"><%= link.text %></a>
</li>
<% }); %>
</ul>