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) (#252)

* Improve Petition index and add a label prefix config for index view (CFM-428)

* Swap column order for enrollee and enrollment flow (CFM-428)
  • Loading branch information
arlen authored Nov 21, 2024
1 parent 71d494b commit b68282f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 7 additions & 6 deletions app/templates/Petitions/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
$indexColumns = [
// We start with id to ensure there is a clickable field in the row
'id' => [
'type' => 'link'
'type' => 'link',
'labelPrefix' => __d('controller','Petitions',[1])
],
'status' => [
'type' => 'enum',
'class' => 'PetitionStatusEnum',
'sortable' => true
],
'enrollee_person_id' => [
'type' => 'relatedLink',
Expand All @@ -39,11 +45,6 @@ $indexColumns = [
'field' => 'full_name',
'default' => __d('field', 'Petitions.enrollee.new')
],
'status' => [
'type' => 'enum',
'class' => 'PetitionStatusEnum',
'sortable' => true
],
'enrollment_flow_id' => [
'type' => 'relatedLink',
'model' => 'enrollment_flow',
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 b68282f

Please sign in to comment.