Skip to content

Commit

Permalink
Improve Petition index and add a label prefix config for index view (…
Browse files Browse the repository at this point in the history
…CFM-428)
  • Loading branch information
arlen committed Nov 21, 2024
1 parent 71d494b commit bb47f70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
21 changes: 11 additions & 10 deletions app/templates/Petitions/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,8 @@
$indexColumns = [
// We start with id to ensure there is a clickable field in the row
'id' => [
'type' => 'link'
],
'enrollee_person_id' => [
'type' => 'relatedLink',
'action' => 'edit',
'label' => __d('field', 'Petitions.enrollee_person_id'),
'model' => 'enrollee_person',
'submodel' => 'primary_name',
'field' => 'full_name',
'default' => __d('field', 'Petitions.enrollee.new')
'type' => 'link',
'labelPrefix' => __d('controller','Petitions',[1])
],
'status' => [
'type' => 'enum',
Expand All @@ -49,6 +41,15 @@ $indexColumns = [
'model' => 'enrollment_flow',
'field' => 'name'
],
'enrollee_person_id' => [
'type' => 'relatedLink',
'action' => 'edit',
'label' => __d('field', 'Petitions.enrollee_person_id'),
'model' => 'enrollee_person',
'submodel' => 'primary_name',
'field' => 'full_name',
'default' => __d('field', 'Petitions.enrollee.new')
],
'cou_id' => [
'type' => 'relatedLink',
'model' => 'cou',
Expand Down
7 changes: 6 additions & 1 deletion app/templates/Standard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,13 @@
?>
<td<?= !empty($cellClass) ? ' class="' . $cellClass . '"' : ''; ?>>
<?php
$prefix = "";
$suffix = "";

if(!empty($cfg['labelPrefix'])) {
$prefix = $cfg['labelPrefix'] . ' ';
}

if(!empty($cfg['append'])) {
// The value is a method on the entity that returns a string to
// append to the label
Expand Down Expand Up @@ -490,7 +495,7 @@
case 'echo':
default:
// By default our label is the column value, but it might be overridden
$label = $entity->$col . $suffix;
$label = $prefix . $entity->$col . $suffix;

// If there is no calculated default value but a default is configured,
// use that instead
Expand Down

0 comments on commit bb47f70

Please sign in to comment.