<div class="lastnewslist">
	<h4><a href="{{ path('news')}}" class='nounderline'><i class="fa fa-newspaper"></i> {{ 'Actualités'|trans }}</a></h4>
	<p>
		{% for news in getLastNews(3) %}
			<div class="card mb-2">
				<div class="card-header" style='cursor:pointer;'>
					<a href='{{path('show_news', {'slug': news.slug})}}'>{{news.title}}</a>
					{% if app.user and (is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_NEWS_GERER_ALL')) %}
                  		<a class='text-warning float-right' href='{{ path('admin_app_news_edit', {id: news.id})}}'>Editer</a>
                  {% endif %}
				</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 '.jpeg' or pathMedia ends with '.png' or pathMedia ends with '.bmp' or pathMedia ends with '.gif' %}
								{% thumbnail news.media, 'small' %}
							{% else %}
								<a href="{% path news.media, 'reference' %}">{{'Télécharger'|trans}}</a>
							{% endif %}

						{% endif %}
						{% if news.content|striptags|length < 150 %}
							{{ news.content|striptags|raw }}
						{% else %}
							{{ news.content|striptags|truncate(150, true, "...")|raw }}
							<br/><a class='btn btn-xs btn-primary w-100' href='{{path('show_news', {'slug': news.slug})}}'>Lire la suite</a>
						{% endif %}
					</div>
				</div>
				<div class="card-footer text-muted">
                  {{'Crée le'|trans}} {{news.createdAt|date('d/m/Y')}}
                </div>
			</div>
		{% endfor %}
	</p>
</div>