<commit_before>{% extends 'base.html' %}
{% load i18n %}
{% load classroom_tags %}

{% block title %}{{ classroom.name }} {% trans "Class in Session" %}{% endblock title %}

{% block page-js %}
    <script type="text/javascript" src="{{ STATIC_URL }}js/classroom.js"></script>
    <script type="text/javascript">
      $(function() {
        subscribeClassRoomChannel("classroom_{{ classroom.pk }}", "{{ user.username }}");

        $(".collapse").collapse();

        $("#ask_question_form").submit(function(event){
           event.preventDefault();
           var form = $(this);
           $.ajax({
             type: "POST",
             url: "{% url question_ask classroom.pk %}",
             data: $(this).serializeArray(),
             success: function(data) {
               var d = $.parseJSON(data);
               if (d.success) {
                 form[0].reset();
                 // alert question
               } else {
                 // highlight error fields
                 console.log(d);
               }
             }
           });
           return false;
        });
      });
    </script>
    <script type="text/javascript">
  $(document).ready(function(){
    $("#ask_question_form").validate({
      rules: {
        subject: "required",
        content: "required"
      },
      highlight: function(label) {
          $(label).closest('.control-group').addClass('error');
      },
      success: function(label) {
        label
        .text('OK!').addClass('valid')
       .closest('.control-group').addClass('success');
      }
    });
  });
  </script>
{% endblock page-js %}

{% block page-css %}

{% endblock page-css %}

{% block content %}
  <section class="class">
    <div class="page-header">
      <h1>{{ classroom.name }}</h1>
    </div>
    <div class="row">

      <div class="span8">
        <div class="tabbable tabs-left">
          <ul class="nav nav-tabs">
            <li class="nav-header">Steps</li>
              {% for step in classroom.steps %}
                <li{% if forloop.first %} class='active'{%endif %}>
                  <a href="#step{{step.pk}}" data-toggle="tab">{{step.name}}</a>
                </li>
              {% endfor %}
          </ul>
          <div class="tab-content">
            {% for step in classroom.steps %}
              <div class="tab-pane{% if forloop.first %} active{%endif %}" id="step{{step.pk}}">
                <div class="well" style="padding: 8px 0; height: 450px;">
                 <p>{{ step.content|safe }}</p>
                </div>
              </div>
            {% endfor %}
          </div>
        </div>
      </div>

      <div class="span4">
        <div id="class-accordian" class="accordion">
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-questions" data-parent="#class-accordian" data-toggle="collapse">
                <i class='icon-trophy'></i> Top Questions
              </a>
            </div>
            <div id="class-questions" class="accordion-body collapse in">
              <div class="accordion-inner">{% top_questions classroom %}</div>
            </div>
          </div>
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-new" data-parent="#class-accordian" data-toggle="collapse">
                New Questions
              </a>
            </div>
            <div id="class-new" class="accordion-body collapse in">
              <div class="accordion-inner">
                <div id="max_new_question_count" style="display: none;">{{ latest_questions_count }}</div>
                {% latest_questions classroom user %}
              </div>
            </div>
          </div>
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-ask" data-parent="#class-accordian" data-toggle="collapse">
                <i class='icon-comment icon-large'></i> Ask Questions
              </a>
            </div>
            <div id="class-ask" class="accordion-body collapse in">
              <div class="accordion-inner">
                  {{ form.non_field_errors }}
                <form method="post" id="ask_question_form" action="{% url question_ask classroom.pk %}">
                  <fieldset>
                    <div class="control-group {%if form.subject.errors %}error{% endif %}">
                      <label class="control-label" for="subject">*Subject</label>
                      <div class="controls">
                        {{ question_form.subject }}
                        <span class="help-inline">{{form.subject.errors}}</span>
                      </div>
                    </div>
                    <div class="control-group {%if form.content.errors %}error{% endif %}">
                      <label class="control-label" for="content">*Question</label>
                      <div class="controls">
                        {{ question_form.content }}
                        <span class="help-inline">{{form.content.errors}}</span>
                      </div>
                    </div>
                    <div class="form-actions">
                      <button type="submit" class="btn btn-primary">Ask Question</button>
                      <button type="reset" class="btn">Clear</button>
                    </div>
                  </fieldset>
                  {% csrf_token %}
                </form>
              </div>
            </div>
          </div>
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-status" data-parent="#class-accordian" data-toggle="collapse">
                Status Information
              </a>
            </div>
            <div id="class-status" class="accordion-body collapse in">
              <div class="accordion-inner">Status information about class</div>
            </div>
          </div>
        </div>
      </div>

    </div>

    <div class="row">
      <div class="span8">
        <h3>Scratchpad</h3>

      </div>
    </div>
  </section>
{% endblock content %}
<commit_msg>moved scratchpad section below class steps so not affected by accordian, also cleaned up js<commit_after>{% extends 'base.html' %}
{% load i18n %}
{% load classroom_tags %}

{% block title %}{{ classroom.name }} {% trans "Class in Session" %}{% endblock title %}

{% block page-js %}
    <script type="text/javascript" src="{{ STATIC_URL }}js/classroom.js"></script>
    <script type="text/javascript">
      $(function() {
        subscribeClassRoomChannel("classroom_{{ classroom.pk }}", "{{ user.username }}");

        $(".collapse").collapse();

        $("#ask_question_form").submit(function(event){
           event.preventDefault();
           var form = $(this);
           $.ajax({
             type: "POST",
             url: "{% url question_ask classroom.pk %}",
             data: $(this).serializeArray(),
             success: function(data) {
               var d = $.parseJSON(data);
               if (d.success) {
                 form[0].reset();
                 // alert question
               } else {
                 // highlight error fields
                 console.log(d);
               }
             }
           });
           return false;
        });

        $("#ask_question_form").validate({
          rules: {
            subject: "required",
            content: "required"
          },
          highlight: function(label) {
              $(label).closest('.control-group').addClass('error');
          },
          success: function(label) {
            label
            .text('OK!').addClass('valid')
           .closest('.control-group').addClass('success');
          }
        });
      });
    </script>
{% endblock page-js %}

{% block page-css %}

{% endblock page-css %}

{% block content %}
  <section class="class">
    <div class="page-header">
      <h1>{{ classroom.name }}</h1>
    </div>
    <div class="row">

      <div class="span8">
        <div class="tabbable tabs-left">
          <ul class="nav nav-tabs">
            <li class="nav-header">Steps</li>
              {% for step in classroom.steps %}
                <li{% if forloop.first %} class='active'{%endif %}>
                  <a href="#step{{step.pk}}" data-toggle="tab">{{step.name}}</a>
                </li>
              {% endfor %}
          </ul>
          <div class="tab-content">
            {% for step in classroom.steps %}
              <div class="tab-pane{% if forloop.first %} active{%endif %}" id="step{{step.pk}}">
                <div class="well" style="padding: 8px 0; height: 450px;">
                 <p>{{ step.content|safe }}</p>
                </div>
              </div>
            {% endfor %}
          </div>
        </div>

        <h3>Scratchpad</h3>

      </div>

      <div class="span4">
        <div id="class-accordian" class="accordion">
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-questions" data-parent="#class-accordian" data-toggle="collapse">
                <i class='icon-trophy'></i> Top Questions
              </a>
            </div>
            <div id="class-questions" class="accordion-body collapse in">
              <div class="accordion-inner">{% top_questions classroom %}</div>
            </div>
          </div>
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-new" data-parent="#class-accordian" data-toggle="collapse">
                New Questions
              </a>
            </div>
            <div id="class-new" class="accordion-body collapse in">
              <div class="accordion-inner">
                <div id="max_new_question_count" style="display: none;">{{ latest_questions_count }}</div>
                {% latest_questions classroom user %}
              </div>
            </div>
          </div>
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-ask" data-parent="#class-accordian" data-toggle="collapse">
                <i class='icon-comment icon-large'></i> Ask Questions
              </a>
            </div>
            <div id="class-ask" class="accordion-body collapse in">
              <div class="accordion-inner">
                  {{ form.non_field_errors }}
                <form method="post" id="ask_question_form" action="{% url question_ask classroom.pk %}">
                  <fieldset>
                    <div class="control-group {%if form.subject.errors %}error{% endif %}">
                      <label class="control-label" for="subject">*Subject</label>
                      <div class="controls">
                        {{ question_form.subject }}
                        <span class="help-inline">{{form.subject.errors}}</span>
                      </div>
                    </div>
                    <div class="control-group {%if form.content.errors %}error{% endif %}">
                      <label class="control-label" for="content">*Question</label>
                      <div class="controls">
                        {{ question_form.content }}
                        <span class="help-inline">{{form.content.errors}}</span>
                      </div>
                    </div>
                    <div class="form-actions">
                      <button type="submit" class="btn btn-primary">Ask Question</button>
                      <button type="reset" class="btn">Clear</button>
                    </div>
                  </fieldset>
                  {% csrf_token %}
                </form>
              </div>
            </div>
          </div>
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordian-toggle" href="#class-status" data-parent="#class-accordian" data-toggle="collapse">
                Status Information
              </a>
            </div>
            <div id="class-status" class="accordion-body collapse in">
              <div class="accordion-inner">Status information about class</div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </section>
{% endblock content %}

{'fraction_non_alphanumeric': 0.1608301947271416, 'fraction_numerical': 0.002323904158987098, 'mean_word_length': 1.579578338156263, 'pattern_counts': {'":': 0, '<': 229, '<?xml version=': 0, '>': 229, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '369882', 'n_tokens_mistral': 3524, 'n_tokens_neox': 3246, 'n_words': 670}