]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/answer_edit.html
hide the navigation links in the administration if the currently authenticated user...
[osqa.git] / forum / skins / default / templates / answer_edit.html
1 {% extends "base.html" %}
2 <!-- template answer_edit.html -->
3 {% load i18n %}
4 {% load extra_tags %}
5 {% block title %}{% spaceless %}{% trans "Edit answer" %}{% 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         
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
29             $('#id_revision').unbind().change(function(){
30                 $("#select_revision").click();
31             });
32
33
34             answer = $("textarea#editor")[0].value;
35         });
36
37
38         function submitClicked(e, f) {
39             if(!(browserTester('chrome') || browserTester('safari'))) {
40                 $("input.submit")[0].disabled=true;
41                 $("input.submit")[1].disabled=true;
42             }
43             window.removeEventListener('beforeunload', beforeUnload, true);
44             if (f) {
45                 f.submit();
46             }
47         }
48
49         function beforeUnload(e) {
50             if($("textarea#editor")[0].value != answer) {
51                  return yourWorkWillBeLost(e);
52             }
53         }
54         window.addEventListener('beforeunload', beforeUnload, true);
55
56         var answer = "";
57         </script>
58 {% endblock %}
59         
60 {% block content %}
61 <div id="main-bar" class="headNormal">
62     {% trans "Edit answer" %} [<a href="{{ answer.question.get_absolute_url }}#{{ answer.id }}">{% trans "back" %}</a>]
63 </div>
64 <div id="main-body" class="ask-body">
65     <div id="askform">
66         <form id="fmedit" action="{% url edit_answer answer.id %}" method="post">
67             {% csrf_token %}
68             <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/> 
69             {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
70             <div>
71             {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans "select revision" %}">
72             </div>
73             <div class="form-item">
74                 <div id="wmd-button-bar" class="wmd-panel"></div>
75                 {{ form.text }}
76                 <span class="form-error"></span>
77                 <div class="preview-toggle"><span id="pre-collapse" 
78                                         title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
79                             <span style="text-align: right; margin-left: 200px;" id="editor-metrics"></span>
80                                 {% if settings.WIKI_ON %}
81                     <div style="float:right;">
82                         {{ form.wiki }} <span style="color:#000;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
83                     </div>
84                     {% endif %}
85                 </div>
86                 <div id="previewer" class="wmd-preview"></div>
87             </div>
88             
89             <strong>{{ form.summary.label_tag }}</strong> <br/>
90             {{ form.summary }}  {{ form.summary.errors }}
91             <div class="title-desc">
92                 {{ form.summary.help_text }}
93             </div>
94             
95             {% if form.recaptcha %}
96             <div class="question-captcha">
97                 {{ form.recaptcha.errors }}
98                 {{ form.recaptcha }}
99             </div>
100             {% endif %}
101             
102             <input type="button" value="{% trans "Save edit" %}" class="submit" onclick="submitClicked(event, this.form)" />
103             <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="submitClicked(event, this.form);history.back(-1);" />
104         </form>
105     </div>
106 </div>
107 {% endblock %}
108
109 {% block sidebar %}
110 {% include "answer_edit_tips.html" %}
111 {% endblock %}
112
113 {% block endjs %}
114 {% endblock %}
115 <!-- end template answer_edit.html -->