153 lines
6.7 KiB
Twig
153 lines
6.7 KiB
Twig
|
|
{% extends '@CadolesCore/base.html.twig' %}
|
|
|
|
|
|
{% block appmenu %}
|
|
<ul class="nav navbar-top-links navbar-left">
|
|
<li id="menublog-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
|
|
<a href="{{ path("cadoles_portal_user_blog_view") }}">
|
|
Tout
|
|
</a>
|
|
</li>
|
|
|
|
{% for blog in blogs %}
|
|
<li id="menublog-{{blog.id}}" data-open="{% if blog.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==blog.id%}active{%endif%}" style="cursor:pointer">
|
|
<a href="{{ path("cadoles_portal_user_blog_view",{'id':blog.id}) }}">
|
|
{{ blog.name }}
|
|
{% if blog.canadd %}
|
|
<i class="fa fa-pencil"></i>
|
|
{% else %}
|
|
<i class="fa fa-lock"></i>
|
|
{% endif %}
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endblock %}
|
|
|
|
{% block pagewrapper %}
|
|
{% if access=="config" %}
|
|
<div class="pagemenu">
|
|
<a href="{{ path('cadoles_portal_config_blog_view', {id:entity.blog.id})}}">{{ entity.blog.name }}</a>
|
|
</div>
|
|
{% else %}
|
|
<br>
|
|
<ul class="nav navbar-default nav-pills">
|
|
<li id="menublog-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
|
|
<a href="{{ path("cadoles_portal_user_blog_view") }}">
|
|
Tout
|
|
</a>
|
|
</li>
|
|
|
|
{% for blog in blogs %}
|
|
<li id="menublog-{{blog.id}}" data-open="{% if blog.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==blog.id%}active{%endif%}" style="cursor:pointer">
|
|
<a href="{{ path("cadoles_portal_user_blog_view",{'id':blog.id}) }}">
|
|
{{ blog.name }}
|
|
{% if blog.canadd %}
|
|
<i class="fa fa-pencil"></i>
|
|
{% else %}
|
|
<i class="fa fa-lock"></i>
|
|
{% endif %}
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
<div class="blogarticle">
|
|
{%if entity.image is not empty %}
|
|
<div class="blogimage" style="background-image:url(/{{ alias }}/{{entity.image}})"></div>
|
|
{% endif %}
|
|
|
|
<div class="row">
|
|
<div class="col col-md-9">
|
|
<div class="blogtitle">
|
|
<legend><h1>{{entity.name}}</h1></legend>
|
|
<small>publié par {{ entity.user.username }} le {{ entity.submit|date("d/m/Y à H:i") }} dans le blog {{entity.blog.name }}</small>
|
|
{% if canadd %}
|
|
<a href="{{ path("cadoles_portal_"~access~"_blogarticle_update",{'id':entity.id}) }}"><i class="fa fa-file"></i></a>
|
|
{% endif %}
|
|
</div>
|
|
<div class="blogbody">
|
|
{{ entity.description | raw }}
|
|
</div>
|
|
|
|
{% if entity.fgcomment %}
|
|
<hr>
|
|
<a href="{{path('cadoles_portal_'~access~'_blogcomment_submit',{"idarticle":entity.id}) }}" style="width:100%" class="btn btn-success">Ajouter un commentaire</a>
|
|
{% endif %}
|
|
{% if not entity.blogcomments is empty %}
|
|
{% for comment in entity.blogcomments|reverse %}
|
|
{% if comment.parent is empty %}
|
|
<div class="blogtitle">
|
|
<legend><h2>{{comment.name}}</h2></legend>
|
|
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
|
|
{% if canadd or app.user==comment.user%}
|
|
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
|
|
{% endif %}
|
|
</div>
|
|
<div class="blogbody">
|
|
{{ comment.description | raw }}
|
|
</div>
|
|
|
|
<div class="blogreply" style="width:80%; margin:auto">
|
|
{% for reply in comment.childs|reverse %}
|
|
<div class="blogtitle">
|
|
<legend><h2 style="font-size:85%">{{reply.name}}</h2></legend>
|
|
<small>publié par {{ reply.user.username }} le {{ reply.submit|date("d/m/Y à H:i") }}</small>
|
|
{% if canadd or app.user==reply.user%}
|
|
<a href="{{ path("cadoles_portal_"~access~"_blogcomment_update",{'id':reply.id}) }}"><i class="fa fa-file"></i></a>
|
|
{% endif %}
|
|
</div>
|
|
<div class="blogbody" style="font-size:85%">
|
|
{{ reply.description | raw }}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if entity.fgcomment %}
|
|
<a href="{{path('cadoles_portal_'~access~'_blogcomment_reply',{"idarticle":entity.id,"idcomment":comment.id}) }}" class="btn btn-success">Répondre</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="blogsidebar col col-md-3">
|
|
<h4 class="blogsidebartitle">Articles Récents</h4>
|
|
{% for blogarticle in blogarticles %}
|
|
<a href="{{ path("cadoles_portal_"~access~"_blogarticle_view",{"id":blogarticle.id}) }}">{{ blogarticle.name }}</a><br>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% block localjavascript %}
|
|
var idblog;
|
|
|
|
$('document').ready(function(){
|
|
{% if entity.id is defined %}
|
|
{% for blog in blogs %}
|
|
{% if blog.id==entity.blog.id %}
|
|
showBlog({{ blog.id }}, {{ blog.canupdate }});
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% else %}
|
|
showBlog(0, {{ canupdate }});
|
|
{% endif %}
|
|
});
|
|
|
|
|
|
// Affichages des blogs
|
|
function showBlog(id,canupdate) {
|
|
// Rendre actif le page en cours dans le menu
|
|
$(".navbar-top-links li").removeClass("active");
|
|
$(".nav-pills li").removeClass("active");
|
|
$("#menublog-"+id).addClass("active");
|
|
}
|
|
|
|
|
|
{% endblock %}
|