{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set script_controller = 'content/list' %}

{% set menu = 'admin_operation_content' %}
{% set type = app.request.get('type') %}
{% set typeName = dict('contentType')[type] %}

{% block page_buttons %}  	
	<button class="btn btn-success btn-sm pull-right" id="content-add-btn" type="button" data-target="#modal" data-toggle="modal" data-url="{{ path('admin_content_create', {type: type}) }}"> 添加{{ typeName }}</button>
{% endblock %}

{% block main %}

<form class="well well-sm form-inline">
	<div class="form-group">
		<select class="form-control" name="status">
		  {{ select_options(dict('contentStatus'), app.request.query.get('status'), '--所有状态--') }}
		</select>
	</div>
	<div class="form-group">
		<input class="form-control" name="keywords" type="text" placeholder="关键词" value="{{ app.request.query.get('keywords') }}">
	</div>
		<input type="hidden" name="type" value="{{ type }}">
	<button class="btn btn-primary" type="submit">搜索</button>

</form>

<table class="table table-hover" id="content-table">
	<thead>
		<tr>
			<th width="50%">标题</th>
			<th>类型</th>
			<th>状态</th>
			<th>发布时间/人</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{% if contents %}
			{% for content in contents %}
			  {% set user = users[content.userId] %}
			  {% set category = categories[content.categoryId]|default(null) %}
			  {% include 'TopxiaAdminBundle:Content:content-tr.html.twig' %}
			{% endfor %}
		{% else %}
			<tr><td colspan="20"><div class="empty">暂无页面记录</div></td></tr>
		{% endif %}
	</tbody>
</table>

{{ web_macro.paginator(paginator) }}

{% endblock %}