Skip to content

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/templates/Petitions/columns.inc
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
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