Skip to content

Commit

Permalink
Remove entity ID rendered in page heading, and place it in a separate…
Browse files Browse the repository at this point in the history
… view variable. (CFM-193)
  • Loading branch information
arlen committed Jul 13, 2022
1 parent a6a288f commit 88fbc82
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/information.po
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ msgstr "Error: "
msgid "flash.success"
msgstr "Success: "

msgid "entity.id"
msgstr "ID: {0}"

msgid "pagination.format"
msgstr "Page {{page}} of {{pages}}, Viewing {{start}}-{{end}} of {{count}}"

Expand Down
4 changes: 2 additions & 2 deletions app/resources/locales/en_US/operation.po
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ msgid "edit.a"
msgstr "Edit {0}"

msgid "edit.ai"
msgstr "Edit {0} (ID {1})"
msgstr "Edit {0}"

msgid "filter"
msgstr "Filter"
Expand Down Expand Up @@ -127,5 +127,5 @@ msgid "view.a"
msgstr "View {0}"

msgid "view.ai"
msgstr "View {0} ({1})"
msgstr "View {0}"

14 changes: 8 additions & 6 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,18 @@ public function edit(string $id) {
if(method_exists($table, 'generateDisplayField')) {
// We don't use a trait for this since each table will implement different logic

$this->set('vv_title', __d('operation', 'edit.ai', $table->generateDisplayField($obj), $id));
$this->set('vv_title', __d('operation', 'edit.ai', $table->generateDisplayField($obj)));
} else {
// Default view title is edit object display field
$field = $table->getDisplayField();

if(!empty($obj->$field)) {
$this->set('vv_title', __d('operation', 'edit.ai', $obj->$field, $id));
$this->set('vv_title', __d('operation', 'edit.ai', $obj->$field));
} else {
$this->set('vv_title', __d('operation', 'edit.ai', __d('controller', $modelsName, [1]), $id));
$this->set('vv_title', __d('operation', 'edit.ai', __d('controller', $modelsName, [1])));
}
}
$this->set('vv_entity_id', __d('information', 'entity.id', $id));

// Let the view render
$this->render('/Standard/add-edit-view');
Expand Down Expand Up @@ -648,17 +649,18 @@ public function view($id = null) {
if(method_exists($table, 'generateDisplayField')) {
// We don't use a trait for this since each table will implement different logic

$this->set('vv_title', __d('operation', 'view.ai', $table->generateDisplayField($obj), $id));
$this->set('vv_title', __d('operation', 'view.ai', $table->generateDisplayField($obj)));
} else {
// Default view title is the object display field
$field = $table->getDisplayField();

if(!empty($obj->$field)) {
$this->set('vv_title', __d('operation', 'view.ai', $obj->$field, $id));
$this->set('vv_title', __d('operation', 'view.ai', $obj->$field));
} else {
$this->set('vv_title', __d('operation', 'view.ai', __d('controller', $modelsName, [1]), $id));
$this->set('vv_title', __d('operation', 'view.ai', __d('controller', $modelsName, [1])));
}
}
$this->set('vv_entity_id', __d('information', 'entity.id', $id));

// Let the view render
$this->render('/Standard/add-edit-view');
Expand Down

0 comments on commit 88fbc82

Please sign in to comment.