chg: [metaTemplate] Better placement of notice message

pull/93/head
Sami Mokaddem 2021-12-20 14:28:04 +01:00
parent 0dea5ab486
commit a1a9029053
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 24 additions and 12 deletions

View File

@ -2,24 +2,33 @@
use Cake\Utility\Hash;
if (!empty($updateableTemplates['new'])) {
$alertHtml = sprintf('<strong>%s</strong> %s', __('New meta-templates available!'), __n('There is one new template on disk that can be loaded in the database', 'There are {0} new templates on disk that can be loaded in the database:', count($updateableTemplates['new'])));
$alertList = Hash::combine(
$updateableTemplates,
null,
['%s :: %s', 'new.{s}.template.namespace', 'new.{s}.template.name'],
'new.{n}.template.namespace'
$alertHtml = sprintf(
'<strong>%s</strong> %s',
__('New meta-templates available!'),
__n('There is one new template on disk that can be loaded in the database', 'There are {0} new templates on disk that can be loaded in the database:', count($updateableTemplates['new']))
);
$alertList = [];
$alertList = Hash::extract($updateableTemplates['new'], '{s}.template');
$alertList = array_map(function($entry) {
return h($entry);
return sprintf('%s:%s %s',
h($entry['namespace']),
h($entry['name']),
$this->Bootstrap->button([
'variant' => 'link',
'size' => 'sm',
'icon' => 'download',
'title' => __('Create this template'),
'params' => [
'onclick' => "UI.submissionModalForIndex('/metaTemplates/createNewTemplate/{$entry['uuid']}', '/meta-templates')"
]
])
);
}, $alertList);
$alertHtml .= $this->Html->nestedList($alertList);
echo $this->Bootstrap->alert([
'html' => $alertHtml,
'variant' => 'warning',
]);
}
echo $this->element('genericElements/IndexTable/index_table', [
'notice' => !empty($alertHtml) ? ['html' => $alertHtml, 'variant' => 'warning',] : false,
'data' => [
'data' => $data,
'top_bar' => [
@ -162,7 +171,6 @@ echo $this->element('genericElements/IndexTable/index_table', [
],
'title' => __('Meta Field Templates'),
'description' => __('The various templates used to enrich certain objects by a set of standardised fields.'),
'pull' => 'right',
'actions' => [
[
'url' => '/metaTemplates/view',

View File

@ -54,6 +54,10 @@ if (!empty($data['title'])) {
);
}
if(!empty($notice)) {
echo $this->Bootstrap->alert($notice);
}
if (!empty($modelStatistics)) {
echo $this->element('genericElements/IndexTable/Statistics/index_statistic_scaffold', [
'statistics' => $modelStatistics,