chg: [Organisation] Moved model to use meta-field behavior instead of association
parent
0dfa87be6f
commit
6579482526
|
@ -33,14 +33,7 @@ class OrganisationsTable extends AppTable
|
||||||
'conditions' => ['owner_model' => 'organisation']
|
'conditions' => ['owner_model' => 'organisation']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$this->hasMany(
|
$this->addBehavior('MetaFields');
|
||||||
'MetaFields',
|
|
||||||
[
|
|
||||||
'dependent' => true,
|
|
||||||
'foreignKey' => 'parent_id',
|
|
||||||
'conditions' => ['MetaFields.scope' => 'organisation']
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$this->setDisplayField('name');
|
$this->setDisplayField('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
'name' => __('Name'),
|
'name' => __('Name'),
|
||||||
'class' => 'short',
|
'class' => 'short',
|
||||||
'data_path' => 'name',
|
'data_path' => 'name',
|
||||||
|
'sort' => 'name',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => __('UUID'),
|
'name' => __('UUID'),
|
||||||
|
@ -67,14 +68,17 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
[
|
[
|
||||||
'name' => __('Nationality'),
|
'name' => __('Nationality'),
|
||||||
'data_path' => 'nationality',
|
'data_path' => 'nationality',
|
||||||
|
'sort' => 'nationality',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => __('Sector'),
|
'name' => __('Sector'),
|
||||||
'data_path' => 'sector',
|
'data_path' => 'sector',
|
||||||
|
'sort' => 'sector',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => __('Type'),
|
'name' => __('Type'),
|
||||||
'data_path' => 'type',
|
'data_path' => 'type',
|
||||||
|
'sort' => 'type',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => __('Tags'),
|
'name' => __('Tags'),
|
||||||
|
|
|
@ -48,8 +48,7 @@ echo $this->element(
|
||||||
'scope' => 'organisations'
|
'scope' => 'organisations'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'metaTemplates' => empty($metaFields) ? [] : $metaFields,
|
'combinedFieldsView' => false,
|
||||||
'combinedFieldsView' => true,
|
|
||||||
'children' => []
|
'children' => []
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,4 +24,4 @@ if (!isset($params['escape']) || $params['escape'] !== false) {
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
Loading…
Reference in New Issue