mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
Updated for new GridField API
This commit is contained in:
parent
75be840dce
commit
adabc623f6
@ -1,33 +1,18 @@
|
||||
<?php
|
||||
|
||||
class CommentsGridField extends GridField
|
||||
{
|
||||
class CommentsGridField extends GridField {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function newRow($gridfield, $total, $index, $record, $attributes, $content) {
|
||||
$classes = array('ss-gridfield-item');
|
||||
|
||||
if($index == 0) {
|
||||
$classes[] = 'first';
|
||||
protected function newRow($total, $index, $record, $attributes, $content) {
|
||||
if(!isset($attributes['class'])) {
|
||||
$attributes['class'] = '';
|
||||
}
|
||||
|
||||
if($index == $total - 1) {
|
||||
$classes[] = 'last';
|
||||
if($record->IsSpam) {
|
||||
$attributes['class'] .= ' spam';
|
||||
}
|
||||
|
||||
$classes[] = ($index % 2) ? 'even' : 'odd';
|
||||
|
||||
if ($record->IsSpam) {
|
||||
$classes[] = 'spam';
|
||||
}
|
||||
|
||||
$attributes = array(
|
||||
'class' => implode(' ', $classes),
|
||||
'data-id' => $record->ID,
|
||||
'data-class' => $record->ClassName,
|
||||
);
|
||||
|
||||
return FormField::create_tag(
|
||||
'tr',
|
||||
$attributes,
|
||||
|
@ -1,3 +1,7 @@
|
||||
.cms table.ss-gridfield-table tr.spam {
|
||||
background-color: #FFD8D8 ;
|
||||
background-color: #FFD8D8;
|
||||
}
|
||||
|
||||
.cms table.ss-gridfield-table tr.spam:hover {
|
||||
background-color: #FFF2F2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user