1 {% extends "base.html" %}
2 <!-- question_edit.html -->
5 {% block title %}{% spaceless %}{% trans "Edit question" %}{% endspaceless %}{% endblock %}
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
16 $("#nav_questions").attr('className',"on");
17 $('#editor').TextAreaResizer();
19 //highlight code synctax when editor has new text
20 $("#editor").typeWatch({highlight: false, wait: 3000,
21 captureLength: 5, callback: lanai.highlightSyntax});
23 //toggle preview of editor
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" %}]";
30 $('#previewer').toggle();
31 $('#pre-collapse').text(txt);
34 //Tags autocomplete action
35 var tags = {{ tags|safe }};
36 $("#id_tags").autocomplete(tags, {
40 multipleSeparator: " ",
44 formatItem: function(row, i, max) {
45 return row.n + " ("+ row.c +")";
47 formatResult: function(row, i, max){
53 setupFormValidation("#fmedit", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
55 $('#id_revision').unbind().change(function(){
56 $("#select_revision").click();
58 lanai.highlightSyntax();
65 <div id="main-bar" class="headNormal">
66 {% trans "Edit question" %} [<a href="{{ question.get_absolute_url }}">{% trans "back" %}</a>]
68 <div id="main-body" class="ask-body">
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"%}">
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 }}
84 <div class="form-item">
85 <div id="wmd-button-bar" class="wmd-panel"></div>
87 <span class="form-error"></span>
88 <div class="preview-toggle">
92 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
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>
103 <div id="previewer" class="wmd-preview"></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 }}
112 <strong>{{ form.summary.label_tag }}</strong> <br/>
113 {{ form.summary }} {{ form.summary.errors }}
114 <div class="title-desc">
115 {{ form.summary.help_text }}
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);" />
126 {% include "question_edit_tips.html" %}
131 <!-- end question_edit.html -->