Chat mit BUtton für eine Person FERTIG!

This commit is contained in:
Holger Trampe 2020-05-24 10:33:36 +02:00
parent 74db8a190c
commit 9b45ac79e5
6 changed files with 45 additions and 36 deletions

View File

@ -4,7 +4,6 @@
z-index: 999;
height: 100%;
width: 100%;
border-radius: 50%;
}
.icon-container {
width: 50px;
@ -69,6 +68,7 @@
{
$("#dynamicchatwindow_content").html(data);
$("#dynamicchatwindow").show();
localStorage.setItem("basechatid", userid);
}
});

View File

@ -153,11 +153,12 @@ $(document).ready(function(){
})
sending = true;
function sendNewMessage()
{
if($("#message").val().length > 0)
if($("#message").val().length > 0 && sending)
{
sending = false;
$.ajax(
{
type: "GET",
@ -173,7 +174,8 @@ $(document).ready(function(){
$("#message").val("");
chatwebsocket.send("load__{{user.pk}}__privatechat_{{roomdata.creator.pk}}_{{roomdata.chatmember_single.pk}}");
chatwebsocket.send("stoptyping__{{user.pk}}__privatechat_{{roomdata.creator.pk}}_{{roomdata.chatmember_single.pk}}");
}
sending = true;
}
});
}
}
@ -181,7 +183,7 @@ $(document).ready(function(){
$(document).on('keypress',function(e) {
if(e.which == 13) {
if($("#message").val().length > 0){
if($("#message").val().length > 0 && sending){
sendNewMessage();
}
}

View File

@ -1,9 +1,9 @@
<style type="text/css">
.scroll {
max-height: 400px;
min-height: 500px;
overflow-y: auto;
}
.scroll {
max-height: 400px;
min-height: 500px;
overflow-y: auto;
}
.chatmessageele_breaker
{
@ -26,6 +26,12 @@
float: left;
text-align: left;
color: #000000;
}
.roundimg-chat {
border-radius: 50%;
z-index: 999;
height: 100%;
width: 100%;
}
</style>
{% load counter_tag %}
@ -65,7 +71,7 @@
{% if message.author == request.user %}
<div style="" class="chatmessageele_me col-7 mb-3 ">
<div class='icon-container ml-2 mt-1 ' style="float: right;">
<img class="img-profile roundimg" src="{{ message.author.profile.get_photo_url }}">
<img class="img-profile roundimg-chat" src="{{ message.author.profile.get_photo_url }}">
</div>
<h6 class="mt-3"><small>{{message.sendtime|date:"H:i"}}</small></h6>
<div style="text-align: left;" class="mt-1">
@ -77,7 +83,7 @@
{% else %}
<div style="" class="chatmessageele_other col-7 mb-3">
<div class='icon-container mr-2 mt-1 ' style="float: left;">
<img class="img-profile roundimg" src="{{ message.author.profile.get_photo_url }}">
<img class="img-profile roundimg-chat" src="{{ message.author.profile.get_photo_url }}">
</div>
<h6 class="mt-3"><small>{{message.author.first_name}} {{message.author.last_name}},&nbsp;{{message.sendtime|date:"H:i"}}</small></h6>
<div style="text-align: left;" class="mt-1">
@ -114,6 +120,7 @@
function closeSingleChat(){
chatwebsocket.close();
$("#dynamicchatwindow").hide();
localStorage. removeItem("basechatid");
}
$(document).ready(function(){
@ -189,12 +196,13 @@ $(document).ready(function(){
}
})
var sending = true;
function sendNewMessage()
{
if($("#message").val().length > 0)
{
if($("#message").val().length > 0 && sending)
{
sending = false;
$.ajax(
{
type: "GET",
@ -210,15 +218,16 @@ $(document).ready(function(){
$("#message").val("");
chatwebsocket.send("load__{{user.pk}}__privatechat_{{roomdata.creator.pk}}_{{roomdata.chatmember_single.pk}}");
chatwebsocket.send("stoptyping__{{user.pk}}__privatechat_{{roomdata.creator.pk}}_{{roomdata.chatmember_single.pk}}");
sending = true;
}
});
});
}
}
$(document).on('keypress',function(e) {
if(e.which == 13) {
if($("#message").val().length > 0){
if($("#message").val().length > 0 && sending == true){
sendNewMessage();
}
}

View File

@ -14,38 +14,35 @@ from datetime import datetime, timedelta
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
############################################## LOCAL #####################################
BASE_URL = "http://localhost:8000/"
############################################## DEV #####################################
BASE_URL = "https://dev01.digitale-agentur.com/"
CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D"
MAILINFOKEY = "jka7sd8iukashdna78skduJAHDsu6dilaksdjba65a68iadbhjak"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
# MAIL DEV
EMAIL_HOST = 'smtp.strato.de'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "support@dev01.digitale-agentur.com"
EMAIL_HOST_PASSWORD = "n2xd7emyKZFb6UREzvbintuUIG"
DEFAULT_FROM_EMAIL = "support@dev01.digitale-agentur.com"
# DEV
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME' : 'digitaleagentur',
'USER' : 'root',
'PASSWORD' : '',
'NAME' : 'digitaleagentur_dev01',
'USER' : 'digitaleagentur_dev01',
'PASSWORD' : 't3TvtGAOkFHYXdJlUMIu9u3U',
'PORT' : 3306
}
}
# MAIL DEV
EMAIL_HOST = 'gymhum.de'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "holger.trampe"
EMAIL_HOST_PASSWORD = "Motte2016_!"
DEFAULT_FROM_EMAIL = "holger.trampe@gymhum.de"
# REDIS
REDIS_URL = ("localhost", 6379)
################################################### LOCAL ###############################
############################################## DEV #####################################

View File

@ -440,7 +440,7 @@
<!-- CHATAREA -->
<div id="dynamicchatwindow" class="col-4" style="position: absolute; bottom: 0px; right: 100px; display: none;">
<div id="dynamicchatwindow" class="col-4" style="position: absolute; bottom: 30px; right: 23px; display: none;z-index: 999;">
<div class="card">
<div class="card-body">
@ -839,7 +839,8 @@ $("#chatButton").click(function(){
});
</script>