Skip to content

Remove entity ID rendered in page heading, and place it in a separate view variable. (CFM-193) #43

Merged
merged 3 commits into from
Jul 21, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}"

12 changes: 6 additions & 6 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,15 @@ 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])));
}
}

Expand Down Expand Up @@ -648,15 +648,15 @@ 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])));
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/templates/Standard/add-edit-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
}
}

print '<li id="cm-entity-id">' . __d('information', 'entity.id', $vv_obj->id) . '</li>';

if($vv_action == 'add' || $vv_action == 'edit') {
// We don't want/need to output these for view actions

Expand Down
8 changes: 8 additions & 0 deletions app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,14 @@ ul.form-list .cm-time-picker-vals li {
.v-leave-to {
opacity: 0;
}
/* ENTITY ID under each Edit/View Form/List */
#cm-entity-id {
position: absolute;
border: none;
right: 2.5em;
color: var(--cmg-color-gray-003);
background-color: unset;
}
/* DIALOG BOX */
#dialog .modal-header {
background-color: var(--cmg-color-lightgray-004);
Expand Down