{% extends 'common/layout.html.twig' %}

{% block content %}
<div class='container newslist mt-5'>
  <div class="card mb-2">
	<div class="card-header" style='cursor:pointer;'><h1>{{news.title}}</h1></div>
	<div class="card-body">
		<div class="card-text">
			{% if news.media %}
				{% set pathMedia = mediaurl(news.media, 'reference') %}
				{% if pathMedia ends with '.jpg' or pathMedia ends with '.png' or pathMedia ends with '.bmp' or pathMedia ends with '.gif' %}
					<img src="{% path news.media, 'reference' %}" style="max-width: 100%;"/>
				{% else %}
					<a href="{% path news.media, 'reference' %}">{{'Télécharger'|trans}}</a>
				{% endif %}

			{% endif %}
			{{news.content|raw}}
		</div>
	</div>
	<div class="card-footer text-muted">
      {{ 'Crée le'|trans }} {{news.createdAt|date('d/m/Y')}}
    </div>
</div>
</div>
{% endblock %}
