Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#157 Profile entry page #205

Merged
merged 18 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .enve
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DJANGO_CONFIGURATION=Development
deawer234 marked this conversation as resolved.
Show resolved Hide resolved
DJANGO_LOG_LEVEL=INFO
DJANGO_SECRET_KEY=
ROOT_DOMAIN=fiesta.test

# needed only for S3 local usage
DJANGO_AWS_S3_ACCESS_KEY_ID=
DJANGO_AWS_S3_SECRET_ACCESS_KEY=
DJANGO_AWS_STORAGE_BUCKET_NAME=
DJANGO_AWS_S3_REGION_NAME=
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% block main %}
<div class="flex flex-row items-start justify-between space-x-4">
<div class="w-1/4">
<ul class="menu shadow bg-gray-200 rounded-box">
<ul class="menu bg-gray-200 rounded-box">
<li>
<a href="{% url "accounts:my-profile" %}">
<svg xmlns="http://www.w3.org/2000/svg"
Expand Down
124 changes: 118 additions & 6 deletions fiesta/apps/accounts/templates/accounts/user_profile/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,131 @@

{% load i18n %}
{% load breadcrumbs %}
{% load user_profile %}

{% block upper_head %}
{{ block.super }}
{% trans "My Profile" as title %}
{% breadcrumb_push_item title %}
{% endblock upper_head %}


{% block content %}
<h1 class="card-title">{% trans "My Profile" %}</h1>
<table>
<tr>
<td></td>
<td>{{ object }}</td>
</tr>
</table>
<div class="md:flex md:flex-grow">
<div class="md:w-2/5 md:h-auto rounded-full flex items-center justify-center">
{% get_user_picture request.user as picture %}
{% if picture %}
<div class="w-48 h-48 rounded-full bg-cover bg-center"
style='background-image: url("{{ picture.url }}")'></div>
{% else %}
<svg xmlns="http://www.w3.org/2000/svg"
class="h-40 w-40"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z">
</path>
</svg>
{% endif %}
</div>
<div class="md:w-3/5 bg-gray-100 shadow rounded-box p-4 mb-4 mt-4 md:box-content">
<h1 class="card-title pb-1 mb-3 border-b-2">{% trans "Basic information" %}</h1>
<table class="border-separate gap-4">
{% with user=object.user profile=object.user.profile_or_none %}
<tr>
<td class="font-semibold pr-12">Name:</td>
<td>{{ user.first_name }}</td>
</tr>
<tr>
<td class="font-semibold pr-12">Surname:</td>
<td>{{ user.last_name }}</td>
</tr>
<tr>
<td class="font-semibold pr-12">Email:</td>
<td>{{ user.email_user }}</td>
</tr>
<tr>
<td class="font-semibold pr-12">Gender:</td>
<td>{{ profile.gender }}</td>
</tr>
<tr>
<td class="font-semibold pr-12">Joined:</td>
<td>{{ user.date_joined }}</td>
</tr>
{% endwith %}
</table>
</div>
</div>
<div class="bg-gray-100 shadow rounded-box p-4 mb-4 md:box-content">
<h1 class="card-title pb-1 mb-3 border-b-2">{% trans "Studies" %}</h1>
<table class="border-separate gap-4">
{% with profile=object.user.profile_or_none %}
<tr>
<td class="font-semibold pr-12">Home University:</td>
<td>{{ profile.home_university }}</td>
deawer234 marked this conversation as resolved.
Show resolved Hide resolved
</tr>
<tr>
<td class="font-semibold pr-12">Home Faculty:</td>
<td>{{ profile.home_faculty }}</td>
</tr>
{% if request.membership.is_international %}
<tr>
<td class="font-semibold pr-12">Quest Faculty:</td>
<td>{{ profile.guest_faculty }}</td>
</tr>
{% endif %}
{% endwith %}
</table>
</div>

<div class="bg-gray-100 shadow rounded-box p-4 mb-4 md:box-content">
<h1 class="card-title pb-1 mb-3 border-b-2">{% trans "Socials and contact" %}</h1>
<table class="border-separate gap-4">
{% with user=object.user profile=object.user.profile_or_none %}
<tr>
<td class="font-semibold pr-12">Facebook:</td>
<td>
<a class="underline text-blue-600 hover:text-blue-800 visited:text-purple-600"
href="{{ profile.facebook }}">{{ profile.facebook }}</a>
deawer234 marked this conversation as resolved.
Show resolved Hide resolved
</td>
</tr>
<tr>
<td class="font-semibold pr-12">Instagram:</td>
<td>
<a class="underline text-blue-600 hover:text-blue-800 visited:text-purple-600"
href="{{ profile.instagram }}">{{ profile.instagram }}</a>
</td>
</tr>
<tr>
<td class="font-semibold pr-12">Telegram:</td>
<td>
<a class="underline text-blue-600 hover:text-blue-800 visited:text-purple-600"
href="{{ profile.telegram }}">{{ profile.telegram }}</a>
</td>
</tr>
<tr>
<td class="font-semibold pr-12">Whatsapp:</td>
<td>{{ profile.whatsapp }}</td>
</tr>
<tr>
<td class="font-semibold pr-12">Email:</td>
<td>{{ user.email_user }}</td>
</tr>
{% endwith %}
</table>
</div>

<div class="bg-gray-100 shadow rounded-box p-4 mb-4 md:box-content">
<h1 class="card-title pb-1 mb-3 border-b-2">{% trans "Interests" %}</h1>
<div id="id_interests" class="inline-flex">
deawer234 marked this conversation as resolved.
Show resolved Hide resolved
{% get_user_interests object.user as interests %}
{% for interest in interests %}
<div class="mr-2">
<label class="border divide-gray-100 rounded-full border-gray-400 pt-1 pb-1 pl-2 pr-2">{{ interest }}</label>
</div>
deawer234 marked this conversation as resolved.
Show resolved Hide resolved
{% endfor %}
</div>

</div>
{% endblock content %}
10 changes: 10 additions & 0 deletions fiesta/apps/accounts/templatetags/user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django import template

from apps.accounts.conf import INTERESTS_CHOICES
from apps.accounts.forms.profile import UserProfileForm
from apps.accounts.models import User, UserProfile

Expand Down Expand Up @@ -31,3 +32,12 @@ def compute_profile_fullness(user: User) -> float:
empty_fields += 1

return (len(fields) - empty_fields) / len(fields)


@register.simple_tag
def get_user_interests(user: User | None):
deawer234 marked this conversation as resolved.
Show resolved Hide resolved
formated_interests = []
for interest in INTERESTS_CHOICES:
if any(x in interest[0] for x in user.profile.interests):
formated_interests.append(interest[1])
return formated_interests
45 changes: 45 additions & 0 deletions issue-157
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
develop
deawer234 marked this conversation as resolved.
Show resolved Hide resolved
* issue-157
remotes/origin/HEAD -> origin/develop
remotes/origin/dependabot/bundler/wiki/activesupport-7.0.4.3
remotes/origin/dependabot/bundler/wiki/commonmarker-0.23.10
remotes/origin/dependabot/bundler/wiki/git-1.13.0
remotes/origin/dependabot/bundler/wiki/nokogiri-1.13.9
remotes/origin/dependabot/bundler/wiki/sanitize-6.0.2
remotes/origin/dependabot/npm_and_yarn/webpack/semver-6.3.1
remotes/origin/dependabot/pip/certifi-2023.7.22
remotes/origin/dependabot/pip/cryptography-41.0.3
remotes/origin/dependabot/pip/django-4.2.3
remotes/origin/develop
remotes/origin/feat-django-pictures
remotes/origin/feat-section-settings
remotes/origin/feat-wagtail
remotes/origin/feature/django-cors-integration
remotes/origin/feature/my_profile_pages
remotes/origin/feature/remote-model-select
remotes/origin/issue-160
remotes/origin/main
remotes/origin/pre-commit-ci-update-config
remotes/origin/snyk-fix-03a20125f1f6b6c579abff5ebdded6ae
remotes/origin/snyk-fix-0b07e5fc6050056bc99ef0f82eb32b99
remotes/origin/snyk-fix-1161e7b8aa677f26a949e3f2d2ec545a
remotes/origin/snyk-fix-1cb6e8932d3817dc9ac71bc28b64141e
remotes/origin/snyk-fix-201562492f38668384e2cbfa431b8cbf
remotes/origin/snyk-fix-23a2b1f090239ff9cc31b9c60c142a9a
remotes/origin/snyk-fix-2b7eadf23083943193fb0b634a5fddf6
remotes/origin/snyk-fix-3f2ef410151baedce2fa5ea55d4df347
remotes/origin/snyk-fix-493c8e91eaf01afd88213bf422b175b9
remotes/origin/snyk-fix-4d7398d9cabe3b29de19123fe7b5d30d
remotes/origin/snyk-fix-7595e6dc1a1723bf684b9e45da29b2f6
remotes/origin/snyk-fix-78c6356e5a0ecd80885533052d22d2a2
remotes/origin/snyk-fix-888c5cef98c82c804efec2383ce857c6
remotes/origin/snyk-fix-939281ccb5125c43746c4a01ec773542
remotes/origin/snyk-fix-b0031a0e37b61576b9c5d45b8e3dfffc
remotes/origin/snyk-fix-b285d365f7d0bf35ac663352d13dcca3
remotes/origin/snyk-fix-b3bdbbfc596a76e98516fdd5b151ca91
remotes/origin/snyk-fix-ca78a6ea5d37610e3d5aba07af1fe7d3
remotes/origin/snyk-fix-eb804a053f1961ad37fb1a54cfea79e5
remotes/origin/snyk-fix-ee6cd1a1dbb311cee641ea09a9e69e75
remotes/origin/snyk-upgrade-7d90a0b705a5b7d71edd9d119a2427a7
remotes/origin/snyk-upgrade-81c9ada4e31ee87a5c32442c88402524
remotes/origin/snyk-upgrade-f5aaf7c7de5b6754c5cf44ebe830e3a0
Loading