Optimize JS delivery, toss unused files
authorCharles Connell <charles@connells.org>
Thu, 10 Apr 2014 19:31:52 +0000 (15:31 -0400)
committerCharles Connell <charles@connells.org>
Thu, 10 Apr 2014 19:31:52 +0000 (15:31 -0400)
karmaworld/templates/base.html
karmaworld/templates/courses/course_detail.html
karmaworld/templates/courses/course_list.html
karmaworld/templates/notes/note_detail.html
karmaworld/templates/notes/search_results.html
karmaworld/templates/partial/filepicker.html
karmaworld/templates/quizzes/keyword_edit.html [deleted file]
karmaworld/templates/quizzes/quiz.html [deleted file]

index d29ef219935bf861a3658a541c4ec0a2da55ea01..9c0c11cba34227c78c03e61318388a7b18e716ec 100644 (file)
   <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
   <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/global.css">
 
-  <script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
-
-  <!-- block pagescripts -->
-  {% block pagescripts %}
-  {% endblock %}
-  <!-- end block pagescripts -->
-
   <!-- block pagestyle -->
   {% block pagestyle %}
   {% endblock %}
@@ -45,6 +38,7 @@
   {% include 'footer.html' %}
   <!-- end include footer-->
 
+  <script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
   <script src="//code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
   <script type="text/javascript" src="//use.typekit.net/pnc8diw.js"></script>
   <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
       $(document).foundation();
     });
   </script>
-  <!-- block bodyscripts -->
-  {% block bodyscripts %}
+  <!-- block pagescripts -->
+  {% block pagescripts %}
   {% endblock %}
-  <!-- end block bodyscripts -->
+  <!-- end block pagescripts -->
 
 </body>
 </html>
index 57304a083738e4d46cc4bc6c60a3d8e8bcddcffa..821d5179d95574680476ea1659f2734cb842c512 100644 (file)
     var course_edit_url = "{% url 'edit_course' course.id %}";
     var dataTable_sDom = '<"top">rt<"bottom"p><"clear">';
   </script>
-{% endblock %}
-
-{% block pagestyle %}
-  <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/note_course_pages.css">
-  <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/datatables-css/jquery.dataTables.css">
-{% endblock %}
-
-{% block bodyscripts %}
   <script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
   <script src="{{ STATIC_URL }}js/course.js"></script>
   <script src="{{ STATIC_URL }}js/course-detail.js" ></script>
   <script src="{{ STATIC_URL }}js/note-list.js" ></script>
+  <script src="{{ STATIC_URL }}js/filepicker.js"></script>
 {% endblock %}
 
+{% block pagestyle %}
+  <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/note_course_pages.css">
+  <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/datatables-css/jquery.dataTables.css">
+{% endblock %}
 
 {% block title %}
   Share Notes for {{ course.name }} | {{ course.school.name }}
index 8a262ee0e26b11ce7b84bb885bf0891ffad8376d..a8aaece36f5d08243718204eb40d8a4f77e398d2 100644 (file)
@@ -24,9 +24,6 @@
   <script src="{{ STATIC_URL }}js/course.js"></script>
   <script src="{{ STATIC_URL }}js/add-course.js"></script>
   <script src="{{ STATIC_URL }}js/course-list.js"></script>
-{% endblock %}
-
-{% block bodyscripts %}
   <script src="//cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/jquery.dataTables.min.js"></script>
 {% endblock %}
 
index 977ac8e88795ff48ca6659234511c21950911ad6..8122061bc5bc988ed1a9d09846d064b1bd28c075 100644 (file)
@@ -26,9 +26,6 @@
     var empty_js = "{{ STATIC_URL }}js/empty.js";
   </script>
   <script src="{{ STATIC_URL }}js/setup-ajax.js"></script>
-{% endblock %}
-
-{% block bodyscripts %}
   <script src="{{ STATIC_URL }}js/note-detail.js" ></script>
   <script src="{{ STATIC_URL }}js/pxem.jQuery.js"></script>
   <script src="//cdnjs.cloudflare.com/ajax/libs/marked/0.3.1/marked.min.js" ></script>
index 6c59cacdf30a12e183b87ac05ba5fd2e537ce7b4..b82ec12f378d092d06281053cc613a5d6be999c8 100644 (file)
@@ -10,7 +10,7 @@
   <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/note_course_pages.css">
 {% endblock %}
 
-{% block bodyscripts %}
+{% block pagescripts %}
   <script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
   <script src="{{ STATIC_URL }}js/note-list.js"></script>
   <script>
index 00424eb74f1d3f3b666b5d7aab5a5349ffdfd349..72278ef4d4c4f717f2628e809743fe55cea9e0d1 100644 (file)
@@ -75,7 +75,5 @@
       var user_is_authenicated = false;
     {% endif %}
   </script>
-  <script src="{{ STATIC_URL }}js/filepicker.js"></script>
-
 
 </section>
diff --git a/karmaworld/templates/quizzes/keyword_edit.html b/karmaworld/templates/quizzes/keyword_edit.html
deleted file mode 100644 (file)
index 0e6bff6..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-{% extends "base.html" %}
-{% load url from future %}
-{% load account %}
-
-{% block pagestyle %}
-  <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/quiz.css">
-{% endblock %}
-
-{% block bodyscripts %}
-  <script src="{{ STATIC_URL }}js/keyword.js"></script>
-{% endblock %}
-
-{% block title %}
-  {{ note.name }}
-{% endblock %}
-
-{% block raw_content %}
-  <section id="dashboard_content">
-    <div id="stats_container" class="hero_gradient_bar">
-
-      <div class="row">
-        <div class="twelve columns header_subhead">
-          <a href="{{ note.get_absolute_url}} ">
-            <i class="fa fa-arrow-left"></i>&nbsp;back to {{ note.name }}
-          </a>
-        </div>
-      </div>
-
-      <div class="row">
-        <div class="small-10 columns small-centered center header_title">
-          <p>Define keywords for the note<br/>
-          {{ note.name }}</p>
-        </div>
-      </div>
-
-      <div class="row">
-        <div class="small-10 columns small-centered center show-for-large-up">
-          <p>(Press <i class="fa fa-plus"></i> button or hit tab in the last definition box for more rows)</p>
-        </div>
-      </div>
-
-    </div>
-
-    <div id="activity_container">
-      <div class="row">
-        <div class="small-12 columns">
-          <form id="keyword-form" action="{% url 'keyword_edit' note.slug %}" method="post">
-            {% csrf_token %}
-            {{ form.management_form }}
-            <div class="hide" id="keyword-form-prototype">
-              <div class="row keyword-form-row">
-                <div class="small-12 large-4 columns">
-                  {{ prototype_form.keyword }}
-                </div>
-                <div class="small-12 large-8 columns">
-                  {{ prototype_form.definition }}
-                  {{ formprototype_form_row.id }}
-                </div>
-              </div>
-              <hr class="hide-for-large-up" />
-            </div>
-            <div id="keyword-form-rows">
-              {% for form_row in form %}
-                <div class="row keyword-form-row">
-                  <div class="small-12 large-4 columns">
-                    {{ form_row.keyword }}
-                  </div>
-                  <div class="small-12 large-8 columns">
-                    {{ form_row.definition }}
-                    {{ form_row.id }}
-                  </div>
-                </div>
-                <hr class="hide-for-large-up" />
-              {% endfor %}
-            </div>
-            <div id="row">
-              <div class="small-1 columns">
-                <i id="add-row-btn" class="fa fa-plus fa-2x"></i>
-              </div>
-              <div class="small-10 large-11 columns center">
-                <button type="submit" name="action">Save</button>
-              </div>
-            </div>
-          </form>
-        </div>
-      </div>
-    </div>
-
-
-
-  </section>
-
-{% endblock %}
diff --git a/karmaworld/templates/quizzes/quiz.html b/karmaworld/templates/quizzes/quiz.html
deleted file mode 100644 (file)
index 2d53cff..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-{% extends "base.html" %}
-{% load url from future %}
-{% load account %}
-
-{% block pagestyle %}
-  <link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/quiz.css">
-{% endblock %}
-
-{% block bodyscripts %}
-  <script>
-    var csrf_token = "{{ csrf_token }}";
-    var num_quiz_questions = {{ questions|length }};
-    var current_question_index = 0;
-    var check_answer_url = '{% url 'quiz_answer' %}';
-  </script>
-  <script src="{{ STATIC_URL }}js/setup-ajax.js"></script>
-  <script src="{{ STATIC_URL }}js/quiz.js"></script>
-{% endblock %}
-
-{% block title %}
-  {{ quiz.name }}
-{% endblock %}
-
-{% block raw_content %}
-  <section id="dashboard_content">
-    <div id="stats_container" class="hero_gradient_bar">
-      <div class="row">
-        <div class="twelve columns header_subhead">
-          <a href="{{ quiz.note.get_absolute_url}} ">
-            <i class="fa fa-arrow-left"></i>&nbsp;back to {{ quiz.note.name }}
-          </a>
-        </div>
-      </div>
-      <div class="row">
-        <div class="small-10 columns small-centered center header_title">
-          {{ quiz.name }}
-      </div>
-        </div>
-      <div class="row">
-        <div class="small-12 medium-8 large-4 columns small-centered">
-          <div class="row">
-            <div class="small-6 columns center  stat_lead_in">
-              you've passed
-            </div>
-            <div class="small-6 columns center  stat_lead_in">
-              out of
-            </div>
-          </div>
-          <div class="row">
-            <div id="num-correct" class="small-6 columns center  stat_number stat_earned">
-              0
-            </div>
-            <div class="small-6 columns  center stat_number stat_uploaded">
-              {{ questions|length }}
-            </div>
-          </div>
-          <div class="row">
-            <div class="small-6 columns center  stat_object stat_earned">
-              questions
-            </div>
-            <div class="small-6 columns center  stat_object stat_uploaded">
-              total
-            </div>
-          </div>
-        </div>
-      </div>
-
-    </div>
-
-    <div id="activity_container">
-
-      {% if not questions %}
-        <div class="row">
-          <div id="no_activity" class="small-10 columns small-centered center">
-            <h4>This quiz has no questions.</h4>
-          </div>
-        </div>
-      {% endif %}
-
-      {% for item in questions %}
-        {% with question=item.1 %}
-          <div class="row hide question"
-               data-question-id="{{ question.id }}"
-               data-question-index="{{ forloop.counter0 }}"
-               data-question-type="{{ item.0 }}">
-            <div class="small-10 large-6 columns small-centered">
-              {% if 'MultipleChoiceQuestion' in item.0 %}
-                <p class="question-text">{{ question.question_text }}</p>
-                <ul>
-                  {% for choice in question.choices.all %}
-                    <li><label for="choice_{{ question.id }}_{{ choice.id }}">
-                          <input id="choice_{{ question.id }}_{{ choice.id }}"
-                                 type="radio"
-                                 name="multiple_choice_{{ question.id }}"
-                                 value="{{ choice.id }}"
-                                 class="multiple-choice-choice"
-                                 data-choice-id="{{ choice.id }}">
-                          {{ choice.text }}</label></li>
-                  {% endfor %}
-                </ul>
-              {% endif %}
-
-              {% if 'TrueFalseQuestion' in item.0 %}
-                <p class="question-text">{{ question.text }}</p>
-                <ul>
-                  <li><label for="choice_{{ question.id }}_true">
-                        <input id="choice_{{ question.id }}_true"
-                               type="radio"
-                               name="true_false_{{ question.id }}"
-                               class="true-false-choice"
-                               value="true">
-                          True</label></li>
-                  <li><label for="choice_{{ question.id }}_false">
-                        <input id="choice_{{ question.id }}_false"
-                               type="radio"
-                               name="true_false_{{ question.id }}"
-                               class="true-false-choice"
-                               value="false">
-                          False</label></li>
-                </ul>
-              {% endif %}
-
-              {% if 'FlashCardQuestion' in item.0 %}
-                <p class="question-text">{{ question.definition_side }}</p>
-                <input type="text"
-                       name="flash_card_{{ question.id }}"
-                       id="text_{{ question.id }}">
-              {% endif %}
-
-              <div class="row">
-                <div class="small-4 columns">
-                  <button class="prev-question {% if forloop.first %}disabled{% endif %}">Previous</button>
-                </div>
-                <div class="small-4 columns">
-                  <button class="check-answer">Check Answer</button>
-                </div>
-                <div class="small-4 columns">
-                  <button class="next-question {% if forloop.last %}disabled{% endif %}">Next</button>
-                </div>
-              </div>
-
-            </div>
-          </div>
-        {% endwith %}
-      {% endfor %}
-
-    </div>
-
-
-
-  </section>
-
-{% endblock %}