diff --git a/resources/chatbox.scss b/resources/chatbox.scss index 6cace6c..e69de29 100644 --- a/resources/chatbox.scss +++ b/resources/chatbox.scss @@ -1,123 +0,0 @@ - -#loader { - display: block; - margin-left: auto; - margin-right: auto; - width: 4%; -} - -#chat-log { - padding: 0; - padding-top: 2em; - width: 100%; -} - -#chat-log li { - list-style-type: none; - margin: 0.5em; -} - - -#chat-submit { - margin-top: 1em; -} - -.profile-pic { - height: 2.6em; - width: 2.6em; - border-radius: 0.3em; - margin-top: 0.1em; - float: left; -} - -.body-message { - padding-left: 3em; - padding-bottom: 1em; - border-bottom: 1px solid lightgray; -} - -.user-time { - margin-bottom: 0.3em; -} - -.time { - margin-left: 0.5em; -} - -.clear { - clear: both; -} - -.content-message { - word-wrap: break-word; -} - -.content-message p { - margin: 0; -} - -#chat-area { - height: 85vh; - /*display: flex;*/ - /*flex-direction: column;*/ -} -#chat-online { - border: 1px solid #ccc; - border-radius: 4px; - padding-bottom: 0 !important; -} -#chat-online-content { - margin-top: 0.5em; - margin-bottom: 0; - overflow: hidden; - overflow-wrap: break-word; - overflow-y: auto; - max-height: 77vh; -} -#chat-box { - border: 1px solid #ccc; - border-radius: 4px; - width: 100%; - overflow: hidden; - overflow-wrap: break-word; - overflow-y: scroll; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - max-height: 85%; - height: auto; -} - -#chat-input { - width: 100.3%; - padding: 0.4em; - color: black; - font-family: "Segoe UI", "Lucida Grande", Arial, sans-serif; - border-top-left-radius: 0; - border-top-right-radius: 0; - height: 15%; -} - -#chat-online-content { - padding: 0; - width: 100%; -} - -@media (min-width: 800px) { - #chat-container { - display: flex; - width: 100%; - } - #chat-box { - - } - #chat-online { - margin-left: auto; - width: 22%; - } - #chat-area { - width: 75%; - } - .chat-left-panel, .chat-right-panel { - display: block !important; - } -} diff --git a/resources/common.js b/resources/common.js index d2955ab..01f71b8 100644 --- a/resources/common.js +++ b/resources/common.js @@ -212,8 +212,9 @@ function count_down(label) { }, 1000); } -function register_time(elems, limit) { - limit = limit || 300; +function register_time(elems, limit) { // in hours + if ('limit_time' in window) limit = window.limit_time; + else limit = limit || 300 * 24; elems.each(function () { var outdated = false; var $this = $(this); @@ -225,7 +226,7 @@ function register_time(elems, limit) { if ($('body').hasClass('window-hidden')) return outdated = true; outdated = false; - if (moment().diff(time, 'days') > limit) { + if (moment().diff(time, 'hours') > limit) { $this.text(abs); return; } diff --git a/templates/base.html b/templates/base.html index 21d76b1..4e5dea0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -306,7 +306,7 @@ {% endif %} {% block bodyend %}{% endblock %} - + {% block footer %} + {% endblock %} diff --git a/templates/chat/chat.html b/templates/chat/chat.html index 9ca7dff..6db7fe1 100644 --- a/templates/chat/chat.html +++ b/templates/chat/chat.html @@ -6,9 +6,12 @@ - + + {% endblock js_media %} {% block media %} - + {% include "chat/chat_css.html" %} {% endblock media %} - +{% block footer %}{% endblock %} {% block body %} - {% csrf_token %} - {% block before_posts %}{% endblock %}
-
-
- -
    - {% include 'chat/message_list.html' %} -
-
- -
-
+
+
+ +
    + {% include 'chat/message_list.html' %} +
+
+
+ + +
+ +
- {% endblock body %} diff --git a/templates/chat/chat_css.html b/templates/chat/chat_css.html new file mode 100644 index 0000000..f00caa4 --- /dev/null +++ b/templates/chat/chat_css.html @@ -0,0 +1,262 @@ + \ No newline at end of file diff --git a/templates/chat/message.html b/templates/chat/message.html index 57f89a1..5e1dd65 100644 --- a/templates/chat/message.html +++ b/templates/chat/message.html @@ -10,17 +10,18 @@ - {{ message.time|date('TIME_FORMAT') }} - {{ message.time|date('d-m-Y') }} + {{ relative_time(message.time, abs=_('{time}'), rel=_('{time}'), format=_('g:i a d/m/Y')) }} - {% if request.user.is_staff %} - - {{_('Delete')}} - - {% endif %} - {{message.body | markdown('comment', MATH_ENGINE)|reference|str|safe }} +
+ {% if request.user.is_staff %} + + {{_('Delete')}} + + {% endif %} + {{message.body | markdown('comment', MATH_ENGINE)|reference|str|safe }} +