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