-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new feature of friend request
- Loading branch information
1 parent
53d3570
commit 3b3ab95
Showing
26 changed files
with
326 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#request-text { | ||
margin-top: 15rem; | ||
font-size: 2rem; | ||
color: #050d55; | ||
font-weight: bold; | ||
font-family: 'Nunito', sans-serif; | ||
text-align: center; | ||
} | ||
|
||
.request-button{ | ||
/* increase size of button */ | ||
padding: 20px 25px; | ||
border-radius: 12px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,3 +182,9 @@ html { | |
#password-field-2 { | ||
display: none; | ||
} | ||
|
||
.back-btn{ | ||
margin-top:3rem; | ||
border-radius: 50%; | ||
opacity: 0.8; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
chat/migrations/0003_remove_userprofile_email_userprofile_user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 5.0.2 on 2024-03-24 19:02 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('chat', '0002_alter_friends_friend_delete_messages'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='userprofile', | ||
name='email', | ||
), | ||
migrations.AddField( | ||
model_name='userprofile', | ||
name='user', | ||
field=models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 5.0.2 on 2024-03-24 19:02 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('chat', '0003_remove_userprofile_email_userprofile_user'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='userprofile', | ||
name='user', | ||
field=models.OneToOneField(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.2 on 2024-03-25 06:43 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('chat', '0004_alter_userprofile_user'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='friends', | ||
name='accepted', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.2 on 2024-03-26 10:43 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('chat', '0005_friends_accepted'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='friends', | ||
name='note', | ||
field=models.CharField(blank=True, default='', max_length=100), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{% extends "chat/Base.html" %} | ||
{% load static %} | ||
|
||
{% block content %} | ||
<style> | ||
i.size { | ||
font-size: 100px; | ||
} | ||
</style> | ||
<link rel="stylesheet" href="{% static 'css/chat/FriendRequest.css' %}"> | ||
<div class="text-center"> | ||
<h1 id="request-text">You have received friend request from: <u>{{RequestFrom}}</u></h1> | ||
{% if note %} | ||
<h5>Request Note: <b>{{note}}</b></h5> | ||
{% endif %} | ||
<br> | ||
<button class="btn btn-outline-success request-button" id="accept-button"><i class="fa-solid fa-check"></i> </button> | ||
Accept | ||
|
||
| ||
|
||
<button class="btn btn-outline-danger request-button" id="reject-button"><i class="fa-solid fa-xmark"></i></button> | ||
Reject | ||
</div> | ||
|
||
<script> | ||
//Ajax request to accept or reject friend request | ||
document.getElementById("accept-button").addEventListener("click", function () { | ||
$.ajax({ | ||
type: "POST", | ||
url: "{% url 'chat:FriendRequest' %}", | ||
data: { | ||
'csrfmiddlewaretoken': "{{ csrf_token }}", | ||
'request_from': "{{RequestFrom}}", | ||
'action': "accept" | ||
|
||
}, | ||
success: function (data) { | ||
alert("Friend request accepted"); | ||
window.location.href = "{% url 'chat:dashboard' %}"; | ||
} | ||
}); | ||
}); | ||
|
||
document.getElementById("reject-button").addEventListener("click", function () { | ||
$.ajax({ | ||
type: "POST", | ||
url: "{% url 'chat:FriendRequest' %}", | ||
data: { | ||
'csrfmiddlewaretoken': "{{ csrf_token }}", | ||
'request_from': "{{RequestFrom}}", | ||
'action': "reject" | ||
|
||
}, | ||
success: function (data) { | ||
alert("Friend request rejected"); | ||
window.location.href = "{% url 'chat:dashboard' %}"; | ||
} | ||
}); | ||
}); | ||
|
||
</script> | ||
|
||
<script type="text/javascript" src="{% static 'js/chat/waiting_room.js' %}"></script> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.