]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/ask.html
fix for OSQA-185 - link to wikipedia isn't localizable. It's not really a link to...
[osqa.git] / forum / skins / default / templates / ask.html
index 083b01d92a438a984778d5e4c230afc7a561bb04..87453314745a5eb18f08944c96c62450d44e0bfa 100644 (file)
@@ -4,22 +4,23 @@
 {% load extra_tags %}
 {% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %}
 {% block forejs %}
-        <script type='text/javascript' src='{% media  "/media/js/com.cnprog.editor.js" %}'></script>
-        <script type='text/javascript' src='{% media  "/media/js/com.cnprog.post.js" %}'></script>
-        <script type='text/javascript' src='{% media  "/media/js/jquery.validate.pack.js" %}'></script>
         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>
         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.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">
+                <a href="%URL%"><div class="answer-votes">%SCORE%</div></a>
+                <div class="answer-link">
+                    <a class="question-hyperlink" href="%URL%" title="%SUMMARY%">%TITLE%</a>
+                </div>
+            </div>
+        </script>
         <script type="text/javascript">
-        $().ready(function(){
+        $(function(){
             //set current module button style
             $("#nav_ask").attr('className',"on");
             $('#editor').TextAreaResizer();
 
-            //highlight code synctax when editor has new text
-            $("#editor").typeWatch({highlight: false, wait: 3000,
-                             captureLength: 5, callback: lanai.highlightSyntax});
-
             //toggle preview of editor
                        //todo remove copy-paste
             var display = true;
             });
 
             //Tags autocomplete action
-            var tags = {{ tags|safe }};
-               $("#id_tags").autocomplete(tags, {
+               $("#id_tags").autocomplete("/matching_tags", {
                 minChars: 1,
                        matchContains: true,
                 max: 20,
                 multiple: true,
                 multipleSeparator: " ",
-                       formatItem: function(row, i, max) {
+                       /*formatItem: function(row, i, max) {
                                return row.n + " ("+ row.c +")";
                        },
                 formatResult: function(row, i, max){
                     return row.n;
+                }*/
+                formatItem: function(row, i, max, value) {
+                    return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
+                },
+
+                formatResult: function(row, i, max, value){
+                    return row[0];
                 }
 
             });
-
-            setupFormValidation("#fmask", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
-            lanai.highlightSyntax();
-
         });
+
+        var related_questions_url = "{% url related_questions %}";
         </script>
+        <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
 {% endblock %}
 
 {% block content %}
                     {{ form.title.help_text }}
                 </div>
             </div>
-
+            <div id="ask-related-questions"></div>
             <div class="form-item">
                 <div id="wmd-button-bar" class="wmd-panel"></div>
-                {{ form.text }}
-
+                {{ form.text }} {{ form.text.errors }}
                 <div class="preview-toggle">
                     <table width="100%">
                         <tr>
                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
                             </td>
                             {% if settings.WIKI_ON %}
-                            <td style="text-align:right;">
-                                {{ form.wiki }} <span style="font-weight:normal;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
+                            <td class="tright">
+                                {{ form.wiki }} <span class="help_text" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
                             </td>
                             {% endif %}
                         </tr>
                                {{ form.tags.help_text }}
                        </p>
             {% if not request.user.is_authenticated %}
-            <input type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
+            <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
                        {% else %}
-            <input type="submit" value="{% trans "Ask your question" %}" class="submit" />
+            <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" />
             {% endif %}
         </form>
     </div>