]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/ask.html
Closes OSQA 175 and OSQA 318. Added a bunch of options to configure the email validat...
[osqa.git] / forum / skins / default / templates / ask.html
index e681f4f32291edfc8e4ff05f147c11ea11254ab9..2f2b92e1463cf16dd56a835a3bdb6047d141cf64 100644 (file)
@@ -7,8 +7,16 @@
         <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/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">
         <script type="text/javascript">
-        $().ready(function(){
+        $(function(){
             //set current module button style
             $("#nav_ask").attr('className',"on");
             $('#editor').TextAreaResizer();
             //set current module button style
             $("#nav_ask").attr('className',"on");
             $('#editor').TextAreaResizer();
             });
 
             //Tags autocomplete action
             });
 
             //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: " ",
                 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;
                                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];
                 }
 
             });
                 }
 
             });
-
         });
         });
+
+        var related_questions_url = "{% url related_questions %}";
         </script>
         </script>
+        <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
 {% endblock %}
 
 {% block content %}
 {% endblock %}
 
 {% block content %}
 </div>
 <div id="main-body" class="ask-body">
     <div id="askform">
 </div>
 <div id="main-body" class="ask-body">
     <div id="askform">
-        <form id="fmask" action="" method="post" >
+        <form id="fmask" action="" method="post" accept-charset="utf-8">
                        {% if not request.user.is_authenticated %}
             <div class="message">
                        {% if not request.user.is_authenticated %}
             <div class="message">
-                           <p>{% trans "login to post question info" %}</p>
+                <span class="strong big">{% trans "You are welcome to start submitting your question anonymously." %}</span>
+                <p>{% blocktrans %}
+                    After submiting your question, you will be redirected to the login/signup page.
+                    Your question will be saved in the current session and will be published after you login with your existing account,
+                    or signup for a new account{% endblocktrans %}{% if "ask" in settings.REQUIRE_EMAIL_VALIDATION_TO %}
+                    {% trans "and validate your email." %}{% else %}.{% endif %}</p>
             </div>
             {% else %}
             </div>
             {% else %}
-                {% ifequal settings.EMAIL_VALIDATION 'on' %}
-                    {% if not request.user.email_isvalid %}
-                        <div class="message">
-                            {% blocktrans with request.user.email as email %}must have valid {{email}} to post, 
-                            see {{email_validation_faq_url}}
-                            {% endblocktrans %}
-                        </div>
-                    {% endif %}
-                {% endifequal %}
+                {% 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>
+                    </div>
+                {% endif %}
                        {% endif %}
             <div class="form-item">
                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
                        {% endif %}
             <div class="form-item">
                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
                     {{ form.title.help_text }}
                 </div>
             </div>
                     {{ 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>
             <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>
                 <div class="preview-toggle">
                     <table width="100%">
                         <tr>