Merge pull request #117 from assertchris/add-spam-row-highlight

Updated for new GridField API
This commit is contained in:
Damian Mooyman 2015-04-21 11:47:10 +12:00
commit a0974dd399
2 changed files with 11 additions and 22 deletions

View File

@ -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,

View File

@ -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;
}