]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/ask.html
OSQA-600, notification templates unicode fixes.
[osqa.git] / forum / skins / default / templates / ask.html
index 557b072290de81501166a43f1c34f33ea28fd318..fa38b767b54ff936ed9d0595c43182c08c277a44 100644 (file)
                $("#id_tags").autocomplete("/matching_tags/", {
                 minChars: 1,
                        matchContains: true,
                $("#id_tags").autocomplete("/matching_tags/", {
                 minChars: 1,
                        matchContains: true,
-                max: 20,
+                max: 10,
                 multiple: true,
                 multipleSeparator: " ",
                 multiple: true,
                 multipleSeparator: " ",
-                       /*formatItem: function(row, i, max) {
+                highlightItem: true,
+                scroll: true,
+                scrollHeight: 300,
+
+
+                       /*
+                       formatItem: function(row, i, max) {
                                return row.n + " ("+ row.c +")";
                        },
                 formatResult: function(row, i, max){
                     return row.n;
                                return row.n + " ("+ row.c +")";
                        },
                 formatResult: function(row, i, max){
                     return row.n;
-                }*/
+                }
+                */
+
                 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];
                 }
 
             });
                 }
 
             });
+
         });
 
         });
 
+        function submitClicked(e, f) {
+            if(!(browserTester('chrome') || browserTester('safari'))) {
+                $("input.submit")[0].disabled=true;
+            }
+            window.removeEventListener('beforeunload', beforeUnload, true);
+            if (f) {
+                f.submit();
+            }
+        }
+
+        function beforeUnload(e) {
+            if($("input#id_title")[0].value != "" || $("textarea#editor")[0].value != "" || $("input#id_tags")[0].value != "") {
+                return yourWorkWillBeLost(e);
+            }
+        }
+        window.addEventListener('beforeunload', beforeUnload, true);
+
         var related_questions_url = "{% url related_questions %}";
         </script>
         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
         var related_questions_url = "{% url related_questions %}";
         </script>
         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
                             <td>
                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
                             </td>
                             <td>
                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
                             </td>
+                            <td style="text-align: right;" id="editor-metrics"></td>
                             {% if settings.WIKI_ON %}
                             <td class="tright">
                                 {{ form.wiki }} <span class="help_text" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
                             {% if settings.WIKI_ON %}
                             <td class="tright">
                                 {{ form.wiki }} <span class="help_text" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
                        <p class="title-desc">
                                {{ form.tags.help_text }}
                        </p>
                        <p class="title-desc">
                                {{ form.tags.help_text }}
                        </p>
-            {% if not request.user.is_authenticated %}
-            <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
+                       
+            {% 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 %}
                        {% else %}
-            <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" />
+            <input name="ask" type="button" value="{% trans "Ask your question" %}" class="submit" onclick="submitClicked(event, this.form)"/>
             {% endif %}
         </form>
     </div>
             {% endif %}
         </form>
     </div>