Add official support for "nolink" columns - Fixes #1599
To make a row non-clickable, use the `clickable` option in the list column definition
This commit is contained in:
parent
4db92fa8b5
commit
04e61adac3
|
|
@ -1,3 +1,6 @@
|
|||
* **Build 31x** (2015-12-xx)
|
||||
- Added a `clickable` option to list columns (see Backend > Lists docs).
|
||||
|
||||
* **Build 310** (2015-11-28)
|
||||
- The Relation form widget now supports custom SQL with the `select` options, also `nameFrom` supports taking values from model attributes (see Backend > Forms docs).
|
||||
- Added Refresh buttons to the back-end logging pages.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ class ListColumn
|
|||
*/
|
||||
public $sortable = true;
|
||||
|
||||
/**
|
||||
* @var bool If set to false, disables the default click behavior when the column is clicked.
|
||||
*/
|
||||
public $clickable = true;
|
||||
|
||||
/**
|
||||
* @var string Model attribute to use for the display value, this will
|
||||
* override any $sqlSelect definition.
|
||||
|
|
@ -133,6 +138,9 @@ class ListColumn
|
|||
if (isset($config['sortable'])) {
|
||||
$this->sortable = $config['sortable'];
|
||||
}
|
||||
if (isset($config['clickable'])) {
|
||||
$this->clickable = $config['clickable'];
|
||||
}
|
||||
if (isset($config['invisible'])) {
|
||||
$this->invisible = $config['invisible'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
]) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php $index = 0; foreach ($columns as $key => $column): ?>
|
||||
<?php $index = $url = 0; foreach ($columns as $key => $column): ?>
|
||||
<?php $index++; ?>
|
||||
<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))): ?>
|
||||
<td data-title="<?= e(trans($column->label)) ?>" class="list-cell-index-<?= $index ?> list-cell-name-<?= $column->getName() ?> list-cell-type-<?= $column->type ?> <?= $column->clickable ? '' : 'nolink' ?> <?= $column->cssClass ?>">
|
||||
<?php if ($column->clickable && !$url && ($url = $this->getRecordUrl($record))): ?>
|
||||
<a <?= $this->getRecordOnClick($record) ?> href="<?= $url ?>">
|
||||
<?= $this->getColumnValue($record, $column) ?>
|
||||
</a>
|
||||
|
|
|
|||
Loading…
Reference in New Issue