mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
Merge pull request #112 from assertchris/change-moderation-labels
Change moderation labels
This commit is contained in:
commit
26361cccba
@ -52,7 +52,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
||||
|
||||
$newGrid = new GridField(
|
||||
'NewComments',
|
||||
_t('CommentsAdmin.NewComments', 'Unmoderated'),
|
||||
_t('CommentsAdmin.NewComments', 'New'),
|
||||
$newComments,
|
||||
$commentsConfig
|
||||
);
|
||||
@ -61,7 +61,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
||||
|
||||
$approvedGrid = new GridField(
|
||||
'ApprovedComments',
|
||||
_t('CommentsAdmin.ApprovedComments', 'Displayed'),
|
||||
_t('CommentsAdmin.ApprovedComments', 'Approved'),
|
||||
$approvedComments,
|
||||
$commentsConfig
|
||||
);
|
||||
@ -82,10 +82,10 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
||||
$fields = new FieldList(
|
||||
$root = new TabSet(
|
||||
'Root',
|
||||
new Tab('NewComments', _t('CommentAdmin.NewComments', 'Unmoderated') . ' ' . $newCount,
|
||||
new Tab('NewComments', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount,
|
||||
$newGrid
|
||||
),
|
||||
new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Displayed') . ' ' . $approvedCount,
|
||||
new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount,
|
||||
$approvedGrid
|
||||
),
|
||||
new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount,
|
||||
|
@ -44,7 +44,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
||||
$field .= GridField_FormAction::create(
|
||||
$gridField,
|
||||
'CustomAction' . $record->ID,
|
||||
'Mark As Spam',
|
||||
'Spam',
|
||||
'spam',
|
||||
array('RecordID' => $record->ID)
|
||||
)->Field();
|
||||
@ -52,8 +52,8 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
||||
$field .= GridField_FormAction::create(
|
||||
$gridField,
|
||||
'CustomAction' . $record->ID,
|
||||
'Mark As Not Spam',
|
||||
'not_spam',
|
||||
'Approve',
|
||||
'approve',
|
||||
array('RecordID' => $record->ID)
|
||||
)->Field();
|
||||
|
||||
@ -64,7 +64,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getActions($gridField) {
|
||||
return array('spam', 'not_spam');
|
||||
return array('spam', 'approve');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,7 +85,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
||||
);
|
||||
}
|
||||
|
||||
if($actionName == 'not_spam') {
|
||||
if($actionName == 'approve') {
|
||||
$comment = Comment::get()->byID($arguments["RecordID"]);
|
||||
|
||||
$comment->Moderated = true;
|
||||
@ -95,7 +95,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
||||
// output a success message to the user
|
||||
Controller::curr()->getResponse()->setStatusCode(
|
||||
200,
|
||||
'Comment marked as not spam.'
|
||||
'Comment approved.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,17 @@ class CommentsGridFieldBulkAction extends GridFieldBulkActionHandler {
|
||||
class CommentsGridFieldBulkAction_Handlers extends CommentsGridFieldBulkAction {
|
||||
|
||||
private static $allowed_actions = array(
|
||||
'markAsSpam',
|
||||
'markAsNotSpam',
|
||||
'spam',
|
||||
'approve',
|
||||
);
|
||||
|
||||
private static $url_handlers = array(
|
||||
'markAsSpam' => 'markAsSpam',
|
||||
'markAsNotSpam' => 'markAsNotSpam',
|
||||
'spam' => 'spam',
|
||||
'approve' => 'approve',
|
||||
);
|
||||
|
||||
|
||||
public function markAsSpam(SS_HTTPRequest $request) {
|
||||
public function spam(SS_HTTPRequest $request) {
|
||||
$ids = array();
|
||||
|
||||
foreach($this->getRecords() as $record) {
|
||||
@ -47,7 +47,7 @@ class CommentsGridFieldBulkAction_Handlers extends CommentsGridFieldBulkAction {
|
||||
}
|
||||
|
||||
|
||||
public function markAsNotSpam(SS_HTTPRequest $request) {
|
||||
public function approve(SS_HTTPRequest $request) {
|
||||
$ids = array();
|
||||
|
||||
foreach($this->getRecords() as $record) {
|
||||
|
@ -24,7 +24,7 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor {
|
||||
$manager = new GridFieldBulkManager();
|
||||
|
||||
$manager->addBulkAction(
|
||||
'markAsSpam', 'Mark as spam', 'CommentsGridFieldBulkAction_Handlers',
|
||||
'spam', 'Spam', 'CommentsGridFieldBulkAction_Handlers',
|
||||
array(
|
||||
'isAjax' => true,
|
||||
'icon' => 'cross',
|
||||
@ -33,7 +33,7 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor {
|
||||
);
|
||||
|
||||
$manager->addBulkAction(
|
||||
'markAsNotSpam', 'Mark as not spam', 'CommentsGridFieldBulkAction_Handlers',
|
||||
'approve', 'Approve', 'CommentsGridFieldBulkAction_Handlers',
|
||||
array(
|
||||
'isAjax' => true,
|
||||
'icon' => 'cross',
|
||||
|
@ -463,7 +463,7 @@ class CommentsExtension extends DataExtension {
|
||||
|
||||
$newGrid = new GridField(
|
||||
'NewComments',
|
||||
_t('CommentsAdmin.NewComments', 'Unmoderated'),
|
||||
_t('CommentsAdmin.NewComments', 'New'),
|
||||
$newComments,
|
||||
$commentsConfig
|
||||
);
|
||||
@ -472,7 +472,7 @@ class CommentsExtension extends DataExtension {
|
||||
|
||||
$approvedGrid = new GridField(
|
||||
'ApprovedComments',
|
||||
_t('CommentsAdmin.Comments', 'Displayed'),
|
||||
_t('CommentsAdmin.Comments', 'Approved'),
|
||||
$approvedComments,
|
||||
$commentsConfig
|
||||
);
|
||||
@ -493,10 +493,10 @@ class CommentsExtension extends DataExtension {
|
||||
if($fields->hasTabSet()) {
|
||||
$tabs = new TabSet(
|
||||
'Comments',
|
||||
new Tab('CommentsNewCommentsTab', _t('CommentAdmin.NewComments', 'Unmoderated') . ' ' . $newCount,
|
||||
new Tab('CommentsNewCommentsTab', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount,
|
||||
$newGrid
|
||||
),
|
||||
new Tab('CommentsCommentsTab', _t('CommentAdmin.Comments', 'Displayed') . ' ' . $approvedCount,
|
||||
new Tab('CommentsCommentsTab', _t('CommentAdmin.Comments', 'Approved') . ' ' . $approvedCount,
|
||||
$approvedGrid
|
||||
),
|
||||
new Tab('CommentsSpamCommentsTab', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount,
|
||||
|
Loading…
Reference in New Issue
Block a user