]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/ask.html
Merge pull request #2 from udacity/update_django
[osqa.git] / forum / skins / default / templates / ask.html
index b027ce49bf7b8f042a4c26131331496fdcb1731d..0c7b25544a3d6e05fc09a354a712a973ad621ec7 100644 (file)
@@ -5,6 +5,7 @@
 {% block forejs %}
         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>
         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>
 {% block forejs %}
         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>
         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>
+        <script type='text/javascript' src='{% media  "/media/js/html_sanitizer.js" %}'></script>
         <link rel="stylesheet" type="text/css" href="{% media  "/media/js/wmd/wmd.css" %}" />
         <script type="text/html" id="question-summary-template">
             <div class="answer-summary">
         <link rel="stylesheet" type="text/css" href="{% media  "/media/js/wmd/wmd.css" %}" />
         <script type="text/html" id="question-summary-template">
             <div class="answer-summary">
@@ -21,7 +22,7 @@
             $('#editor').TextAreaResizer();
 
             //toggle preview of editor
             $('#editor').TextAreaResizer();
 
             //toggle preview of editor
-                       //todo remove copy-paste
+            //todo remove copy-paste
             var display = true;
             var txt = "[{% trans "hide preview" %}]";
             $('#pre-collapse').text(txt);
             var display = true;
             var txt = "[{% trans "hide preview" %}]";
             $('#pre-collapse').text(txt);
             });
 
             //Tags autocomplete action
             });
 
             //Tags autocomplete action
-               $("#id_tags").autocomplete("/matching_tags/", {
+            $("#id_tags").autocomplete('{% url "matching_tags" %}', {
                 minChars: 1,
                 minChars: 1,
-                       matchContains: true,
-                max: 20,
+                matchContains: true,
+                max: 10,
                 multiple: true,
                 multipleSeparator: " ",
                 multiple: true,
                 multipleSeparator: " ",
-
-                       /*
-                       formatItem: function(row, i, max) {
-                               return row.n + " ("+ row.c +")";
-                       },
-                formatResult: function(row, i, max){
-                    return row.n;
-                }
-                */
+                highlightItem: true,
+                scroll: true,
+                scrollHeight: 300,
 
                 formatItem: function(row, i, max, value) {
 
                 formatItem: function(row, i, max, value) {
-                    return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
+                    return row[1] + " (" + row[2] + ")";
                 },
 
                 formatResult: function(row, i, max, value){
                 },
 
                 formatResult: function(row, i, max, value){
-                    return row[0];
+                    return row[1];
                 }
 
             });
                 }
 
             });
         }
         window.addEventListener('beforeunload', beforeUnload, true);
 
         }
         window.addEventListener('beforeunload', beforeUnload, true);
 
-        var related_questions_url = "{% url related_questions %}";
+        var related_questions_url = '{% url "related_questions" %}';
         </script>
         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
 {% endblock %}
 
 {% block content %}
 <div id="main-bar" class="headNormal">
         </script>
         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
 {% endblock %}
 
 {% block content %}
 <div id="main-bar" class="headNormal">
-       {% trans "Ask a question" %}
+    {% trans "Ask a question" %}
 </div>
 <div id="main-body" class="ask-body">
     <div id="askform">
         <form id="fmask" action="" method="post" accept-charset="utf-8">
 </div>
 <div id="main-body" class="ask-body">
     <div id="askform">
         <form id="fmask" action="" method="post" accept-charset="utf-8">
-                       {% if not request.user.is_authenticated %}
+            {% csrf_token %}
+            {% if not request.user.is_authenticated %}
             <div class="message">
                 <span class="strong big">{% trans "You are welcome to start submitting your question anonymously." %}</span>
                 <p>{% blocktrans %}
             <div class="message">
                 <span class="strong big">{% trans "You are welcome to start submitting your question anonymously." %}</span>
                 <p>{% blocktrans %}
                 {% if not request.user.email_valid_and_can_ask %}
                     <div class="message">
                         {% blocktrans %}Remember, your question will not be published until you validate your email.{% endblocktrans %}
                 {% if not request.user.email_valid_and_can_ask %}
                     <div class="message">
                         {% blocktrans %}Remember, your question will not be published until you validate your email.{% endblocktrans %}
-                        <a href="{% url send_validation_email %}">{% trans "Send me a validation link." %}</a>
+                        <a href="{% url "send_validation_email" %}">{% trans "Send me a validation link." %}</a>
                     </div>
                 {% endif %}
                     </div>
                 {% endif %}
-                       {% endif %}
+            {% endif %}
             <div class="form-item">
                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
                 {{ form.title }} {{ form.title.errors }}
             <div class="form-item">
                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
                 {{ form.title }} {{ form.title.errors }}
                        <p class="title-desc">
                                {{ form.tags.help_text }}
                        </p>
                        <p class="title-desc">
                                {{ form.tags.help_text }}
                        </p>
+                       
+            {% if form.recaptcha %}
+            <div class="question-captcha" style="float: left">
+               {{ form.recaptcha.errors }}
+               {{ form.recaptcha }}
+            </div>
+            <div class="clear"></div>
+            {% endif %}
+                       
             {% if not request.user.is_authenticated %}                                                                        
             <input name="ask" type="button" value="{% trans "Login/signup to post your question" %}" class="submit" onclick="submitClicked(event, this.form)"/>
                        {% else %}
             {% if not request.user.is_authenticated %}                                                                        
             <input name="ask" type="button" value="{% trans "Login/signup to post your question" %}" class="submit" onclick="submitClicked(event, this.form)"/>
                        {% else %}