List Column of type switch now has text-center CSS

List Column now have getName and getId accessors
This commit is contained in:
Samuel Georges 2015-03-25 19:35:00 +11:00
parent 15a016a338
commit a743d78658
6 changed files with 40 additions and 3 deletions

View File

@ -181,6 +181,7 @@ table.table.data tbody td.column-slim{padding-left:0;padding-right:0}
table.table.data tbody td.column-compact{padding:0}
table.table.data tfoot a{color:#666666;text-decoration:none}
table.table.data tfoot td,table.table.data tfoot th{border-color:#e2e2e2;padding:10px 15px}
table.table.data th.list-cell-type-switch,table.table.data td.list-cell-type-switch{text-align:center}
table.table.data .list-checkbox{padding-left:16px;padding-right:8px;width:52px;vertical-align:top;border-right:1px solid #eeeeee}
table.table.data .list-checkbox .checkbox{margin:0}
table.table.data .list-checkbox .custom-checkbox{position:relative;top:5px;left:-2px}

View File

@ -256,6 +256,11 @@ table.table.data {
}
}
th.list-cell-type-switch,
td.list-cell-type-switch {
text-align: center;
}
.list-checkbox {
padding-left: 16px;
padding-right: 8px;

View File

@ -487,6 +487,8 @@ class FormField
/**
* Returns a value suitable for the field id property.
* @param string $suffix Specify a suffix string
* @return string
*/
public function getId($suffix = null)
{

View File

@ -1,5 +1,7 @@
<?php namespace Backend\Classes;
use October\Rain\Html\Helper as HtmlHelper;
/**
* List Columns definition
* A translation of the list column configuration
@ -147,4 +149,31 @@ class ListColumn
return $config;
}
/**
* Returns a HTML valid name for the column name.
* @return string
*/
public function getName()
{
return HtmlHelper::nameToId($this->columnName);
}
/**
* Returns a value suitable for the column id property.
* @param string $suffix Specify a suffix string
* @return string
*/
public function getId($suffix = null)
{
$id = 'column';
$id .= '-'.$this->columnName;
if ($suffix) {
$id .= '-'.$suffix;
}
return HtmlHelper::nameToId($id);
}
}

View File

@ -19,7 +19,7 @@
<?php $index = 0; foreach ($columns as $key => $column): ?>
<?php $index++; ?>
<td data-title="<?= e(trans($column->label)) ?>" class="list-cell-index-<?= $index ?> list-cell-name-<?= $column->columnName ?> list-cell-type-<?= $column->type ?> <?= $column->cssClass ?>">
<td data-title="<?= e(trans($column->label)) ?>" class="list-cell-index-<?= $index ?> list-cell-name-<?= $column->getName() ?> list-cell-type-<?= $column->type ?> <?= $column->cssClass ?>">
<?php if ($index == 1 && ($url = $this->getRecordUrl($record))): ?>
<a <?= $this->getRecordOnClick($record) ?> href="<?= $url ?>">
<?= $this->getColumnValue($record, $column) ?>

View File

@ -18,7 +18,7 @@
<?php if ($showSorting && $column->sortable): ?>
<th
<?php if ($column->width): ?>style="width: <?= $column->width ?>"<?php endif ?>
class="<?= $this->sortColumn==$column->columnName?'sort-'.$this->sortDirection.' active':'sort-desc' ?> list-cell-name-<?= $column->columnName ?>"
class="<?= $this->sortColumn==$column->columnName?'sort-'.$this->sortDirection.' active':'sort-desc' ?> list-cell-name-<?= $column->getName() ?> list-cell-type-<?= $column->type ?>"
>
<a
href="javascript:;"
@ -31,7 +31,7 @@
<?php else: ?>
<th
<?php if ($column->width): ?>style="width: <?= $column->width ?>"<?php endif ?>
class="list-cell-name-<?= $column->columnName ?>"
class="list-cell-name-<?= $column->getName() ?> list-cell-type-<?= $column->type ?>"
>
<span><?= $this->getHeaderValue($column) ?></span>
</th>