{% extends 'bootstrap-modal-layout.html.twig' %}
{% do script(['app/js/announcement/announcement/index.js'])%}
{% set tab="list" %}

{% block title %}
{{'公告管理'|trans}}
{% endblock %}

{% block body %}
	<div class="announcement-list">
	{% if announcements %}
		{% for announcement in announcements %}
        <div class="alert alert-default alert-edit clearfix" role="alert">
          <div class="alert-header">
            <i class="icon-click es-icon es-icon-chevronright"></i>
            <span class="title">
              {{ announcement.content|plain_text(40) }}
            </span>

            {% if canManage %}
	            <span class="editor">
                {{ announcement.createdTime|date('Y-m-d') }}
	              <a class="mlm" data-target="#modal"  data-toggle="modal" data-url="{{ path('announcement_update',{id:announcement.id, targetType:targetType,  targetId:targetId}) }}"><i class="es-icon es-icon-edit" data-toggle="tooltip" data-placement="top" title="{{'编辑'|trans}}"></i></a>
	              <a href="javascript:;" data-role="delete" data-url="{{ path('announcement_delete',{id:announcement.id, targetType:targetType, targetId:targetId}) }}"><i class="es-icon es-icon-delete ml10" data-toggle="tooltip" data-placement="top" title="{{'删除'|trans}}"></i></a>
              </span>
            {% else %}
            	<span class="data">{{ announcement.createdTime|date('Y-m-d H:i:s') }}</span>
        	  {% endif %}

          </div>
          <div class="details">
            {{ announcement.content|raw }}
          </div>
        </div>

  	{% endfor %}
  {% else %}
		<div class="alert alert-edit">{{'暂无公告'|trans}}</div>
	{% endif %}
  </div>

{% endblock %}