summaryrefslogtreecommitdiff
path: root/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig
diff options
context:
space:
mode:
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig')
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig13
1 files changed, 11 insertions, 2 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig
index f057d35..10a8754 100644
--- a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Template/index.twig
@@ -47,13 +47,16 @@ $this->Form->setTemplates(['label' => '']);
<nav class="large-2 medium-3 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
- <li><?= $this->Html->link(__('New {{ singularHumanName }}'), ['action' => 'add']) ?></li>
+{% if BakeExtra.hasAction('add', modelClass) %}
+<li><?= $this->Html->link(__('New {{ singularHumanName }}'), ['action' => 'add']) ?></li>
+{% endif %}
{% set done = [] %}
{% for type, data in associations %}
{% for alias, details in data %}
{% if details.navLink and details.controller is not same as(_view.name) and details.controller not in done %}
+{% if BakeExtra.hasAction('index', details.controller) %}
<li><?= $this->Html->link(__('List {{ alias|underscore|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'index']) ?></li>
- <li><?= $this->Html->link(__('New {{ alias|singularize|underscore|humanize }}'), ['controller' => '{{ details.controller }}', 'action' => 'add']) ?></li>
+{% endif %}
{% set done = done|merge([details.controller]) %}
{% endif %}
{% endfor %}
@@ -118,9 +121,15 @@ $this->Form->setTemplates(['label' => '']);
{% endfor %}
{% set pk = '$' ~ singularVar ~ '->' ~ primaryKey[0] %}
<td class="actions">
+{% if BakeExtra.hasAction('view', modelClass) %}
<?= $this->Html->link(__('View'), ['action' => 'view', {{ pk|raw }}]) ?>
+{% endif %}
+{% if BakeExtra.hasAction('edit', modelClass) %}
<?= $this->Html->link(__('Edit'), ['action' => 'edit', {{ pk|raw }}]) ?>
+{% endif %}
+{% if BakeExtra.hasAction('delete', modelClass) %}
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', {{ pk|raw }}], ['confirm' => __('Are you sure you want to delete # {0}?', {{ pk|raw }})]) ?>
+{% endif %}
</td>
</tr>
<?php endforeach; ?>