]> git.openstreetmap.org Git - osqa.git/blob - 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
1 {% extends "base.html" %}
2 <!-- template ask.html -->
3 {% load i18n %}
4 {% load extra_tags %}
5 {% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %}
6 {% block forejs %}
7         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>
8         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>
9         <link rel="stylesheet" type="text/css" href="{% media  "/media/js/wmd/wmd.css" %}" />
10         <script type="text/html" id="question-summary-template">
11             <div class="answer-summary">
12                 <a href="%URL%"><div class="answer-votes">%SCORE%</div></a>
13                 <div class="answer-link">
14                     <a class="question-hyperlink" href="%URL%" title="%SUMMARY%">%TITLE%</a>
15                 </div>
16             </div>
17         </script>
18         <script type="text/javascript">
19         $(function(){
20             //set current module button style
21             $("#nav_ask").attr('className',"on");
22             $('#editor').TextAreaResizer();
23
24             //toggle preview of editor
25                         //todo remove copy-paste
26             var display = true;
27             var txt = "[{% trans "hide preview" %}]";
28             $('#pre-collapse').text(txt);
29             $('#pre-collapse').bind('click', function(){
30                 txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
31                 display = !display;
32                 $('#previewer').toggle();
33                 $('#pre-collapse').text(txt);
34             });
35
36             //Tags autocomplete action
37                 $("#id_tags").autocomplete("/matching_tags/", {
38                 minChars: 1,
39                         matchContains: true,
40                 max: 20,
41                 multiple: true,
42                 multipleSeparator: " ",
43                         /*formatItem: function(row, i, max) {
44                                 return row.n + " ("+ row.c +")";
45                         },
46                 formatResult: function(row, i, max){
47                     return row.n;
48                 }*/
49                 formatItem: function(row, i, max, value) {
50                     return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
51                 },
52
53                 formatResult: function(row, i, max, value){
54                     return row[0];
55                 }
56
57             });
58         });
59
60         var related_questions_url = "{% url related_questions %}";
61         </script>
62         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
63 {% endblock %}
64
65 {% block content %}
66 <div id="main-bar" class="headNormal">
67         {% trans "Ask a question" %}
68 </div>
69 <div id="main-body" class="ask-body">
70     <div id="askform">
71         <form id="fmask" action="" method="post" accept-charset="utf-8">
72                         {% if not request.user.is_authenticated %}
73             <div class="message">
74                 <span class="strong big">{% trans "You are welcome to start submitting your question anonymously." %}</span>
75                 <p>{% blocktrans %}
76                     After submiting your question, you will be redirected to the login/signup page.
77                     Your question will be saved in the current session and will be published after you login with your existing account,
78                     or signup for a new account{% endblocktrans %}{% if "ask" in settings.REQUIRE_EMAIL_VALIDATION_TO %}
79                     {% trans "and validate your email." %}{% else %}.{% endif %}</p>
80             </div>
81             {% else %}
82                 {% if not request.user.email_valid_and_can_ask %}
83                     <div class="message">
84                         {% blocktrans %}Remember, your question will not be published until you validate your email.{% endblocktrans %}
85                         <a href="{% url send_validation_email %}">{% trans "Send me a validation link." %}</a>
86                     </div>
87                 {% endif %}
88                         {% endif %}
89             <div class="form-item">
90                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
91                 {{ form.title }} {{ form.title.errors }}
92                 <div class="title-desc">
93                     {{ form.title.help_text }}
94                 </div>
95             </div>
96             <div id="ask-related-questions"></div>
97             <div class="form-item">
98                 <div id="wmd-button-bar" class="wmd-panel"></div>
99                 {{ form.text }} {{ form.text.errors }}
100                 <div class="preview-toggle">
101                     <table width="100%">
102                         <tr>
103                             <td>
104                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
105                             </td>
106                             {% if settings.WIKI_ON %}
107                             <td class="tright">
108                                 {{ form.wiki }} <span class="help_text" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
109                             </td>
110                             {% endif %}
111                         </tr>
112
113                     </table>
114                 </div>
115                 <div id="previewer" class="wmd-preview"></div>
116                 <span class="form-error"></span>
117             </div>
118             <div class="form-item">
119                 <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br/>
120                 {{ form.tags }}  {{ form.tags.errors }}
121             </div>
122                         <p class="title-desc">
123                                 {{ form.tags.help_text }}
124                         </p>
125             {% if not request.user.is_authenticated %}
126             <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
127                         {% else %}
128             <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" />
129             {% endif %}
130         </form>
131     </div>
132 </div>
133 {% endblock %}
134
135 {% block sidebar %}
136 {% include "question_edit_tips.html" %}
137 {% endblock %}
138
139 {% block endjs %}
140 {% endblock %}
141 <!-- end template ask.html -->