seperated chat pane into individual file, fix chat on homepage

This commit is contained in:
iou1name 2018-10-04 14:52:36 -04:00
parent 5d3d1eeb0f
commit 1586331f78
3 changed files with 30 additions and 40 deletions

View File

@ -0,0 +1,20 @@
<div id="chatPane" style="display:{% if request.session.get("hide_chat") == True %}none{% else %}flex{% endif %};">
<h1>Chat</h1>
<div id="chatWindow">
{% autoescape false %}
{% for message in chat_messages %}
<div id="msg-{{ message.id }}" class="message">
<div class="messageHeader">
<span class="messageName">{% if quest.owner.username == message.user.username or not quest.anonymize %}{{ message.user.username or quest.anon_name }}{% else %}{{ quest.anon_name }}{% endif %}</span>
<span class="messageDate">{{ localtime(message.timestamp).strftime('%Y-%m-%d %H:%M:%S') }}</span>
<span class="messageID">No.<a href="javascript:quote('{{ message.id }}')">{{ message.id }}</a></span>
</div>
<div class="messageContent">{{ message.message }}</div>
</div>
<hr>
{% endfor %}
{% endautoescape %}
</div>
<div id="messageTextDiv"><textarea id="messageTextArea" maxlength="512"></textarea></div>
</div>
<div id="preview" style="display:none;"></div>

View File

@ -175,24 +175,5 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div id="chatPane" style="display:{% if request.session.get("hide_chat") == True %}none{% else %}flex{% endif %};"> {% include "quest/chat.html" %}
<h1>Chat</h1>
<div id="chatWindow">
{% autoescape false %}
{% for message in chat_messages %}
<div id="msg-{{ message.id }}" class="message">
<div class="messageHeader">
<span class="messageName">{% if quest.owner.username == message.user.username or not quest.anonymize %}{{ message.user.username or quest.anon_name }}{% else %}{{ quest.anon_name }}{% endif %}</span>
<span class="messageDate">{{ localtime(message.timestamp).strftime('%Y-%m-%d %H:%M:%S') }}</span>
<span class="messageID">No.<a href="javascript:quote('{{ message.id }}')">{{ message.id }}</a></span>
</div>
<div class="messageContent">{{ message.message }}</div>
</div>
<hr>
{% endfor %}
{% endautoescape %}
</div>
<div id="messageTextDiv"><textarea id="messageTextArea" maxlength="512"></textarea></div>
</div>
<div id="preview" style="display:none;"></div>
{% endblock %} {% endblock %}

View File

@ -2,6 +2,14 @@
{% block title %}{{ quest.title }}{% endblock %} {% block title %}{{ quest.title }}{% endblock %}
{% block head %} {% block head %}
<link rel="stylesheet" type="text/css" href="{{ static('quest.css') }}"> <link rel="stylesheet" type="text/css" href="{{ static('quest.css') }}">
<script>
const quest_id = {{ quest.id }};
const page_num = '{{ page_num }}';
const SCRIPT_NAME = '{{ request.META["SCRIPT_NAME"] }}';
const anon_name = '{{ quest.anon_name }}';
</script>
<script type="text/javascript" src="{{ static('quest.js') }}"></script>
<script>window.onload = load;</script>
{% endblock %} {% endblock %}
{% block header %} {% block header %}
{% if request.user == quest.owner %} {% if request.user == quest.owner %}
@ -77,24 +85,5 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div id="chatPane" style="display:{% if request.session.get("hide_chat") == True %}none{% else %}flex{% endif %};"> {% include "quest/chat.html" %}
<h1>Chat</h1>
<div id="chatWindow">
{% autoescape false %}
{% for message in chat_messages %}
<div id="msg-{{ message.id }}" class="message">
<div class="messageHeader">
<span class="messageName">{{ message.user.username or quest.anon_name }}</span>
<span class="messageDate">{{ localtime(message.timestamp).strftime('%Y-%m-%d %H:%M:%S') }}</span>
<span class="messageID">No.<a href="javascript:quote('{{ message.id }}')">{{ message.id }}</a></span>
</div>
<div class="messageContent">{{ message.message }}</div>
</div>
<hr>
{% endfor %}
{% endautoescape %}
</div>
<div id="messageTextDiv"><textarea id="messageTextArea" maxlength="512"></textarea></div>
</div>
<div id="preview" style="display:none;"></div>
{% endblock %} {% endblock %}