-
Notifications
You must be signed in to change notification settings - Fork 0
/
room.html
86 lines (65 loc) · 2.68 KB
/
room.html
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
{% extends './base.html' %}
{% load static %}
{% block content %}
<style>
body {
background-color: #36393f;
color: #fff;
}
</style>
<div>
{% if request.user.is_authenticated %}
<div class="mb-3" style="display:flex;gap:20px;">
<!-- Chat Box -->
<div style="width:70%;height:65vh;">
<ul class="p-2 custom-overflow-bar" id="chat-log"
style="border:2px dashed black;height:65vh;overflow-y:scroll;">
{% for each_message in earlier_room_messages %}
<li>
<div style="display:flex;">
<div class="message-parent-css">
<img class="discord-icon-css" src="{% static 'svgs/discord.svg' %}" height="26px"
width="26px" />
</div>
<div style="width: 95%;">
<div id="message-by-user" style="color:#5865f2;">
{{ each_message.user.username }}
</div>
<div id="message-content">
{{ each_message.content }}
</div>
</div>
</div>
<hr />
</li>
{% endfor %}
</ul>
</div>
<!-- Online Users -->
<div class="p-2 custom-overflow-bar" style="width:30%; border:2px solid black;height:65vh;overflow-y:scroll;">
<b>Online Users <span id="num-of-users"></span></b>
<div class="p-2">
<ul id="online-logs" class="p-2 custom-li-bullet">
</ul>
</div>
</div>
</div>
<!-- New Message and Leave Room Logics -->
<div class="mb-3 p-2" style="display:flex; gap: 20px;">
<input class="custom-input-css" placeholder="new message..." id="chat-message-input" type="text" />
<button class="custom-btn-css" id="chat-message-submit" type="submit">Send message</button>
<a href="/chat/" style="color:inherit;text-decoration:none;">
<button class="custom-btn-css" type="button" style="border:2px solid #ff4d4d;">Leave Room</button>
</a>
</div>
{% else %}
<span class="text-danger">
<h3>Login Required.</h3>
</span>
{% endif %}
<!-- Safely outputs a Python object as JSON, wrapped in a <script> tag,
ready for use with JavaScript, with an optional HTML "id" -->
{{ room_name|json_script:"room-name" }}
<!-- Frontend Events Logic -->
<script src="{% static 'js/room.js' %}" type="text/javascript"></script>
{% endblock %}