From a743d786580dfff82ef7eb9a04ad8d8cbcd316ed Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Wed, 25 Mar 2015 19:35:00 +1100 Subject: [PATCH] List Column of type switch now has text-center CSS List Column now have getName and getId accessors --- modules/backend/assets/css/controls.css | 1 + .../backend/assets/less/controls/lists.less | 5 ++++ modules/backend/classes/FormField.php | 2 ++ modules/backend/classes/ListColumn.php | 29 +++++++++++++++++++ .../widgets/lists/partials/_list_body_row.htm | 2 +- .../widgets/lists/partials/_list_head_row.htm | 4 +-- 6 files changed, 40 insertions(+), 3 deletions(-) diff --git a/modules/backend/assets/css/controls.css b/modules/backend/assets/css/controls.css index fb80373c0..ea48e48df 100644 --- a/modules/backend/assets/css/controls.css +++ b/modules/backend/assets/css/controls.css @@ -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} diff --git a/modules/backend/assets/less/controls/lists.less b/modules/backend/assets/less/controls/lists.less index cdab8fe12..be6b83f91 100644 --- a/modules/backend/assets/less/controls/lists.less +++ b/modules/backend/assets/less/controls/lists.less @@ -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; diff --git a/modules/backend/classes/FormField.php b/modules/backend/classes/FormField.php index 2a9a2ec06..1c198fcb6 100644 --- a/modules/backend/classes/FormField.php +++ b/modules/backend/classes/FormField.php @@ -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) { diff --git a/modules/backend/classes/ListColumn.php b/modules/backend/classes/ListColumn.php index c85cb5862..e352ef35b 100644 --- a/modules/backend/classes/ListColumn.php +++ b/modules/backend/classes/ListColumn.php @@ -1,5 +1,7 @@ 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); + } } diff --git a/modules/backend/widgets/lists/partials/_list_body_row.htm b/modules/backend/widgets/lists/partials/_list_body_row.htm index 4c0525b28..e7cabcde2 100644 --- a/modules/backend/widgets/lists/partials/_list_body_row.htm +++ b/modules/backend/widgets/lists/partials/_list_body_row.htm @@ -19,7 +19,7 @@ $column): ?> - + getRecordUrl($record))): ?> getRecordOnClick($record) ?> href=""> getColumnValue($record, $column) ?> diff --git a/modules/backend/widgets/lists/partials/_list_head_row.htm b/modules/backend/widgets/lists/partials/_list_head_row.htm index d1385f062..45f93d1c5 100644 --- a/modules/backend/widgets/lists/partials/_list_head_row.htm +++ b/modules/backend/widgets/lists/partials/_list_head_row.htm @@ -18,7 +18,7 @@ sortable): ?> width): ?>style="width: width ?>" - class="sortColumn==$column->columnName?'sort-'.$this->sortDirection.' active':'sort-desc' ?> list-cell-name-columnName ?>" + class="sortColumn==$column->columnName?'sort-'.$this->sortDirection.' active':'sort-desc' ?> list-cell-name-getName() ?> list-cell-type-type ?>" > width): ?>style="width: width ?>" - class="list-cell-name-columnName ?>" + class="list-cell-name-getName() ?> list-cell-type-type ?>" > getHeaderValue($column) ?>