ninegitea/templates/Config/edit.html.twig

95 lines
3.8 KiB
Twig
Raw Permalink Normal View History

2021-07-20 13:04:47 +02:00
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification CONFIGURATION
{% elseif mode=="submit" %}
Création CONFIGURATION
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href={{ path('app_config') }}>Annuler</a>
{% if mode=="update" and not config.required %}
<a href="{{ path('app_config_delete',{'id':config.id}) }}"
class="btn btn-danger float-right"
data-method="delete"
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
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.id) }}
{{ form_row(form.value) }}
{% if config.type=="logo" %}
<div style="width:90px; margin:10px auto;">
{% set color = "" %}
{% if config.id=='logodark' %}
{% set color = app.session.get('colorbgbodydark') %}
{% elseif config.id=='logolight' %}
{% set color = app.session.get('colorbgbodylight') %}
{% endif %}
2023-12-22 13:53:10 +01:00
<img id="config_value_img" src="{{ asset("uploads/logo/"~config.value) }}" style="background-color: {{color}}; width:90px;height:90px; margin:auto;display:block;">
2021-07-20 13:04:47 +02:00
<a class="btn btn-info" style="width:90px" onClick="ModalLoad('mymodallarge','Logo','{{ path('app_config_logo') }}');" title='Ajouter un Logo'>Modifier</a>
</div>
{% elseif config.type=="hero" %}
<div style="margin:10px auto;">
2023-12-22 13:53:10 +01:00
<img id="config_value_img" src="{{ asset("uploads/hero/"~config.value) }}" style="width:100%;margin:auto;display:block;">
2021-07-20 13:04:47 +02:00
<a class="btn btn-info" style="width:100%" onClick="ModalLoad('mymodallarge','Carrousel','{{ path('app_crop01', {"type": "hero", "reportinput": "#config_value" }) }}');" title='Ajouter une Bannière'>Modifier</a>
</div>
{% elseif config.type=="image" %}
<div style="margin:10px auto;">
2023-12-22 13:53:10 +01:00
<img id="config_value_img" src="{{ asset("uploads/hero/"~config.value) }}" style="width:100%;margin:auto;display:block;">
2021-07-20 13:04:47 +02:00
<a class="btn btn-info" style="width:100%" onClick="ModalLoad('mymodallarge','Image','{{ path('app_crop01', {"type": "image", "reportinput": "#config_value" }) }}');" title='Ajouter une Image'>Modifier</a>
</div>
{% endif %}
{{ form_row(form.help) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$("#config_value_img").on('error', function(){
var imgSrc = $(this).attr('src');
2023-12-22 13:53:10 +01:00
if(imgSrc!="{{ asset("uploads/"~config.type) }}/")
2021-07-20 13:04:47 +02:00
$(this).attr('src',imgSrc);
});
$('#mymodallarge').on('hidden.bs.modal', function () {
var imgSrc = $("#config_value_img").attr('src');
$("#config_value_img").attr('src',imgSrc);
});
{% endblock %}