This commit is contained in:
83
templates/Blog/edit.html.twig
Normal file
83
templates/Blog/edit.html.twig
Normal file
@ -0,0 +1,83 @@
|
||||
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="submit" %}
|
||||
Création blog
|
||||
{% else %}
|
||||
Modification blog
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
|
||||
{% if from=="child" %}
|
||||
<a class="btn btn-secondary" href={{ path('app_child',{catparent:'blog',idparent:blog.id}) }}>Annuler</a>
|
||||
{% else %}
|
||||
<a class="btn btn-secondary" href={{ path('app_blog') }}>Annuler</a>
|
||||
{% endif %}
|
||||
|
||||
{% if mode=="update" and blog.id>0 %}
|
||||
<a href={{ path('app_blog_delete',{id:blog.id}) }}
|
||||
class="btn btn-danger float-right"
|
||||
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="row">
|
||||
<div class="col-md-6">
|
||||
<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.blogtype) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#blog_name").focus();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
150
templates/Blog/home.html.twig
Normal file
150
templates/Blog/home.html.twig
Normal file
@ -0,0 +1,150 @@
|
||||
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block beforebody %}
|
||||
{%if heros %}
|
||||
<div class="heroheader" style="top:55px;display:none;" >
|
||||
{% for hero in heros %}
|
||||
<div class="p-0 m-0" style="background-image:url(/{{appAlias}}/uploads/childheader/{{hero.childid}}/{{hero.filename}})">
|
||||
<img id="separateur" src="/{{appAlias}}/images/separateur-g.png">
|
||||
<div id="herotitle">
|
||||
<h1>
|
||||
{{hero.name}}<br>
|
||||
<small>
|
||||
<div style="font-size:16px">{{ hero.parenttype }}</div>
|
||||
<span style="font-size:20px; line-height:20px; display:block">{{ hero.subname|nl2br }}</span>
|
||||
</small>
|
||||
</h1>
|
||||
|
||||
<a class="btn btn-success" href="{{path("app_child_view",{catparent:hero.catparent,idparent:hero.parentid,idchild:hero.childid})}}">En savoir plus</a>
|
||||
</div>
|
||||
{% if hero.credit %}<div class="herocredit position-absolute d-flex align-items-end justify-content-end" style="top:0px;padding:5px;font-size:80%;">© {{ hero.credit }}</div>{% endif %}
|
||||
</div>
|
||||
{%endfor%}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block useractions %}
|
||||
{% if is_granted('ROLE_ADMIN') %}
|
||||
<li>
|
||||
<a href="{{path("app_blog_submit")}}"><i class="fa fa-plus fa-2x"></i></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container" style="padding-top:100px">
|
||||
<h1 class="child-name pt-0 text-uppercase mb-4">Actualités</h1>
|
||||
<div class="grid">
|
||||
<div class="grid-sizer"></div>
|
||||
<div class="gutter-sizer"></div>
|
||||
{% for blog in blogs %}
|
||||
{% if not blog.childblogs is empty %}
|
||||
{% set background="" %}
|
||||
{% if not blog.childblogs[0].child.childheaders is empty and blog.childblogs[0].child.childheaders[0] %}
|
||||
{% set background="/"~appAlias~"/uploads/childheader/"~blog.childblogs[0].child.id~"/"~blog.childblogs[0].child.childheaders[0].filename %}
|
||||
{% endif %}
|
||||
|
||||
{% set style="height:auto;background-position: center ; background-size: cover; background-image: url("~background~")" %}
|
||||
<a href="{{path("app_child_view",{catparent:'blog',idparent:blog.id,idchild:blog.childblogs[0].child.id})}}" class="d-block text-center">
|
||||
<div class="grid-item grid-item-size-5 d-flex align-items-stretch">
|
||||
<div class="grid-image d-flex align-items-center pr-2 pl-2" style="{{style}}">
|
||||
<div class="grid-item-title">
|
||||
<span class="p-1" style="font-weight:bold; text-transform:uppercase;">{{ blog.childblogs[0].child.name }}</span>
|
||||
<small><br><span class="p-1" style="background-color:var(--colorbgbodylight);color:var(--colorftbodylight)">{{ blog.blogtype.name }}</span></small>
|
||||
<small class="p-2" style="line-height:15px; display:block;">
|
||||
{% if blog.childblogs[0].child.subname %}
|
||||
{{ blog.childblogs[0].child.subname|nl2br }}<br>
|
||||
{% endif %}
|
||||
{% for tag in blog.childblogs[0].child.tags %}
|
||||
{% if loop.first %}<br>{%endif%}
|
||||
<span class="grid-tag" data-id="{{tag.id}}">#{{tag.id}}</span>
|
||||
{% endfor %}
|
||||
</small>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
function resizegrid() {
|
||||
height=$('.grid-item').width();
|
||||
height=Math.min(height,300);
|
||||
$('.grid-item').not('.grid-video').height(height)
|
||||
|
||||
$('.grid').masonry({
|
||||
columnWidth: '.grid-sizer',
|
||||
gutter: '.gutter-sizer',
|
||||
itemSelector: '.grid-item',
|
||||
percentPosition: true,
|
||||
horizontalOrder: false,
|
||||
});
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
if($('.heroheader').length) {
|
||||
heighthero=$('.heroheader').width()/4;
|
||||
$('.heroheader').height(heighthero);
|
||||
$('.herocredit').css({ top: (heighthero-30)+'px' });
|
||||
if($('.heroheader').width()>980) $('.heroheader').show();
|
||||
}
|
||||
resizegrid();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
if($('.heroheader').length) {
|
||||
heighthero=$('.heroheader').width()/4;
|
||||
$('.heroheader').height(heighthero);
|
||||
$('.herocredit').css({ top: (heighthero-30)+'px' });
|
||||
if($('.heroheader').width()>980) $('.heroheader').show();
|
||||
|
||||
{% if heros|length > 1 %}
|
||||
$('.heroheader').slick({
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1,
|
||||
autoplay: true,
|
||||
autoplaySpeed: 6000,
|
||||
dots: true,
|
||||
touchMove: false,
|
||||
pauseOnDotsHover: true,
|
||||
fade: true,
|
||||
cssEase: 'linear',
|
||||
prevArrow: false,
|
||||
nextArrow: false,
|
||||
customPaging: function(slider, i) {
|
||||
return '<span class="heroheader-dot fa fa-circle fa-fw"></span>';
|
||||
}
|
||||
});
|
||||
{% endif %}
|
||||
}
|
||||
resizegrid();
|
||||
});
|
||||
|
||||
$( ".grid-item" ).hover(function() {
|
||||
$( this ).children(".grid-image").css("transform","scale(1.05)");
|
||||
}, function() {
|
||||
$( this ).children(".grid-image").css("transform","scale(1)");
|
||||
});
|
||||
|
||||
$( ".grid-tag" ).hover(function() {
|
||||
$( this ).css("text-decoration","underline");
|
||||
}, function() {
|
||||
$( this ).css("text-decoration","none");
|
||||
});
|
||||
|
||||
$( ".grid-tag" ).click(function() {
|
||||
url="{{path("app_child_search",{tags:"xxx"}) }}"
|
||||
url=url.replace("xxx",$(this).data("id"));
|
||||
document.location = url;
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
58
templates/Blog/list.html.twig
Normal file
58
templates/Blog/list.html.twig
Normal file
@ -0,0 +1,58 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
blogs
|
||||
</h1>
|
||||
|
||||
<p><a class="btn btn-success" href={{ path('app_blog_submit') }}>Ajouter</a></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des blogs
|
||||
</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 class="no-string" width="70px">ID</th>
|
||||
<th width="70px">Date</th>
|
||||
<th width="200px">Type</th>
|
||||
<th>Nom</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for blog in blogs %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{path("app_child",{catparent:"blog",idparent:blog.id})}}"><i class="fa fa-file fa-2x"></i></a>
|
||||
</td>
|
||||
<td>{{blog.id}}</td>
|
||||
<td>{{blog.submitdate|date("Y-m-d")}}</td>
|
||||
<td>{{blog.blogtype.name}}</td>
|
||||
<td>{{blog.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 %}
|
||||
|
Reference in New Issue
Block a user