{% extends 'open-course-manage/layout.html.twig' %}
{% block title %}{{'课程图片'|trans}} - {{ parent() }}{% endblock %}
{% set side_nav = 'picture' %}
{% do script(['app/js/open-course-manage/picture-crop/index.js'])%}

{% block main %}

<div class="panel panel-default panel-col">
  <div class="panel-heading">
    {{'课程图片'|trans}}
  </div>

  <div id="course-picture-crop-form" class="panel-body">

      <div class="form-group clearfix">
        <div class="col-md-offset-2 col-md-8 controls">
          <img class="img-responsive" src="{{ filepath(pictureUrl) }}"
          id="course-picture-crop"
          width="{{scaledSize.width}}" height="{{scaledSize.height}}" data-natural-width="{{ naturalSize.width }}" data-natural-height="{{ naturalSize.height }}" />
          <div class="help-block">{{'提示：请选择图片裁剪区域。'|trans}}</div>
        </div>
      </div>

      <div class="form-group clearfix">
        <div class="col-md-offset-2 col-md-8 controls">
        {% if course.type == 'open' or course.type == 'liveOpen' %}
         <button class="btn btn-fat btn-primary upload-picture-btn"
          data-url="{{path('open_course_manage_picture_crop', {id: course.id})}}"
          data-goto-url="{{path('open_course_manage_picture',{id: course.id})}}"
          id="upload-picture-btn">{{'保存'|trans}}</button>
        {% else %}
         <button class="btn btn-fat btn-primary upload-picture-btn"
          data-url="{{path('course_manage_picture_crop', {id: course.id})}}"
          data-goto-url="{{path('course_manage_picture',{id: course.id})}}"
          id="upload-picture-btn">{{'保存'|trans}}</button>
        {% endif %}
          <a href="javascript:;" class="go-back btn btn-link">{{'重新选择图片'|trans}}</a>
        </div>
      </div>
  </div>
</div>

{% endblock %}

