From 04e61adac302e9f203d5ed240290379f3e4d217d Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 5 Dec 2015 10:05:42 +1100 Subject: [PATCH] Add official support for "nolink" columns - Fixes #1599 To make a row non-clickable, use the `clickable` option in the list column definition --- CHANGELOG.md | 3 +++ modules/backend/classes/ListColumn.php | 8 ++++++++ modules/backend/widgets/lists/partials/_list_body_row.htm | 6 +++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27c4c6b53..980522b7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/modules/backend/classes/ListColumn.php b/modules/backend/classes/ListColumn.php index 0ba9761b7..0389ab891 100644 --- a/modules/backend/classes/ListColumn.php +++ b/modules/backend/classes/ListColumn.php @@ -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']; } diff --git a/modules/backend/widgets/lists/partials/_list_body_row.htm b/modules/backend/widgets/lists/partials/_list_body_row.htm index e7cabcde2..4718e1364 100644 --- a/modules/backend/widgets/lists/partials/_list_body_row.htm +++ b/modules/backend/widgets/lists/partials/_list_body_row.htm @@ -17,10 +17,10 @@ ]) ?> - $column): ?> + $column): ?> - - getRecordUrl($record))): ?> + + clickable && !$url && ($url = $this->getRecordUrl($record))): ?> getRecordOnClick($record) ?> href=""> getColumnValue($record, $column) ?>