{% extends 'old-bootstrap-modal-layout.html.twig' %}

{% set modal_class = 'modal-lg' %}

{% block title %}{{'设置资讯图片'|trans}}{% endblock %}
{% block body %}

  <form id="aticel-picture-form" class="form-horizontal" method="post" enctype="multipart/form-data" action="{{ path('admin_article_show_upload') }}">

    {% if pictureUrl %}
    <div class="form-group">
      <div class="col-md-2 control-label"><b>{{'资讯图片'|trans}}</b></div>
      <div class="controls col-md-8 controls">
      	<img src="{{ asset(pictureUrl) }}" id="article-pic-crop" width="{{scaledSize.width}}" height="{{scaledSize.height}}" data-natural-width="{{ naturalSize.width }}" data-natural-height="{{ naturalSize.height }}" />
      </div>
    </div>
    {% endif %}

    <div class="form-group">
      <div class="col-md-2 control-label">
      </div>
      <div class="controls col-md-8 controls">
        <p class="help-block">{{'你可以上传JPG、GIF或PNG格式的文件,推荐尺寸754*424px,文件大小不能超过2M。'|trans}}</p>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-2 control-label"></div>
      <div class="controls col-md-8 controls">
        <a id="article-upload-btn" 
        data-goto-url="{{ path('admin_article_picture_crop') }}" 
        data-upload-token="{{ upload_token('tmp', 'image') }}"
        class="">{{'选择上传的文件'|trans}}</a>
        <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
      </div>
    </div>

  </form>

{% endblock %}


{% block footer %}
  <button type="button" class="btn btn-link pull-right" data-dismiss="modal">{{'取消'|trans}}</button>
  
  <script>app.load('article/picture-upload-modal');</script>
{% endblock %}