add search bar, fix col widths, show ref field as links

pull/7357/head
Luciano Righetti 2021-04-21 15:11:26 +02:00
parent 137983abbd
commit 99cd8d8b61
5 changed files with 29 additions and 3 deletions

View File

@ -16,6 +16,7 @@ class NoticelistsController extends AppController
public function index()
{
$this->CRUD->index([
'quickFilters' => ['name', 'expanded_name'],
'afterFind' => function (array $noticelists) {
foreach ($noticelists as &$noticelist) {
$noticelist['Noticelist']['ref'] = json_decode($noticelist['Noticelist']['ref']);

View File

@ -0,0 +1,13 @@
<?php
$links = Hash::extract($data, $field['path']);
foreach ($links as &$link) {
$link = sprintf(
'<a href="%s">%s</a>',
h($link),
$link
);
}
echo implode('<br />', $links);

View File

@ -18,7 +18,7 @@ $fields = [
[
'name' => __('ref'),
'data_path' => 'Noticelist.ref',
'element' => 'list'
'element' => 'links'
],
[
'name' => __('geographical_area'),
@ -51,6 +51,17 @@ echo $this->element('genericElements/IndexTable/scaffold', [
'scaffold_data' => [
'data' => [
'data' => $data,
'top_bar' => [
'pull' => 'right',
'children' => [
[
'type' => 'search',
'button' => __('Filter'),
'placeholder' => __('Enter value to search'),
'searchKey' => 'quickFilter',
]
]
],
'fields' => $fields,
'title' => empty($ajax) ? __('Noticelists') : false,
'actions' => [

View File

@ -3,12 +3,12 @@ $fields = [
[
'name' => __('Scope'),
'data_path' => 'data.scope',
'class' => 'shortish'
'class' => 'short'
],
[
'name' => __('Field'),
'data_path' => 'data.field',
'class' => 'shortish'
'class' => 'short'
],
[
'name' => __('Value'),

View File

@ -24,6 +24,7 @@ echo $this->element(
[
'key' => __('Ref'),
'path' => 'Noticelist.ref',
'type' => 'links',
],
[
'key' => __('Geographical Area'),