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

{% block title %}评价课程{% endblock %}
{% block body %}
  <form id="review-form" method="post" action="{{ path('course_review_create', {id:course.id}) }}">
      {{ web_macro.flash_messages() }}

    <div class="form-group clearfix">
      <div class="controls pull-left">
        请打分： <span id="my-course-rate" data-rating="{{ review.rating|default(0) }}" data-url="{{ path('course_review_create', {id: course.id}) }}" data-img-path="{{ app.request.basePath ~ '/assets/img/raty'}}" class="mrm"></span>
        {{ form_widget(form.rating) }}
      </div>

      <a id="list_reviews" class="btn btn-sm btn-link pull-right" data-url="{{ path('course_review_list', {id:course.id, isModal:true}) }}">查看全部评价</a>

    </div>

    <div class="form-group">
      <div class="controls">
        {{ form_widget(form.content, {attr:{class:'form-control', placeholder:'评价详细内容', 'data-display':'评价详细内容', rows:8}}) }}
      </div>
    </div>

    {{ form_rest(form) }}
    <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  </form>
{% endblock %}

{% block footer %}
    <button class="btn btn-link" data-dismiss="modal">取消</button>
    <button class="btn btn-primary" type="submit" data-toggle="form-submit" data-target="#review-form">保存</button>
  <script>
      app.load('course/review-modal');
  </script>
{% endblock %}