From 9845ba5c5187a9ee23337639172736565b9f646a Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Sun, 21 Nov 2021 09:34:54 +0100 Subject: [PATCH] Update link component --- TODO | 1 - app/website/consumers.py | 12 +++++++----- app/website/templates/components/link.html | 5 ++++- app/website/templates/layouts/base.html | 6 +++--- app/website/templates/pages/profiles.html | 6 ++++-- app/website/templates/pages/talk-single.html | 2 +- app/website/templates/pages/talks.html | 7 ++----- app/website/views.py | 12 ++++++++---- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/TODO b/TODO index 920391b..c4a7705 100644 --- a/TODO +++ b/TODO @@ -1,2 +1 @@ -- List profiles with talks - Chat \ No newline at end of file diff --git a/app/website/consumers.py b/app/website/consumers.py index 1253048..39d52ac 100644 --- a/app/website/consumers.py +++ b/app/website/consumers.py @@ -50,10 +50,11 @@ class WebsiteConsumer(AsyncWebsocketConsumer): # Single talk if data["value"] == "single-talk": await self.channel_layer.group_send( - self.room_group_name, { + self.room_group_name, + { "type": "send_page_single_talk", - "id": data["id"], - } + "id": data["id"], + }, ) # Profiles if data["value"] == "profiles": @@ -70,10 +71,11 @@ class WebsiteConsumer(AsyncWebsocketConsumer): # Search if data["value"] == "search-talks": await self.channel_layer.group_send( - self.room_group_name, { + self.room_group_name, + { "type": "send_page_search", "search": data["search"], - } + }, ) # Pages diff --git a/app/website/templates/components/link.html b/app/website/templates/components/link.html index 75447c9..b441f64 100644 --- a/app/website/templates/components/link.html +++ b/app/website/templates/components/link.html @@ -6,6 +6,9 @@ {% if page %} {% endif %} + {% if id %} + + {% endif %} {# Button #} - + {{ children }} \ No newline at end of file diff --git a/app/website/templates/layouts/base.html b/app/website/templates/layouts/base.html index 95e3c5f..932bfa0 100644 --- a/app/website/templates/layouts/base.html +++ b/app/website/templates/layouts/base.html @@ -30,15 +30,15 @@ diff --git a/app/website/templates/pages/profiles.html b/app/website/templates/pages/profiles.html index 174189a..1139539 100644 --- a/app/website/templates/pages/profiles.html +++ b/app/website/templates/pages/profiles.html @@ -1,4 +1,5 @@ {% load static %} +{% load slippers %}
{# List Profiles #}
@@ -9,14 +10,15 @@ {{ profile.full_name }}

- {# {{ profile.full_name }} #} + {{ profile.full_name }}

Talks

    {% for talk in profile.talkspeaker.all %}
  • - {{ talk.title }} + + {% #link action="page" value="single-talk" id=talk.id scroll-up="true" %}{{ talk.title }}{% /link %}
  • {% endfor %}
diff --git a/app/website/templates/pages/talk-single.html b/app/website/templates/pages/talk-single.html index 0708332..8593602 100644 --- a/app/website/templates/pages/talk-single.html +++ b/app/website/templates/pages/talk-single.html @@ -13,6 +13,6 @@
Author {{ talk.author.full_name }} - {{ talk.category.name }}

- {% #link text="Back" action="page" value="talks" page=1 %}{% /link %} + {% #link action="page" value="talks" page=1 %}More talks{% /link %}

\ No newline at end of file diff --git a/app/website/templates/pages/talks.html b/app/website/templates/pages/talks.html index 9e94d56..de81ace 100644 --- a/app/website/templates/pages/talks.html +++ b/app/website/templates/pages/talks.html @@ -23,10 +23,7 @@ {% if talks %} {% for talk in talks %}
- - - - + {% #link action="page" value="single-talk" id=talk.id %}
@@ -41,7 +38,7 @@

-
+ {% /link %}
{% endfor %} {% else %} diff --git a/app/website/views.py b/app/website/views.py index da34fa5..10e7fb6 100644 --- a/app/website/views.py +++ b/app/website/views.py @@ -40,11 +40,15 @@ def page_single_talk(id): }, ) + def page_profiles(): return render_to_string( "pages/profiles.html", { - "profiles": Profile.objects.filter(talkspeaker__isnull=False).order_by("full_name").distinct().all(), + "profiles": Profile.objects.filter(talkspeaker__isnull=False) + .order_by("full_name") + .distinct() + .all(), }, ) @@ -57,9 +61,9 @@ def page_results(search): return render_to_string( "pages/talks.html", { - "talks": Talk.objects.filter( - title__icontains=search.lower() - ).order_by("title"), + "talks": Talk.objects.filter(title__icontains=search.lower()).order_by( + "title" + ), "search": search, }, )