This commit is contained in:
108
templates/Pagetype/edit.html.twig
Normal file
108
templates/Pagetype/edit.html.twig
Normal file
@ -0,0 +1,108 @@
|
||||
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="submit" %}
|
||||
Création pagetype
|
||||
{% else %}
|
||||
Modification pagetype
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<a class="btn btn-secondary" href={{ path('app_typepage') }}>Annuler</a>
|
||||
|
||||
{% if mode=="update" and pagetype.id>0%}
|
||||
<a href={{ path('app_typepage_delete',{'id':pagetype.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.name) }}
|
||||
{{ form_row(form.sortby) }}
|
||||
{{ form_row(form.description) }}
|
||||
|
||||
{% set image= "noimage.png" %}
|
||||
{% if pagetype.image %}
|
||||
{% set image= pagetype.image %}
|
||||
{% endif %}
|
||||
|
||||
<center>
|
||||
<img class="mt-3" id="pagetype_image_img" src="{{ path("app_minio_image", {file:image}) }}" style="width:100%;"><br>
|
||||
{{ form_widget(form.image) }}
|
||||
|
||||
<a class="btn btn-info btn-modal" style="width:90px" data-modalid="mymodallarge" data-modaltitle="Image" data-modalurl="{{ path('app_typepage_upload') }}" title='Ajouter une image'>Modifier</a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
function formatState (opt) {
|
||||
if (!opt.id) {
|
||||
return opt.text.toUpperCase();
|
||||
}
|
||||
|
||||
var optimage = $(opt.element).attr('data-image');
|
||||
console.log(optimage)
|
||||
if(!optimage){
|
||||
return opt.text.toUpperCase();
|
||||
} else {
|
||||
var $opt = $(
|
||||
'<span><img src="' + optimage + '" height="30px" /> ' + opt.text.toUpperCase() + '</span>'
|
||||
);
|
||||
return $opt;
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#pagetype_icon > option").each(function(index) {
|
||||
if(index>0) {
|
||||
$(this).attr("data-image","/{{ appAlias }}/images/marker/"+$(this).html());
|
||||
}
|
||||
});
|
||||
|
||||
$("#pagetype_icon").select2({
|
||||
templateResult: formatState,
|
||||
templateSelection: formatState
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
55
templates/Pagetype/home.html.twig
Executable file
55
templates/Pagetype/home.html.twig
Executable file
@ -0,0 +1,55 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block localstyle %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block beforebody %}
|
||||
|
||||
<div class="herobody">
|
||||
<div class="p-0 m-0" style="height:100%;background-size:cover;background-image:url({{path("app_minio_image",{file:pagetype.image})}}">
|
||||
|
||||
<div class="title">
|
||||
<div class="d-flex align-items-center">
|
||||
<img src="{{ path('app_minio_image',{file:"logo/"~app.session.get("logodark")}) }}" style="height:120px;">
|
||||
|
||||
<div class="ps-3">
|
||||
<h1>{{pagetype.name}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if not pagetype.description is empty %}
|
||||
<div class="mt-5 p-3" style="max-width: 1000px; margin:auto; background-color: var(--colorbgbodyimportant)">
|
||||
{{pagetype.description|raw}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="grid">
|
||||
<div class="grid-sizer"></div>
|
||||
<div class="gutter-sizer"></div>
|
||||
|
||||
{% for page in pagetype.pages %}
|
||||
{% set url=path("app_child_view",{catparent:'page', idparent:page.id, idchild:page.childs[0].id }) %}
|
||||
{% set name=page.name %}
|
||||
{% set image=(page.childs[0].childheaders is empty ? "" : page.childs[0].childheaders[0].filename) %}
|
||||
|
||||
<a href="{{url}}" class="d-block text-center">
|
||||
<div class="grid-item grid-item-size-2 d-flex align-items-stretch">
|
||||
<div class="grid-image d-flex align-items-center pr-2 pl-2" style="background-image:url({{path("app_minio_image",{file:image})}}); background-size:cover;">
|
||||
<div class="grid-item-title">
|
||||
<span class="p-1" style="font-weight:bold; text-transform:uppercase;">
|
||||
{{ name }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
52
templates/Pagetype/list.html.twig
Normal file
52
templates/Pagetype/list.html.twig
Normal file
@ -0,0 +1,52 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
pagetypes
|
||||
</h1>
|
||||
|
||||
<p><a class="btn btn-success" href={{ path('app_typepage_submit') }}>Ajouter</a></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des pagetypes
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="90px" class="no-sort">Action</th>
|
||||
<th>Nom</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for pagetype in pagetypes %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{path("app_typepage_update",{id:pagetype.id})}}"><i class="fa fa-file fa-2x"></i></a>
|
||||
</td>
|
||||
<td>{{pagetype.name}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#dataTables').DataTable({
|
||||
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
|
||||
responsive: true,
|
||||
iDisplayLength: 100,
|
||||
order: [[ 2, "asc" ]]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
38
templates/Pagetype/upload.html.twig
Executable file
38
templates/Pagetype/upload.html.twig
Executable file
@ -0,0 +1,38 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block encoretags %}
|
||||
{{ encore_entry_link_tags('dropzone') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
|
||||
|
||||
<form
|
||||
action="{{ oneup_uploader_endpoint('image') }}"
|
||||
class="dropzone"
|
||||
id="mydropzone"
|
||||
data-acceptedMimeTypes="image/*"
|
||||
data-maxFiles=1
|
||||
|
||||
style="margin-top:10px">
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
{{ encore_entry_script_tags('dropzone') }}
|
||||
|
||||
<script>
|
||||
function dropzoneinit( elmt ) {
|
||||
}
|
||||
|
||||
function dropzonesuccess( file, response ) {
|
||||
parent.$("#pagetype_image").val("image/"+response["file"]);
|
||||
parent.$("#pagetype_image_img").attr("src","{{ path("app_minio_image",{file:"image/"}) }}"+response["file"]);
|
||||
closeModal();
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
window.parent.$("#mymodallarge").modal('hide');
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user