Skip to content

Commit

Permalink
feat: mise à jour entête, pied de page et menu (#739)
Browse files Browse the repository at this point in the history
## Description

🎸 mise à jour menu
🎸 mise à jour header
🎸 mise à jour footer

## Type de changement

🎨 changement d'UI

### Captures d'écran (optionnel)

Header large


![image](https://github.com/user-attachments/assets/2c694118-418e-43ab-8c60-0dc8e0851535)


Header large authentifié


![image](https://github.com/user-attachments/assets/eda3bb68-11b9-4b33-8fb0-01daca2a756f)


Header medium


![image](https://github.com/user-attachments/assets/4606a875-f92c-4d85-8ef9-21ae6eb10b9d)

Header small


![image](https://github.com/user-attachments/assets/5207b69e-8e22-4a33-93a8-469c779e2989)

Menu anonyme


![image](https://github.com/user-attachments/assets/92d1a0a1-2f2e-4b8b-b114-2c001bd0016a)

Menu authentifié


![image](https://github.com/user-attachments/assets/0e409c48-0325-4a53-b9dc-bb82fe2a49a7)



Footer large 


![image](https://github.com/user-attachments/assets/cd7faf27-1e86-4c0f-8c2c-d4926d8e75e1)

---------

Co-authored-by: hellodeloo <[email protected]>
  • Loading branch information
vincentporte and hellodeloo authored Aug 7, 2024
1 parent 6141112 commit 4493267
Show file tree
Hide file tree
Showing 23 changed files with 602 additions and 326 deletions.
16 changes: 0 additions & 16 deletions lacommunaute/forum_member/models.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
from dateutil.relativedelta import relativedelta
from django.db import models
from django.utils import timezone
from machina.apps.forum_member.abstract_models import AbstractForumProfile

from lacommunaute.forum_member.enums import ActiveSearch, Regions
from lacommunaute.forum_member.shortcuts import get_forum_member_display_name


class ForumProfileQuerySet(models.QuerySet):
def power_users(self):
return (
self.filter(user__posts__created__gte=timezone.now() - relativedelta(days=30))
.annotate(user_posts_count=models.Count("user__posts"))
.filter(user_posts_count__gte=3)
.order_by("-user_posts_count")
.select_related("user")
.prefetch_related("user__posts")
)


class ForumProfile(AbstractForumProfile):
linkedin = models.URLField(blank=True, null=True, verbose_name="lien vers votre profil LinkedIn")
cv = models.FileField(upload_to="cv/", blank=True, null=True, verbose_name="votre CV")
Expand All @@ -36,7 +22,5 @@ class ForumProfile(AbstractForumProfile):
internship_duration = models.IntegerField(default=0, verbose_name="durée du stage (en mois)")
updated_at = models.DateTimeField(auto_now=True)

objects = ForumProfileQuerySet().as_manager()

def __str__(self):
return get_forum_member_display_name(self.user)
38 changes: 0 additions & 38 deletions lacommunaute/forum_member/tests/tests_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import pytest # noqa
from dateutil.relativedelta import relativedelta
from django.utils import timezone

from lacommunaute.forum_conversation.factories import ( # noqa
AnonymousPostFactory,
Expand All @@ -9,45 +7,9 @@
TopicFactory,
)
from lacommunaute.forum_member.factories import ForumProfileFactory
from lacommunaute.forum_member.models import ForumProfile
from lacommunaute.forum_member.shortcuts import get_forum_member_display_name


def test_get_forum_member_display_name(db):
forum_profile = ForumProfileFactory()
assert forum_profile.__str__() == get_forum_member_display_name(forum_profile.user)


def test_powerusers_forumprofile_queryset(db):
# anonymous user with 3 posts within the last 30 days
topic1 = AnonymousTopicFactory(with_post=True)
AnonymousPostFactory.create_batch(2, topic=topic1, username=topic1.first_post.username)

# authenticated user with 2 posts within the last 30 days
forum_profile1 = ForumProfileFactory()
topic2 = TopicFactory(with_post=True, poster=forum_profile1.user)
PostFactory(topic=topic2, poster=forum_profile1.user)

# authenticated user with 3 post before the last 30 days
forum_profile2 = ForumProfileFactory()
topic3 = TopicFactory(with_post=True, poster=forum_profile2.user)
PostFactory(topic=topic3, poster=forum_profile2.user)
for post in topic3.posts.all():
post.created = timezone.now() - relativedelta(days=31)
post.save()

assert ForumProfile.objects.power_users().count() == 0

# authenticated user with 3 posts within the last 30 days
poweruser = ForumProfileFactory()
topic4 = TopicFactory(with_post=True, poster=poweruser.user)
PostFactory.create_batch(2, topic=topic4, poster=poweruser.user)

# authenticated user with more than 3 posts within the last 30 days
bigpoweruser = ForumProfileFactory()
topic5 = TopicFactory(with_post=True, poster=bigpoweruser.user)
PostFactory.create_batch(20, topic=topic5, poster=bigpoweruser.user)

assert bigpoweruser == ForumProfile.objects.power_users().first()
assert poweruser == ForumProfile.objects.power_users().last()
assert ForumProfile.objects.power_users().count() == 2
16 changes: 0 additions & 16 deletions lacommunaute/forum_member/tests/tests_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from machina.test.factories.forum import create_forum
from pytest_django.asserts import assertContains, assertNotContains

from lacommunaute.forum_conversation.factories import PostFactory, TopicFactory
from lacommunaute.forum_member.factories import ForumProfileFactory
from lacommunaute.forum_member.models import ForumProfile
from lacommunaute.forum_member.shortcuts import get_forum_member_display_name
Expand Down Expand Up @@ -112,21 +111,6 @@ def test_queries_number(self):
self.client.get(self.url)


class TestLeaderBoardListView:
def test_content(self, client, db):
undesired_forum_profile = ForumProfileFactory()
desired_forum_profile = ForumProfileFactory()
topic = TopicFactory(with_post=True, poster=desired_forum_profile.user)
PostFactory.create_batch(2, topic=topic, poster=desired_forum_profile.user)

response = client.get(reverse("members:leaderboard"))
assertContains(response, get_forum_member_display_name(desired_forum_profile.user))
assertNotContains(response, get_forum_member_display_name(undesired_forum_profile.user))
assert (
response.context_data["subtitle"] == "Contributeurs authentifiés les plus actifs sur les 30 derniers jours"
)


class TestSeekersListView:
def test_content(self, client, db):
undesired_forum_profile = ForumProfileFactory()
Expand Down
2 changes: 0 additions & 2 deletions lacommunaute/forum_member/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from lacommunaute.forum_member.views import (
ForumProfileDetailView,
ForumProfileUpdateView,
LeaderBoardListView,
ModeratorProfileListView,
SeekersListView,
)
Expand All @@ -15,6 +14,5 @@
path("profile/edit/", ForumProfileUpdateView.as_view(), name="profile_update"),
path("profile/<str:username>/", ForumProfileDetailView.as_view(), name="profile"),
path("forum/<str:slug>-<int:pk>/", ModeratorProfileListView.as_view(), name="forum_profiles"),
path("leaderboard/", LeaderBoardListView.as_view(), name="leaderboard"),
path("seekers/", SeekersListView.as_view(), name="seekers"),
]
15 changes: 0 additions & 15 deletions lacommunaute/forum_member/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,6 @@ def get_context_data(self, **kwargs):
return context


class LeaderBoardListView(ListView):
model = ForumProfile
template_name = "forum_member/profiles.html"
context_object_name = "forum_profiles"
paginate_by = 78

def get_queryset(self):
return ForumProfile.objects.power_users()

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["subtitle"] = "Contributeurs authentifiés les plus actifs sur les 30 derniers jours"
return context


class SeekersListView(ListView):
model = ForumProfile
template_name = "forum_member/seekers_profiles.html"
Expand Down
Loading

0 comments on commit 4493267

Please sign in to comment.