Merge pull request #139 from tractorcow/pulls/fix-dupe-state

BUG Fix each gridfield having triple gridstate components
This commit is contained in:
Christopher Pitt 2015-11-17 12:55:23 +13:00
commit 4d538f565c
2 changed files with 6 additions and 10 deletions

View File

@ -46,15 +46,13 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
return Security::permissionFailure($this);
}
$commentsConfig = CommentsGridFieldConfig::create();
$newComments = Comment::get()->filter('Moderated', 0);
$newGrid = new CommentsGridField(
'NewComments',
_t('CommentsAdmin.NewComments', 'New'),
$newComments,
$commentsConfig
CommentsGridFieldConfig::create()
);
$approvedComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 0);
@ -63,7 +61,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
'ApprovedComments',
_t('CommentsAdmin.ApprovedComments', 'Approved'),
$approvedComments,
$commentsConfig
CommentsGridFieldConfig::create()
);
$spamComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 1);
@ -72,7 +70,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
'SpamComments',
_t('CommentsAdmin.SpamComments', 'Spam'),
$spamComments,
$commentsConfig
CommentsGridFieldConfig::create()
);
$newCount = '(' . count($newComments) . ')';

View File

@ -495,15 +495,13 @@ class CommentsExtension extends DataExtension {
protected function updateModerationFields(FieldList $fields) {
Requirements::css(COMMENTS_DIR . '/css/cms.css');
$commentsConfig = CommentsGridFieldConfig::create();
$newComments = $this->owner->AllComments()->filter('Moderated', 0);
$newGrid = new CommentsGridField(
'NewComments',
_t('CommentsAdmin.NewComments', 'New'),
$newComments,
$commentsConfig
CommentsGridFieldConfig::create()
);
$approvedComments = $this->owner->AllComments()->filter('Moderated', 1)->filter('IsSpam', 0);
@ -512,7 +510,7 @@ class CommentsExtension extends DataExtension {
'ApprovedComments',
_t('CommentsAdmin.Comments', 'Approved'),
$approvedComments,
$commentsConfig
CommentsGridFieldConfig::create()
);
$spamComments = $this->owner->AllComments()->filter('Moderated', 1)->filter('IsSpam', 1);
@ -521,7 +519,7 @@ class CommentsExtension extends DataExtension {
'SpamComments',
_t('CommentsAdmin.SpamComments', 'Spam'),
$spamComments,
$commentsConfig
CommentsGridFieldConfig::create()
);
$newCount = '(' . count($newComments) . ')';