~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to templates/pybb/add_post.html

  • Committer: Holger Rapp
  • Date: 2012-09-01 16:11:57 UTC
  • mfrom: (325.1.23 development)
  • Revision ID: sirver@gmx.de-20120901161157-nm7xupfhd2jlpypg
Merged Shevonars amazing work!

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
{% load pybb_extras %}
3
3
{% load i18n %}
4
4
 
 
5
{% block title %}
 
6
{% if forum %}
 
7
        {% trans "New Topic" %}
 
8
{% else %}
 
9
                {%if post %}
 
10
                        {% trans "Edit Reply" %}
 
11
                {% else %}
 
12
                        {% trans "New Reply" %}
 
13
                {% endif %}
 
14
{% endif %}
 
15
 - {{ block.super }}
 
16
{% endblock %}
 
17
 
 
18
{% block extra_head %}
 
19
{{ block.super }}
 
20
<script type="text/javascript" src="{{MEDIA_URL}}/js/disableOnSubmit.js"></script>
 
21
<script type="text/javascript">
 
22
        $(function() {
 
23
                $('form').disableOnSubmit();
 
24
                $('.post-form .preview-button').click(function() {
 
25
                        var raw_content = $.trim($('.post-form #id_body').val());
 
26
                        var markup = $('.post-form #id_markup').val();
 
27
 
 
28
                        args = {'content': raw_content, 'markup': markup}
 
29
                        $.post('{% url pybb_post_ajax_preview %}', args, function(data) {
 
30
                                if (data.error) {
 
31
                                        alert(data.error);
 
32
                                } else {
 
33
                                        $('.preview-box .content').html(data.content);
 
34
                                        $('.preview-box').show();
 
35
                                }
 
36
                        }, 'json');
 
37
                });
 
38
        });
 
39
</script>
 
40
{% endblock %}
 
41
 
5
42
{% block content %}
6
 
{% include "django_messages/inlines/navigation.html" %}
7
 
<br />
8
 
<br />
9
 
<div class="box_item_model border">
10
 
    {% include "pybb/inlines/add_post_form.html" %}
11
 
</div>
 
43
<form class="post-form" action="{{ form_url }}" method="post" enctype="multipart/form-data">
 
44
        <h1>
 
45
        {% if forum %}
 
46
                {% trans "New Topic" %}
 
47
        {% else %}
 
48
                {%if post %}
 
49
                        {% trans "Edit Reply" %}
 
50
                {% else %}
 
51
                        {% trans "New Reply" %}
 
52
                {% endif %}
 
53
        {% endif %}
 
54
        </h1>
 
55
        <div class="blogEntry">
 
56
                <a href="{% url pybb_index %}">Forums</a> &#187;
 
57
        {% if forum %}
 
58
                <a href="{{ forum.category.get_absolute_url }}">{{ forum.category.name }}</a> &#187;
 
59
                {{ forum }}
 
60
        {% else %}
 
61
                {% pybb_link topic.forum.category %} &#187; 
 
62
                <a href="{{ topic.forum.get_absolute_url }}">{{ topic.forum.name }}</a> &#187;
 
63
                {{ topic }} 
 
64
        {% endif %}
 
65
 
 
66
                <div class="preview-box" style="display: none">
 
67
                        <br />
 
68
                        {% trans "Preview" %}:<br />
 
69
                        <div class="content post">
 
70
                        </div>
 
71
                </div>
 
72
 
 
73
                {{ form.as_p }}
 
74
                {% csrf_token %}
 
75
                <button type="submit">
 
76
                        <img src="{{MEDIA_URL}}/forum/img/send.png" alt ="" class="middle" />
 
77
                        <span class="middle">{% trans "Send" %}</span>
 
78
                </button>
 
79
                <button type="button" class="preview-button">
 
80
                        <img src="{{MEDIA_URL}}/forum/img/preview.png" alt ="" class="middle" />
 
81
                        <span class="middle">{% trans "Preview" %}</span>
 
82
                </button>
 
83
        </div>
 
84
</form>
12
85
{% endblock %}