{% extends 'activity/activity-form-layout.html.twig' %}

{% do script(['libs/es-ckeditor/ckeditor.js', 'app/js/activity-manage/text/index.js'], 300) %}

{% block activity_content %}
  <div class="form-group">

    <div class="col-sm-2 control-label">
      <label for="text-content-field" class="control-label-required">{{ '内容'|trans }}</label>
    </div>
    <div class="col-sm-10">
      {% if draft %}
        <a id="see-draft-btn" class="link-primary text-12 js-continue-edit" data-content="{{ draft.content }}">
          {{'您有一段自动保存内容，请点击继续编辑'|trans}}
        </a>
      {% endif %}
      <textarea class="form-control type-hidden js-text" id="text-content-field" name="content"
        data-image-upload-url="{{ path('editor_upload', {token:upload_token('course')}) }}"
        data-flash-upload-url="{{ path('editor_upload', {token:upload_token('course', 'flash')}) }}"
        data-image-download-url="{{ path('editor_download', {token:upload_token('course')}) }}"
        data-save-draft-url="{{ path('course_text_activity_auto_save', {courseId: courseId, activityId: activity.id|default(0)}) }}"
      >
        {{ activity.content|default('') }}
      </textarea>
    </div>
  </div>
{% endblock %}

{% block activity_finish %}
  <div class=" form-group">
    <div class="col-sm-2 control-label">
      <label for="condition-select">{{ '完成条件'|trans }}</label>
    </div>
    <div class="col-sm-4 form-control-static">
      观看时长
      <input type="hidden" id="condition-select" name="finishType">
      {#<select class="form-control" id="condition-select" name="finishType">
        <option value="time" {% if text.finishType|default('end') == 'time' %}selected{% endif %}>观看时长</option>
      </select>#}
    </div>
  </div>
  <div class=" form-group" id="condition-group">
    <div class="col-sm-2 control-label">
      <label for="finishDetail">{{ '至少观看'|trans }}</label>
    </div>
    <div class="col-sm-4">
      <input id="finishDetail" class="form-control" type="text" name="finishDetail" value="{{ text.finishDetail|default(1) }}">
    </div>
    <div class="col-sm-4">
      <p class="form-control-static">分钟</p>
    </div>
  </div>
{% endblock %}