nineskeletor/templates/Menu/edit.html.twig

104 lines
2.8 KiB
Twig
Raw Normal View History

2023-02-16 17:03:53 +01:00
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="submit" %}
Création blogtype
{% else %}
Modification blogtype
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href={{ path('app_typeblog') }}>Annuler</a>
{% if mode=="update" and blogtype.id>0 %}
<a href={{ path('app_typeblog_delete',{'id':blogtype.id}) }}
class="btn btn-danger float-end"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="card">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
<div class="card-body">
{{ form_row(form.childtype) }}
{{ form_row(form.blog) }}
{{ form_row(form.blogtype) }}
{{ form_row(form.page) }}
{{ form_row(form.pagetype) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localscript %}
<script>
$(document.body).on("change","#menuchild_childtype",function(){
$("#menuchild_blog").empty();
$("#menuchild_blogtype").empty();
$("#menuchild_page").empty();
$("#menuchild_pagetype").empty();
showhide();
});
function showhide() {
$("#groupfield_menuchild_blog").hide();
$("#groupfield_menuchild_blogtype").hide();
$("#groupfield_menuchild_page").hide();
$("#groupfield_menuchild_pagetype").hide();
switch ($("#menuchild_childtype").val()) {
case 'blog':
$("#groupfield_menuchild_blog").show();
break;
case 'blogtype':
$("#groupfield_menuchild_blogtype").show();
break;
case 'page':
$("#groupfield_menuchild_page").show();
break;
case 'pagetype':
$("#groupfield_menuchild_pagetype").show();
break;
}
}
showhide();
</script>
{% endblock %}