]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/question_edit.html
initial import
[osqa.git] / forum / skins / default / templates / question_edit.html
1 {% extends "base.html" %}
2 <!-- question_edit.html -->
3 {% load i18n %}
4 {% load extra_tags %}
5 {% block title %}{% spaceless %}{% trans "Edit 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/javascript">
11                 //todo move javascript out        
12         $().ready(function(){
13             $("#nav_questions").attr('className',"on");
14             $('#editor').TextAreaResizer();
15             
16
17             //toggle preview of editor
18             var display = true;
19             var txt = "[{% trans "hide preview" %}]";
20             $('#pre-collapse').text(txt);
21             $('#pre-collapse').bind('click', function(){
22                 txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
23                 display = !display;
24                 $('#previewer').toggle();
25                 $('#pre-collapse').text(txt);
26             });
27             
28             //Tags autocomplete action
29             var tags = {{ tags|safe }};
30                 $("#id_tags").autocomplete(tags, {
31                         matchContains: true,
32                 max: 20,
33                 multiple: true,
34                 multipleSeparator: " ",
35                 highlightItem: true,
36                 scroll: true,
37                 scrollHeight: 300,
38                         formatItem: function(row, i, max) {
39                                 return row.n + " ("+ row.c +")";
40                         },
41                 formatResult: function(row, i, max){
42                     return row.n;
43                 }
44                 
45             });         
46
47             $('#id_revision').unbind().change(function(){
48                 $("#select_revision").click();
49             });
50
51         });
52         </script>
53 {% endblock %}
54         
55 {% block content %}
56 <div id="main-bar" class="headNormal">
57     {% trans "Edit question" %} [<a href="{{ question.get_absolute_url }}">{% trans "back" %}</a>]
58 </div>
59 <div id="main-body" class="ask-body">
60     <div id="askform">
61         <form id="fmedit" action="{% url edit_question question.id %}" method="post" >
62             <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/> 
63             {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
64             <div style="vertical-align:middle">
65             {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" 
66                                                                                         value="{% trans "select revision"%}">
67             </div> 
68             <div class="form-item">
69                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/> 
70                 {{ form.title }} {{ form.title.errors }}  
71                 <div class="title-desc">
72                     {{ form.title.help_text }}
73                 </div>     
74             </div>
75             <div class="form-item">
76                 <div id="wmd-button-bar" class="wmd-panel"></div>
77                 {{ form.text }}
78                 <span class="form-error"></span>
79                 <div class="preview-toggle">
80                     <table width="100%">
81                         <tr>
82                             <td>
83                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
84                             </td>
85                             {% if settings.WIKI_ON %}
86                             <td style="text-align:right;">
87                                 {{ form.wiki }} <span style="color:#000;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
88                             </td>
89                             {% endif %}
90                         </tr>
91                     
92                     </table>   
93                 </div>
94                 <div id="previewer" class="wmd-preview"></div>
95             </div>
96             <div class="form-item">
97                 <strong>{{ form.tags.label_tag }}:</strong> <span class="form-error"></span><br/>
98                 {{ form.tags }}  {{ form.tags.errors }}
99                 <div class="title-desc">
100                     {{ form.tags.help_text }}
101                 </div>
102             </div>
103             <strong>{{ form.summary.label_tag }}</strong> <br/>
104             {{ form.summary }}  {{ form.summary.errors }}
105             <div class="title-desc">
106                 {{ form.summary.help_text }}
107             </div>
108             <div class="error" ></div>
109             <input type="submit" value="{% trans "Save edit" %}" class="submit" />
110             <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
111         </form>
112     </div>
113 </div>
114 {% endblock %}
115
116 {% block sidebar %}
117 {% include "question_edit_tips.html" %}
118 {% endblock %}
119
120 {% block endjs %}
121 {% endblock %}
122 <!-- end question_edit.html -->