chg: [metaTemplates:index] Improved conflict text

pull/37/head
mokaddem 2020-12-10 17:05:51 +01:00
parent fa49821731
commit 9a1d254b01
1 changed files with 14 additions and 3 deletions

View File

@ -57,15 +57,26 @@ echo $this->element('genericElements/IndexTable/index_table', [
'titleHtml_vars' => ['name'],
'bodyHtml' => $this->Html->nestedList([
__('Only one template per scope can be set as the default template'),
'{{1}}',
'{{0}}',
]),
'bodyHtml_vars' => [
'scope',
[
'function' => function($row, $data) {
$conflictingTemplate = getConflictingTemplate($row, $data);
if (!empty($conflictingTemplate)) {
return sprintf('<span class="text-danger font-weight-bolder">%s</span> %s', __('Conflict with:'), h($conflictingTemplate->name));
return sprintf(
"<span class=\"text-danger font-weight-bolder\">%s</span> %s.<br />
<span class=\"font-weight-bolder\">%s</span> %s <span class=\"font-weight-bolder\">%s</span>",
__('Conflict with:'),
$this->Html->link(
h($conflictingTemplate->name),
'/metaTemplates/view/' . h($conflictingTemplate->id),
['target' => '_blank']
),
__('By proceeding'),
h($conflictingTemplate->name),
__('will not be the default anymore')
);
}
return __('Current scope: {0}', h($row->scope));
},