{% extends "layout.html" %}

{% block title %}
    邵武一中新闻部摄影大赛-投票系统
{% endblock %}

{% block content %}

<div class="panel panel-primary">
  <div class="panel-heading">
    <h3 class="panel-title">{{pwobj.title}}</h3>
  </div>
  <div class="panel-body">
    <img class="img-responsive" src="{{pwurl}}{{pwobj.filename}}.{{pwobj.fileext}}" />
  </div>
</div>
<div class="panel panel-primary">
  <div class="panel-heading">
    <h3 class="panel-title">作品信息</h3>
  </div>
    <table class="table table-striped">
      <tbody>
        <tr>
          <th>标题</th>
          <td>{{pwobj.title}}</td>
        </tr>
        <tr>
          <th>目前票数</th>
          <td>{{pwobj.score}}</td>
        </tr>
        <tr>
          <th>作品描述</th>
          <td>{{pwobj.desc}}</td>
        </tr>
        <tr>
          <th>投票</th>
          {% if user.is_authenticated %}
          <td>
            {% if hadvoted %}
                您之前已经投票给作品<code>{{votedpw}}</code>了。不过如果您更喜欢这幅作品，您也可以
                <a href="{%url 'votephoto' pwobj.uuid %}" role="button" class="btn btn-xs btn-primary">放弃之前的选择，重新投票给本作品</a>
            {% else %}
                如果您喜欢这幅作品，请
                <a href="{%url 'votephoto' pwobj.uuid %}" role="button" class="btn btn-xs btn-primary">投票给本作品</a>
            {% endif %}
          </td>
          {% else %}
          <td>
            您需要<a href="{% url 'loginurl' %}">登陆</a>方可进行投票操作。
          </td>
          {% endif %}
        </tr>
        <tr>
          <th>导航</th>
          <td>
            <a href="javascript:window.history.back();" role="button" class="btn btn-xs btn-primary">返回前一页面</a>

            <a href="{%url 'pwflist' %}" role="button" class="btn btn-xs btn-primary">返回作品列表</a>
            
            {% if hasnext %}
                <a href="{%url 'pwview' nextuuid %}" role="button" class="btn btn-xs btn-primary">下一张作品</a>
            {% else %}
                <button class="btn btn-grey btn-xs">已是最后一张</button>
            {% endif %}
          </td>
        </tr>
      </tbody>
    </table>
</div>
{% endblock %}
