micmania1 / silverstripe-flagcomments
允许用户标记评论
2.0
2018-10-31 21:18 UTC
Requires
- silverstripe/comments: ^3.1
- silverstripe/framework: ^4.2
This package is auto-updated.
Last update: 2024-09-05 18:33:40 UTC
README
此模块扩展了评论模块的核心功能,并增加了前端用户标记评论的功能。
当评论被标记后,其他人不能再对其进行标记。
要求
- silverstripe/comments ^3.1
- silverstripe/framework ^4.0
注意:此分支与SilverStripe 4兼容。对于SilverStripe 3版本,请查看1.x版本分支。
安装
composer require nzta/silverstripe-flagcomments
配置
假设您已经根据说明将评论添加到您的页面(配置方式),那么您需要做的就是通过配置启用标记功能,并将标记添加到模板中。
SilverStripe\CMS\Model\SiteTree:
extensions:
- 'NZTA\FlagComments\Extensions\FlagCommentsExtension'
comments:
can_flag: true
将标记添加到模板中
端点期望一个ajax请求,并且只响应JSON。您需要自行处理,但要将标记添加到HTML中,您需要编辑CommentInterface_singlecomment.ss
模板。没有理由不能将其添加到其他模板中(这只是个辅助手段)。
<% if $canFlag %>
<a href="$FlagLink">Flag</a>
<% end_if %>