~widelands-dev/widelands-website/update_beautifulsoup4

« back to all changes in this revision

Viewing changes to pybb/templates/pybb/add_post_form.html

  • Committer: Holger Rapp
  • Date: 2009-02-25 16:55:36 UTC
  • Revision ID: sirver@kallisto.local-20090225165536-3abfhjx8qsgtzyru
- Added my hacked version of pybb. Remerging new versions is very difficult at this point :(

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{% load i18n %}
 
2
 
 
3
<form class="post-form" action="{{ form_url }}" method="post" enctype="multipart/form-data">
 
4
    <div class="preview-box" style="display: none">
 
5
        <div class="header">{% trans "Preview" %}</div>
 
6
        <div class="content"></div>
 
7
    </div>
 
8
    <fieldset>
 
9
        <legend>{% if forum %}{% trans "New topic" %}{% else %}{% trans "New reply" %}{% endif %}</legend>
 
10
        {{ form.as_p }}
 
11
        <p class="submit">
 
12
            <input type="submit" value="{% trans "Submit" %}" />
 
13
            <input class="preview-button" type="button" value="{% trans "Preview" %}" />
 
14
        </p>
 
15
    </fieldset>
 
16
</form>
 
17
 
 
18
<script type="text/javascript">
 
19
$(function() {
 
20
    $('.post-form .preview-button').click(function() {
 
21
        var raw_content = $.trim($('.post-form #id_body').val());
 
22
        var markup = $('.post-form #id_markup').val();
 
23
 
 
24
        args = {'content': raw_content, 'markup': markup}
 
25
        $.post('{% url pybb_post_ajax_preview %}', args, function(data) {
 
26
            if (data.error) {
 
27
                alert(data.error);
 
28
            } else {
 
29
                $('.preview-box .content').html(data.content);
 
30
                $('.preview-box').show();
 
31
            }
 
32
        }, 'json');
 
33
    });
 
34
});
 
35
 
 
36
</script>