diff --git a/lang/en.yml b/lang/en.yml index 6bcefcb..d7e3f21 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -44,13 +44,13 @@ en: DELETEALLCOMMENTS: 'Delete all comments on this page' SilverStripe\Comments\Admin\CommentAdmin: ADMIN_PERMISSION: 'Access to ''Comments'' section' - ApprovedComments: Approved + ApprovedComments: Approved ({count}) Comments: Approved MENUTITLE: Comments Moderated: Moderated NeedsModeration: 'Needs Moderation' - NewComments: New - SpamComments: Spam + NewComments: New ({count}) + SpamComments: Spam ({count}) SilverStripe\Comments\Admin\CommentsGridFieldAction: APPROVE: Approve COMMENTAPPROVED: 'Comment approved.' diff --git a/src/Admin/CommentAdmin.php b/src/Admin/CommentAdmin.php index acc7729..2cb4a8e 100644 --- a/src/Admin/CommentAdmin.php +++ b/src/Admin/CommentAdmin.php @@ -45,7 +45,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider { return array( "CMS_ACCESS_CommentAdmin" => array( - 'name' => _t('SilverStripe\\Comments\\Admin\\CommentAdmin.ADMIN_PERMISSION', "Access to 'Comments' section"), + 'name' => _t(__CLASS__ . '.ADMIN_PERMISSION', "Access to 'Comments' section"), 'category' => _t('SilverStripe\\Security\\Permission.CMS_ACCESS_CATEGORY', 'CMS Access') ) ); @@ -94,34 +94,42 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider CommentsGridFieldConfig::create() ); - $newCount = '(' . count($newComments) . ')'; - $approvedCount = '(' . count($approvedComments) . ')'; - $spamCount = '(' . count($spamComments) . ')'; - - $fields = new FieldList( - $root = new TabSet( - 'Comments', - new Tab( + $fields = FieldList::create( + $root = TabSet::create( + 'Root', + Tab::create( 'NewComments', - _t(__CLASS__.'.NewComments', 'New') . ' ' . $newCount, + _t( + __CLASS__.'.NewComments', + 'New ({count})', + ['count' => count($newComments)] + ), $newGrid ), - new Tab( + Tab::create( 'ApprovedComments', - _t(__CLASS__.'.ApprovedComments', 'Approved') . ' ' . $approvedCount, + _t( + __CLASS__.'.ApprovedComments', + 'Approved ({count})', + ['count' => count($approvedComments)] + ), $approvedGrid ), - new Tab( + Tab::create( 'SpamComments', - _t(__CLASS__.'.SpamComments', 'Spam') . ' ' . $spamCount, + _t( + __CLASS__.'.SpamComments', + 'Spam ({count})', + ['count' => count($spamComments)] + ), $spamGrid ) ) ); - $actions = new FieldList(); + $actions = FieldList::create(); - $form = new Form( + $form = Form::create( $this, 'EditForm', $fields, @@ -132,7 +140,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); if ($form->Fields()->hasTabset()) { - // $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); + $form->Fields()->findOrMakeTab('Root')->setTemplate('SilverStripe\\Forms\\CMSTabSet'); $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); } diff --git a/src/Admin/CommentsGridFieldAction.php b/src/Admin/CommentsGridFieldAction.php index 2f1d59d..d602bf4 100644 --- a/src/Admin/CommentsGridFieldAction.php +++ b/src/Admin/CommentsGridFieldAction.php @@ -62,20 +62,24 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act $field .= GridField_FormAction::create( $gridField, 'CustomAction' . $record->ID . 'Spam', - _t('SilverStripe\\Comments\\Admin\\CommentsGridFieldAction.SPAM', 'Spam'), + _t(__CLASS__ . '.SPAM', 'Spam'), 'spam', array('RecordID' => $record->ID) - )->Field(); + ) + ->addExtraClass('btn btn-secondary grid-field__icon-action') + ->Field(); } if ($record->IsSpam || !$record->Moderated) { $field .= GridField_FormAction::create( $gridField, 'CustomAction' . $record->ID . 'Approve', - _t('SilverStripe\\Comments\\Admin\\CommentsGridFieldAction.APPROVE', 'Approve'), + _t(__CLASS__ . '.APPROVE', 'Approve'), 'approve', array('RecordID' => $record->ID) - )->Field(); + ) + ->addExtraClass('btn btn-secondary grid-field__icon-action') + ->Field(); } return $field; @@ -101,7 +105,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act // output a success message to the user Controller::curr()->getResponse()->setStatusCode( 200, - _t('SilverStripe\\Comments\\Admin\\CommentsGridFieldAction.COMMENTMARKEDSPAM', 'Comment marked as spam.') + _t(__CLASS__ . '.COMMENTMARKEDSPAM', 'Comment marked as spam.') ); } @@ -112,7 +116,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act // output a success message to the user Controller::curr()->getResponse()->setStatusCode( 200, - _t('SilverStripe\\Comments\\Admin\\CommentsGridFieldAction.COMMENTAPPROVED', 'Comment approved.') + _t(__CLASS__ . '.COMMENTAPPROVED', 'Comment approved.') ); } }