mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
BUG Fix each gridfield having triple gridstate components
This commit is contained in:
parent
ac92dbb515
commit
e26e4d916b
@ -46,15 +46,13 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
return Security::permissionFailure($this);
|
return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$commentsConfig = CommentsGridFieldConfig::create();
|
|
||||||
|
|
||||||
$newComments = Comment::get()->filter('Moderated', 0);
|
$newComments = Comment::get()->filter('Moderated', 0);
|
||||||
|
|
||||||
$newGrid = new CommentsGridField(
|
$newGrid = new CommentsGridField(
|
||||||
'NewComments',
|
'NewComments',
|
||||||
_t('CommentsAdmin.NewComments', 'New'),
|
_t('CommentsAdmin.NewComments', 'New'),
|
||||||
$newComments,
|
$newComments,
|
||||||
$commentsConfig
|
CommentsGridFieldConfig::create()
|
||||||
);
|
);
|
||||||
|
|
||||||
$approvedComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 0);
|
$approvedComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 0);
|
||||||
@ -63,7 +61,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
'ApprovedComments',
|
'ApprovedComments',
|
||||||
_t('CommentsAdmin.ApprovedComments', 'Approved'),
|
_t('CommentsAdmin.ApprovedComments', 'Approved'),
|
||||||
$approvedComments,
|
$approvedComments,
|
||||||
$commentsConfig
|
CommentsGridFieldConfig::create()
|
||||||
);
|
);
|
||||||
|
|
||||||
$spamComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 1);
|
$spamComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 1);
|
||||||
@ -72,7 +70,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
'SpamComments',
|
'SpamComments',
|
||||||
_t('CommentsAdmin.SpamComments', 'Spam'),
|
_t('CommentsAdmin.SpamComments', 'Spam'),
|
||||||
$spamComments,
|
$spamComments,
|
||||||
$commentsConfig
|
CommentsGridFieldConfig::create()
|
||||||
);
|
);
|
||||||
|
|
||||||
$newCount = '(' . count($newComments) . ')';
|
$newCount = '(' . count($newComments) . ')';
|
||||||
|
@ -495,15 +495,13 @@ class CommentsExtension extends DataExtension {
|
|||||||
protected function updateModerationFields(FieldList $fields) {
|
protected function updateModerationFields(FieldList $fields) {
|
||||||
Requirements::css(COMMENTS_DIR . '/css/cms.css');
|
Requirements::css(COMMENTS_DIR . '/css/cms.css');
|
||||||
|
|
||||||
$commentsConfig = CommentsGridFieldConfig::create();
|
|
||||||
|
|
||||||
$newComments = $this->owner->AllComments()->filter('Moderated', 0);
|
$newComments = $this->owner->AllComments()->filter('Moderated', 0);
|
||||||
|
|
||||||
$newGrid = new CommentsGridField(
|
$newGrid = new CommentsGridField(
|
||||||
'NewComments',
|
'NewComments',
|
||||||
_t('CommentsAdmin.NewComments', 'New'),
|
_t('CommentsAdmin.NewComments', 'New'),
|
||||||
$newComments,
|
$newComments,
|
||||||
$commentsConfig
|
CommentsGridFieldConfig::create()
|
||||||
);
|
);
|
||||||
|
|
||||||
$approvedComments = $this->owner->AllComments()->filter('Moderated', 1)->filter('IsSpam', 0);
|
$approvedComments = $this->owner->AllComments()->filter('Moderated', 1)->filter('IsSpam', 0);
|
||||||
@ -512,7 +510,7 @@ class CommentsExtension extends DataExtension {
|
|||||||
'ApprovedComments',
|
'ApprovedComments',
|
||||||
_t('CommentsAdmin.Comments', 'Approved'),
|
_t('CommentsAdmin.Comments', 'Approved'),
|
||||||
$approvedComments,
|
$approvedComments,
|
||||||
$commentsConfig
|
CommentsGridFieldConfig::create()
|
||||||
);
|
);
|
||||||
|
|
||||||
$spamComments = $this->owner->AllComments()->filter('Moderated', 1)->filter('IsSpam', 1);
|
$spamComments = $this->owner->AllComments()->filter('Moderated', 1)->filter('IsSpam', 1);
|
||||||
@ -521,7 +519,7 @@ class CommentsExtension extends DataExtension {
|
|||||||
'SpamComments',
|
'SpamComments',
|
||||||
_t('CommentsAdmin.SpamComments', 'Spam'),
|
_t('CommentsAdmin.SpamComments', 'Spam'),
|
||||||
$spamComments,
|
$spamComments,
|
||||||
$commentsConfig
|
CommentsGridFieldConfig::create()
|
||||||
);
|
);
|
||||||
|
|
||||||
$newCount = '(' . count($newComments) . ')';
|
$newCount = '(' . count($newComments) . ')';
|
||||||
|
Loading…
Reference in New Issue
Block a user