~widelands-dev/widelands-website/trunk

« back to all changes in this revision

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

  • Committer: Shevonar
  • Date: 2012-04-19 19:46:21 UTC
  • mto: This revision was merged to the branch mainline in revision 330.
  • Revision ID: infomh@anmaruco.de-20120419194621-lac98edodt220fux
Added new design for forums

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{% load i18n %}
 
2
 
2
3
{% block extra_head %}
3
 
<script type="text/javascript" src="/wlmedia/js/disableOnSubmit.js"></script>
 
4
{# block.super #}
 
5
<script type="text/javascript" src="{{MEDIA_URL}}/js/disableOnSubmit.js"></script>
4
6
<script type="text/javascript">
5
 
   $(function() {
6
 
         $('form').disableOnSubmit();
7
 
   });
 
7
        $(function() {
 
8
                 $('form').disableOnSubmit();
 
9
        });
 
10
 
 
11
        $(function() {
 
12
                $('.post-form .preview-button').click(function() {
 
13
                        var raw_content = $.trim($('.post-form #id_body').val());
 
14
                        var markup = $('.post-form #id_markup').val();
 
15
 
 
16
                        args = {'content': raw_content, 'markup': markup}
 
17
                        $.post('{% url pybb_post_ajax_preview %}', args, function(data) {
 
18
                                if (data.error) {
 
19
                                        alert(data.error);
 
20
                                } else {
 
21
                                        $('.preview-box .content').html(data.content);
 
22
                                        $('.preview-box').show();
 
23
                                }
 
24
                        }, 'json');
 
25
                });
 
26
        });
8
27
</script>
9
28
{% endblock %}
10
 
    <form class="post-form" action="{{ form_url }}" method="post" enctype="multipart/form-data">
11
 
        <div class="preview-box" style="display: none">
12
 
            <div class="header">
13
 
                <h3 class="title">{% trans "Preview" %}</h3>
14
 
            </div>
15
 
            <div class="content post top">
16
 
            </div>
17
 
        </div>
18
 
        <h3 class="title">
19
 
    {% if forum %}
20
 
        {% trans "New topic" %}
21
 
    {% else %}
22
 
        {%if post %}
23
 
            {% trans "Edit reply" %}
24
 
        {% else %}
25
 
            {% trans "New reply" %}
26
 
        {% endif %}
27
 
    {% endif %}
28
 
        </h3>
29
 
        <div class="content">
30
 
            {{ form.as_p }}
31
 
            </div>
32
 
        <div class="info_line show_left">
33
 
            <input type="submit" class="button_send" value="" />
34
 
            <input class="preview-button button_preview" type="button" value="" />
35
 
        </div>
36
 
        {% csrf_token %}
37
 
        </form>
38
 
<script type="text/javascript">
39
 
$(function() {
40
 
    $('.post-form .preview-button').click(function() {
41
 
        var raw_content = $.trim($('.post-form #id_body').val());
42
 
        var markup = $('.post-form #id_markup').val();
43
 
 
44
 
        args = {'content': raw_content, 'markup': markup}
45
 
        $.post('{% url pybb_post_ajax_preview %}', args, function(data) {
46
 
            if (data.error) {
47
 
                alert(data.error);
48
 
            } else {
49
 
                $('.preview-box .content').html(data.content);
50
 
                $('.preview-box').show();
51
 
            }
52
 
        }, 'json');
53
 
    });
54
 
});
55
 
 
56
 
</script>
 
29
 
 
30
<form class="post-form" action="{{ form_url }}" method="post" enctype="multipart/form-data">
 
31
        <div class="blogEntry">
 
32
                <h3>
 
33
        {% if forum %}
 
34
                {% trans "New topic" %}
 
35
        {% else %}
 
36
                {%if post %}
 
37
                        {% trans "Edit reply" %}
 
38
                {% else %}
 
39
                        {% trans "New reply" %}
 
40
                {% endif %}
 
41
        {% endif %}
 
42
                </h3>
 
43
 
 
44
                <div class="preview-box" style="display: none">
 
45
                        {% trans "Preview" %}:<br />
 
46
                        <div class="content post">
 
47
                        </div>
 
48
                </div>
 
49
 
 
50
                {{ form.as_p }}
 
51
                {% csrf_token %}
 
52
                <button type="submit">
 
53
                        <img src="{{MEDIA_URL}}/forum/img/send.png" alt ="" class="middle" />
 
54
                        <span class="middle">{% trans "Send" %}</span>
 
55
                </button>
 
56
                <button type="button" class="preview-button">
 
57
                        <img src="{{MEDIA_URL}}/forum/img/preview.png" alt ="" class="middle" />
 
58
                        <span class="middle">{% trans "Preview" %}</span>
 
59
                </button>
 
60
        </div>
 
61
</form>