]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/question.html
Reverts some changes in a previous commit.
[osqa.git] / forum / skins / default / templates / question.html
index 00bbd51b090bea86002a7356246f14bb4a766e3b..1173ce94726a36782af95cde7057fcc7e1d2d0c8 100644 (file)
@@ -8,11 +8,14 @@
 {% load humanize %}\r
 {% load i18n %}\r
 {% load cache %}\r
 {% load humanize %}\r
 {% load i18n %}\r
 {% load cache %}\r
-{% block metadescription %}{{question.summary}}{% endblock %}\r
+{% block metadescription %}{{ question.meta_description }}{% endblock %}\r
 {% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %}\r
 {% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %}\r
+{% block meta %}\r
+        <link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url}}" />\r
+        <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ question.get_absolute_url }}?type=rss">\r
+{% endblock %}\r
 {% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %}\r
 {% block forejs %}\r
 {% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %}\r
 {% block forejs %}\r
-        <link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url}}" />\r
         {% if not question.nis.closed %}\r
         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>\r
         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>\r
         {% if not question.nis.closed %}\r
         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>\r
         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>\r
@@ -29,7 +32,7 @@
             }\r
 \r
             $('#editor').TextAreaResizer();\r
             }\r
 \r
             $('#editor').TextAreaResizer();\r
-            \r
+\r
             //toggle preview of editor\r
             var display = true;\r
             var txt = "[{% trans "hide preview" %}]";\r
             //toggle preview of editor\r
             var display = true;\r
             var txt = "[{% trans "hide preview" %}]";\r
                 $('#pre-collapse').text(txt);\r
             });\r
         });\r
                 $('#pre-collapse').text(txt);\r
             });\r
         });\r
+\r
+        function submitClicked(e, f) {\r
+            if(!(browserTester('chrome') || browserTester('safari'))) {\r
+                $("input.submit")[0].disabled=true;\r
+            }\r
+            window.removeEventListener('beforeunload', beforeUnload, true);\r
+            if (f) {\r
+                f.submit();\r
+            }\r
+        }\r
+\r
+        function beforeUnload(e) {\r
+\r
+            if($("textarea#editor")[0].value != "") {\r
+                return yourWorkWillBeLost(e);\r
+            }\r
+\r
+            var commentBoxes = $("textarea.commentBox");\r
+            for(var index = 0; index < commentBoxes.length; index++) {\r
+                if(commentBoxes[index].value != "") {\r
+                    return yourWorkWillBeLost(e);\r
+                }\r
+            }\r
+        }\r
+        window.addEventListener('beforeunload', beforeUnload, true);\r
         </script>\r
         <noscript>\r
             <style>\r
         </script>\r
         <noscript>\r
             <style>\r
@@ -63,7 +91,7 @@
 </div>\r
 <div id="main-body" class="">\r
     <div id="askform">\r
 </div>\r
 <div id="main-body" class="">\r
     <div id="askform">\r
-            <table style="width:100%;" id="question-table" {% if question.nis.deleted %}class="deleted"{%endif%}>\r
+            <table style="width:100%;" id="question-table" {% post_classes question %}>\r
                 <tr>\r
                     <td style="width:30px;vertical-align:top">\r
                         <div class="vote-buttons">\r
                 <tr>\r
                     <td style="width:30px;vertical-align:top">\r
                         <div class="vote-buttons">\r
             {% if question.nis.closed %}\r
             <div class="question-status" style="margin-bottom:15px">\r
             <h3>\r
             {% if question.nis.closed %}\r
             <div class="question-status" style="margin-bottom:15px">\r
             <h3>\r
-                {% blocktrans with question.nstate.closed.extra as close_reason %}\r
-                    The question has been closed for the following reason "{{ close_reason }}" by\r
-                {% endblocktrans %}\r
+                {% blocktrans with question.nstate.closed.extra as close_reason %}The question has been closed for the following reason "{{ close_reason }}" by{% endblocktrans %}\r
                 <a href="{{ question.nstate.closed.by.get_profile_url }}">{{ question.nstate.closed.by.username }}</a>\r
                  {% diff_date question.nstate.closed.at %}\r
             </h3>\r
                 <a href="{{ question.nstate.closed.by.get_profile_url }}">{{ question.nstate.closed.by.username }}</a>\r
                  {% diff_date question.nstate.closed.at %}\r
             </h3>\r
                 <div class="tabBar">\r
                     <a name="sort-top"></a>\r
                     <div class="headQuestions">\r
                 <div class="tabBar">\r
                     <a name="sort-top"></a>\r
                     <div class="headQuestions">\r
-                    {% blocktrans count answers.count as counter %}\r
-                    One Answer:\r
-                    {% plural %}\r
-                    {{counter}} Answers:\r
-                    {% endblocktrans %}\r
+                    {% blocktrans count answers.paginator.count as counter %}One Answer:{% plural %}{{counter}} Answers:{% endblocktrans %}\r
                     </div>\r
                     </div>\r
-                    {{ answers.sort_tabs }}\r
+                    {{ answers.paginator.sort_tabs }}\r
                 </div>\r
                 </div>\r
-                {{ answers.page_numbers }}\r
+                {{ answers.paginator.page_numbers }}\r
   \r
   \r
-                {% for answer in answers.page %}\r
+                {% for answer in answers.paginator.page %}\r
                     <a name="{{ answer.id }}"></a>\r
                     <a name="{{ answer.id }}"></a>\r
-                    <div id="answer-container-{{ answer.id }}" class="answer {% if answer.nis.accepted %}accepted-answer{% endif %} {% ifequal answer.author_id question.author_id %} answered-by-owner{% endifequal %} {% if answer.nis.deleted %}deleted{% endif %}">\r
+                    <div id="answer-container-{{ answer.id }}" class="answer {% post_classes answer %}">\r
                         <table style="width:100%;">\r
                             <tr>\r
                                 <td style="width:30px;vertical-align:top">\r
                         <table style="width:100%;">\r
                             <tr>\r
                                 <td style="width:30px;vertical-align:top">\r
                     </div>\r
                 {% endfor %}\r
                 <div class="paginator-container-left">\r
                     </div>\r
                 {% endfor %}\r
                 <div class="paginator-container-left">\r
-                    {{ answers.page_numbers }}\r
+                    {{ answers.paginator.page_numbers }}\r
                 </div>\r
             {% endif %}\r
         <form id="fmanswer" action="{% url answer question.id %}" method="post">\r
                 </div>\r
             {% endif %}\r
         <form id="fmanswer" action="{% url answer question.id %}" method="post">\r
                                             {% trans "toggle preview" %}\r
                                     </span>\r
                                 </td>\r
                                             {% trans "toggle preview" %}\r
                                     </span>\r
                                 </td>\r
+                                <td style="text-align: right;" id="editor-metrics"></td>\r
                                 {% if settings.WIKI_ON %}\r
                                 <td style="text-align:right;">\r
                                     {{ answer.wiki }} \r
                                 {% if settings.WIKI_ON %}\r
                                 <td style="text-align:right;">\r
                                     {{ answer.wiki }} \r
                     <div id="previewer" class="wmd-preview"></div>                    \r
                 </div>\r
                 <p><span class="form-error"></span></p>\r
                     <div id="previewer" class="wmd-preview"></div>                    \r
                 </div>\r
                 <p><span class="form-error"></span></p>\r
-                <input type="submit" \r
+                <input type="button"\r
                     {% if user.is_anonymous %}\r
                         value="{% trans "Login/Signup to Post Your Answer" %}" \r
                     {% else %}\r
                     {% if user.is_anonymous %}\r
                         value="{% trans "Login/Signup to Post Your Answer" %}" \r
                     {% else %}\r
                         value="{% trans "Answer the question" %}" \r
                         {% endif %}\r
                     {% endif %}\r
                         value="{% trans "Answer the question" %}" \r
                         {% endif %}\r
                     {% endif %}\r
-                    class="submit" style="float:left"/>\r
+                    class="submit" style="float:left" onclick="submitClicked(event, this.form)"/>\r
             {% endif %}\r
         </form>\r
     </div>\r
             {% endif %}\r
         </form>\r
     </div>\r