Change moderation labels

This commit is contained in:
Christopher Pitt 2015-04-16 14:40:16 +12:00
parent 1410702fce
commit 086dd03b5c
5 changed files with 27 additions and 27 deletions

View File

@ -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,

View File

@ -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.'
);
}
}

View File

@ -4,7 +4,7 @@
* @package comments
*/
class CommentsGridFieldBulkAction extends GridFieldBulkActionHandler {
}
/**
@ -13,22 +13,22 @@ class CommentsGridFieldBulkAction extends GridFieldBulkActionHandler {
* @package comments
*/
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) {
foreach($this->getRecords() as $record) {
array_push($ids, $record->ID);
$record->Moderated = 1;
@ -43,11 +43,11 @@ class CommentsGridFieldBulkAction_Handlers extends CommentsGridFieldBulkAction {
$response->addHeader('Content-Type', 'text/json');
return $response;
return $response;
}
public function markAsNotSpam(SS_HTTPRequest $request) {
public function approve(SS_HTTPRequest $request) {
$ids = array();
foreach($this->getRecords() as $record) {

View File

@ -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',

View File

@ -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,