Skip to content

Commit

Permalink
Hide inherited data-category/deletion-concept edit/delete button
Browse files Browse the repository at this point in the history
  • Loading branch information
melegiul committed Jan 15, 2024
1 parent 009635c commit 762b08f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/Controller/LoeschkonzeptController.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,14 @@ public function new(
}

#[Route(path: '/{id}/details', name: 'app_loeschkonzept_show', methods: ['GET'])]
public function show(Loeschkonzept $loeschkonzept): Response
public function show(Loeschkonzept $loeschkonzept, CurrentTeamService $teamService): Response
{
$this->setBackButton($this->generateUrl('app_loeschkonzept_index'));
$currentTeam = $teamService->getCurrentTeam($this->getUser());

return $this->render('loeschkonzept/show.html.twig', [
'loeschkonzept' => $loeschkonzept,
'current_team' => $currentTeam,
]);
}
}
4 changes: 3 additions & 1 deletion src/Controller/VVTDatenkategorieController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ public function new(
}

#[Route(path: '/show/{id}', name: 'app_vvtdatenkategorie_show', methods: ['GET'])]
public function show(VVTDatenkategorie $vVTDatenkategorie): Response
public function show(VVTDatenkategorie $vVTDatenkategorie, CurrentTeamService $teamService): Response
{
$this->setBackButton($this->generateUrl('app_vvtdatenkategorie_index'));
$currentTeam = $teamService->getCurrentTeam($this->getUser());

return $this->render('vvt_datenkategorie/show.html.twig', [
'vvtdatenkategorie' => $vVTDatenkategorie,
'current_team' => $currentTeam,
]);
}
}
10 changes: 6 additions & 4 deletions templates/loeschkonzept/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
{% endblock %}

{% block CTA %}
<a href="{{ path('app_loeschkonzept_edit',{'id': loeschkonzept.id}) }}" class="btn">
<span>{% trans from 'general' %}edit{% endtrans %}</span>
</a>
{{ include('loeschkonzept/_delete_form.html.twig') }}
{% if current_team == loeschkonzept.team %}
<a href="{{ path('app_loeschkonzept_edit',{'id': loeschkonzept.id}) }}" class="btn">
<span>{% trans from 'general' %}edit{% endtrans %}</span>
</a>
{{ include('loeschkonzept/_delete_form.html.twig') }}
{% endif %}
{% endblock %}

{% block body %}
Expand Down
13 changes: 8 additions & 5 deletions templates/vvt_datenkategorie/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
{% trans %}dataCategory.word{% endtrans %}
{% endblock %}

{% block CTA %}
<a href="{{ path('app_vvtdatenkategorie_edit',{'id': vvtdatenkategorie.id}) }}" class="btn">
<span>{% trans from 'general' %}edit{% endtrans %}</span>
</a>
{{ include('vvt_datenkategorie/_delete_form.html.twig') }}
{% block CTA %}
{# TODO Can vvtdatenkategorie.team really be null? #}
{% if vvtdatenkategorie.team is null or current_team == vvtdatenkategorie.team %}
<a href="{{ path('app_vvtdatenkategorie_edit',{'id': vvtdatenkategorie.id}) }}" class="btn">
<span>{% trans from 'general' %}edit{% endtrans %}</span>
</a>
{{ include('vvt_datenkategorie/_delete_form.html.twig') }}
{% endif %}
{% endblock %}

{% block body %}
Expand Down

0 comments on commit 762b08f

Please sign in to comment.