{% extends "base.html" %}
{% block title %} perfil | {{super}}{%endblock %}

{% block ver_perfil%}
"{%url ver_perfil informacion.asignatura.slug %}"
{% endblock%}
{%block escoge-asignatura%}
  {{informacion.asignatura.slug}}
{%endblock%}

{% block navbar%}
{%include "app/include/menu.html"%}
{%endblock%}


{% block content %}

      <h1>Tarea {{tarea.actividades.name}} </h1>
      <hr>


<div class="row-fluid">
      <div class="span8" id="cuestionario">
            <div class="cuestionario">
                {%if tarea %}
                  <form action="{%url realizar_tarea informacion.asignatura.slug tarea.actividades.id %}" method='POST' id="tareaForm">
                  {% csrf_token %}
       
                  {% for pregunta in preguntas %}
                  <div class="pregunta">
                      <h2><span class="num">{{ forloop.counter }}</span></h2><h3>{{pregunta.text}}</h3>
                            <p>

                              {% ifnotequal pregunta.type 1 %}

      
                               {% if pregunta.type == 2 or pregunta.type == 4  or pregunta.type == 5 %}
                                <div class="btn-group" data-toggle="buttons-radio">
                               {%else%}
                                <div class="btn-group" data-toggle="buttons-checkbox">
                               {%endif%}
                                {% for respuesta in pregunta.tarea_eleccion_pregunta.all%}
                                    {% if respuesta.correct and user.usuario.rol == 'profesor'%}
                                    <label class="btn btn-primary">
                                      <input type="radio" value="{{respuesta.name}}" class="btn btn-primary" style="color:yellow;" name="hash[{{pregunta.nr}}]"/>
                                      {{respuesta.name}}
                                    </label>

                                    {% else %}
                                    <label class="btn btn-primary">
                                      <input type="radio" value="{{respuesta.name}}" class="btn btn-primary" style="color:yellow;" name="hash[{{pregunta.nr}}]"/>
                                      {{respuesta.name}}
                                    </label>
                                    {%endif%}
                                {% empty %}
                                  Sin preguntas
                                {% endfor%}
                                </div>
                              </p>
                        {% else %}
                            <p>
                              <div class="btn-group">
                                <textarea class="x-large" style="width:100%;"cols="100" rows="10" value="" name="hash[{{pregunta.nr}}]"></textarea>
                              </div>

                            </p>


                        {%endifnotequal%}
                        </div>

                {% endfor%}
                {% endif %}
                  </div>
            </div>
          </p></div>
              <input type="submit" class="btn btn-primary btn-large offset2" value="Enviar" id="sendButton" />
          </form>
          <div id="SUCCESS_FORM"></div>
          </div>

      </div>
</div>
      

{% endblock%}

{% block extra_js%}
<script type="text/javascript">

$(document).ready(function(){



});

$('input:radio').click(function(){
});

$("form").submit(function(event) {
    //event.preventDefault();

    $.ajax({
        type: $(this).attr('method'),
        url: $(this).attr('action'),
        data: $(this).serialize(),
        dataType: "text",
        success: function(response) {
                    $('#SUCCESS_FORM).html(response)');
                }
            });
            return false;
        });
    });
</script>


{%endblock%}