aboutsummaryrefslogtreecommitdiff
path: root/templates/letters/conversation.html
blob: 4ec23d555e492d627d72331ce6d5f5c72d11c68f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{% extends "_layouts/base.html" %}
{% load static %}
{% load i18n %}

{% block head %}
<link type="text/css" rel="stylesheet" href="{% static 'css/letters/letters.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static 'css/miku/miku.css' %}" />
<link type="text/css" rel="stylesheet" href="{% static 'css/miku/themes/vintage.css' %}" />
{% endblock head %}

{% block content %}
<div class="letters-page">
    {% if messages %}
        <div class="form-messages">
            {% for message in messages %}
                <div class="form-message {{ message.tags }}">{{ message }}</div>
            {% endfor %}
        </div>
    {% endif %}

    <div class="console-viewport">
        <div class="console-frame-overlay"></div>

        <div class="console-portrait">
            {% with profile=other_user.userprofile_set.first %}
                {% if profile and profile.avatar_url %}
                    <img src="{% static 'images/avatars/' %}{{ profile.avatar_url }}.gif" alt="{{ other_user.username }}" width="64" height="64" />
                {% else %}
                    <div class="portrait-letter">{{ other_user.username|first|upper }}</div>
                {% endif %}
            {% endwith %}
        </div>

        <div class="console-nameplate">
            <a href="{% url 'core:letters:inbox' %}" class="console-back">« {% trans "BACK" %}</a>
            <span class="console-name">{{ other_user.username }}</span>
        </div>

<div class="console-screen" id="letters-container"
    data-username="{{ other_user.username }}"
    data-current-user="{{ request.user.username }}"
    data-has-more="{{ has_more|yesno:'true,false' }}"
    data-older-url="{% url 'core:letters:conversation_older' username=other_user.username %}"
    data-label-you="{% trans "You" %}"
    data-label-loading="{% trans "Loading..." %}"
    data-label-load-older="{% trans "Load older letters" %}"
    {% if letters %}data-oldest-id="{{ letters.0.pk }}"{% endif %}>
            {% if has_more %}
            <div class="load-older" id="load-older">
                <button class="load-older-btn" id="load-older-btn">{% trans "Load older letters" %}</button>
            </div>
            {% endif %}

            <table class="letters-list" id="letters-list">
                {% include "letters/_partials/letter_rows.html" %}
                {% if not letters %}
                <tr class="empty-conversation">
                    <td colspan="2">
                        <p>{% trans "No letters yet. Write the first one!" %}</p>
                    </td>
                </tr>
                {% endif %}
            </table>
        </div>

        <div class="console-input">
            <div class="console-reply-form">
                <div id="markmiku-editor"></div>
            </div>
        </div>
    </div>
</div>
{% endblock content %}

{% block scripts %}
<script type="application/json" id="editor-config">
{
    "placeholder": "{% trans 'Write your letter...' %}",
    "emojis": {{ emoji_data_json }},
    "attachmentUploadUrl": "{% url 'api:letters:attachment_upload' username=other_user.username %}",
    "attachmentRemoveUrl": "{% url 'api:letters:attachment_remove' attachment_id=0 %}",
    "csrfToken": "{{ csrf_token }}",
    "maxAttachments": {{ max_attachments }},
    "maxAttachmentSize": {{ max_attachment_size }}
}
</script>
<script type="text/javascript" src="{% static 'js/miku/markmiku.js' %}"></script>
<script type="text/javascript" src="{% static 'js/letters.js' %}"></script>
{% endblock scripts %}