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
|
<?php
|
||||||
|
|
||||||
class CommentsGridField extends GridField
|
class CommentsGridField extends GridField {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function newRow($gridfield, $total, $index, $record, $attributes, $content) {
|
protected function newRow($total, $index, $record, $attributes, $content) {
|
||||||
$classes = array('ss-gridfield-item');
|
if(!isset($attributes['class'])) {
|
||||||
|
$attributes['class'] = '';
|
||||||
if($index == 0) {
|
|
||||||
$classes[] = 'first';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($index == $total - 1) {
|
|
||||||
$classes[] = 'last';
|
|
||||||
}
|
|
||||||
|
|
||||||
$classes[] = ($index % 2) ? 'even' : 'odd';
|
|
||||||
|
|
||||||
if($record->IsSpam) {
|
if($record->IsSpam) {
|
||||||
$classes[] = 'spam';
|
$attributes['class'] .= ' spam';
|
||||||
}
|
}
|
||||||
|
|
||||||
$attributes = array(
|
|
||||||
'class' => implode(' ', $classes),
|
|
||||||
'data-id' => $record->ID,
|
|
||||||
'data-class' => $record->ClassName,
|
|
||||||
);
|
|
||||||
|
|
||||||
return FormField::create_tag(
|
return FormField::create_tag(
|
||||||
'tr',
|
'tr',
|
||||||
$attributes,
|
$attributes,
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
.cms table.ss-gridfield-table tr.spam {
|
.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