{% extends "base.html" %}
{% load static %}

{% block title %}
{{newName}}
{% endblock %}

{% block content %}
<link href="{% static 'css/news.css' %}" rel="stylesheet">
<!-- 广告横幅 -->
<div class="container-fluid">
    <div class="row"><img class="img-responsive model-img" src="{% static 'img/new.jpg' %}"></div>
</div>
<!-- 主体内容 -->
<div class="container">
    <div class="row row-3">
        <!-- 侧边导航栏 -->
        <div class="col-md-3">
            <div class="model-title">新闻动态</div>
            <div class="model-list">
                <ul class="list-group">
                    <li class="list-group-item" id='company'><a href="{% url 'newsApp:news' 'company' %}">企业要闻</a></li>
                    <li class="list-group-item" id='industry'><a href="{% url 'newsApp:news' 'industry' %}">行业新闻</a></li>
                    <li class="list-group-item" id='notice'><a href="{% url 'newsApp:news' 'notice' %}">通知公告</a></li>
                </ul>
            </div>
        </div>
        <!-- 说明文字和图片 -->
        <div class="col-md-9">
            <div class="model-details-title">
                {{newName}}
                <div class="col-md-7 hidden-xs model-details-title-search">
                    <form method="get" action="{% url 'haystack_search' %}">
                        {% csrf_token %}
                        <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="请输入关键词" required />
                            <span class="input-group-btn">
                                <input type="submit" class="btn btn-default" value="查询" />
                            </span>
                        </div>
                    </form>
                </div>
            </div>
            <div class="model-details">
                {% for mynew in newList %}
                <div class="news-model"><img src="{% static 'img/newsicon.gif' %}">
                    <a href="{% url 'newsApp:newDetail' mynew.id %}"><b>{{mynew.title}}</b></a>
                    <span>【{{mynew.publishDate|date:"Y-m-d"}}】</span>
                    <p>
                        <!-- 添加新闻简要说明 -->
                        {{mynew.mytxt|truncatechars:"110"}}...
                    </p>
                </div>
                {% endfor %}

                {% if pageData %}
                <div class="paging">
                    <ul id="pages" class="pagination">
                        {% if pageData.first %}
                        <li><a href="?page=1">1</a></li>
                        {% endif %}
                        {% if pageData.left %}
                        {% if pageData.left_has_more %}
                        <li><span>...</span></li>
                        {% endif %}
                        {% for i in pageData.left %}
                        <li><a href="?page={{i}}">{{i}}</a></li>
                        {% endfor %}
                        {% endif %}
                        <li class="active"><a href="?page={{pageData.page}}">{{pageData.page}}</a></li>
                        {% if pageData.right %}
                        {% for i in pageData.right %}
                        <li><a href="?page={{i}}">{{i}}</a></li>
                        {% endfor %}
                        {% if pageData.right_has_more %}
                        <li><span>...</span></li>
                        {% endif %}
                        {% endif %}
                        {% if pageData.last %}
                        <li><a href="?page={{pageData.total_pages}}">{{pageData.total_pages}}</a></li>
                        {% endif %}
                    </ul>
                </div>
                {% endif %}
            </div>
        </div>
    </div>
</div>
{% endblock %}