Skip to content

Commit

Permalink
Make it easier to visit a Mostly Static Page (CFM-501)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Feb 12, 2026
1 parent 27983a7 commit 05e557b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/operation.po
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ msgstr "View"
msgid "view.a"
msgstr "View {0}"

msgid "visit.msp"
msgstr "Visit Page"

msgid "visit.link"
msgstr "Visit link"

Expand Down
10 changes: 10 additions & 0 deletions app/templates/MostlyStaticPages/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ $indexColumns = [
'sortable' => true
]
];

$rowActions = [
[
'icon' => 'arrow_outward',
'label' => __d('operation', 'visit.msp'),
'url' => function($entity) {
return '/' . $entity->co_id . '/' . $entity->name;
}
]
];
13 changes: 12 additions & 1 deletion app/templates/Standard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,23 @@
$actionOrderDefault = $this->Menu->getMenuOrder('Default');
foreach ($rowActions as $a) {
$ok = false;
$callbackUrl = '';

if (!empty($a['controller']) && $a['controller'] != $tableName) {
$relTableName = Inflector::camelize($a['controller']);

if (isset($vv_permission_set[$entity->id][$relTableName][$a['action']])) {
$ok = $vv_permission_set[$entity->id][$relTableName][$a['action']];
}
} elseif(!empty($a['url'])) {
if(is_callable($a['url'])) {
// We are constructing a URL in a callback function.
$callbackUrl = $a['url']($entity);
} else {
// We are setting a static URL override.
$callbackUrl = $a['url'];
}
$ok = true;
} else {
$ok = $vv_permission_set[$entity->id][$a['action']];
}
Expand All @@ -306,7 +317,7 @@
$actionIcon = !empty($a['icon']) ? $a['icon'] : $this->Menu->getMenuIcon('Default');
$actionIconClass = !empty($a['iconClass']) ? $a['iconClass'] : '';
$actionClass = !empty($a['class']) ? $a['class'] : '';
$actionUrl = ['action' => $a['action'], $entity->id];
$actionUrl = !empty($callbackUrl) ? $callbackUrl : ['action' => $a['action'], $entity->id];
$actionLabel = !empty($a['label']) ? $a['label'] : __d('operation', $a['action']);

if (!empty($a['controller']) && $a['controller'] != $tableName) {
Expand Down

0 comments on commit 05e557b

Please sign in to comment.