]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/ask.html
Converted the new question notification template.
[osqa.git] / forum / skins / default / templates / ask.html
index ac393cde3355fabec8aa0aa1af44fd53c83396e5..5c12c865142b6a1f5f90689e1c2045ddf6f1224f 100644 (file)
@@ -16,7 +16,7 @@
             </div>
         </script>
         <script type="text/javascript">
-        $().ready(function(){
+        $(function(){
             //set current module button style
             $("#nav_ask").attr('className',"on");
             $('#editor').TextAreaResizer();
                 }
 
             });
-
-            var $input = $('#id_title');
-            var $box = $('#ask-related-questions');
-            var template = $('#question-summary-template').html()
-
-            function reload_suggestion_box(q) {
-                $.post('{% url related_questions %}', {title: q}, function(data) {
-                    if (data) {
-                        var html = '';
-                        for (var i = 0; i < data.length; i++) {
-                            var item = template.replace(new RegExp('%URL%', 'g'), data[i].url)
-                                               .replace(new RegExp('%SCORE%', 'g'), data[i].score)
-                                               .replace(new RegExp('%TITLE%', 'g'), data[i].title)
-                                               .replace(new RegExp('%SUMMARY%', 'g'), data[i].summary);
-
-                            html += item;
-
-                        }
-                        $('#ask-related-questions').html(html);
-                    }
-                }, 'json');
-            }
-
-            $input.keyup(function(e) {
-                var q = $input.val().trim();
-
-                if (e.which == 32 && q.length > 8 && q.split(' ').length > 2) {
-                    reload_suggestion_box(q);
-                }
-
-                return true;
-            });
-
-            $input.change(function() {
-                var q = $input.val().trim();
-
-                if (q.length > 8) {
-                    reload_suggestion_box(q);
-                }
-            });
         });
+
+        var related_questions_url = "{% url related_questions %}";
         </script>
+        <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
 {% endblock %}
 
 {% block content %}
 </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">
                            <p>{% trans "login to post question info" %}</p>