From e7e79116542f01b45a854d66f4673f74d6de3564 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sat, 7 Oct 2023 09:38:31 +0200 Subject: [PATCH 1/2] Break up profile into sections, for easier styling --- .../users/templates/wafer.users/profile.html | 316 +++++++++--------- 1 file changed, 163 insertions(+), 153 deletions(-) diff --git a/wafer/users/templates/wafer.users/profile.html b/wafer/users/templates/wafer.users/profile.html index a517d82f..0408a5e1 100644 --- a/wafer/users/templates/wafer.users/profile.html +++ b/wafer/users/templates/wafer.users/profile.html @@ -5,153 +5,124 @@ {% block content %}
{% with profile=object.userprofile %} - {% block preamble %} - {% endblock preamble %} -
-
- {% block mugshot %} - {% with profile.avatar_url as avatar_url %} - {% if avatar_url != None %} - +
+ {% block preamble %} + {% endblock preamble %} +
+
+ {% block mugshot %} + {% with profile.avatar_url as avatar_url %} + {% if avatar_url != None %} + + {% endif %} + {% endwith %} + {% if can_edit %} + {% trans 'Edit Mugshot' %} +
+ {% blocktrans trimmed %} + Pictures provided by libravatar + (which falls back to Gravatar).
+ Change your picture there. + {% endblocktrans %} +
{% endif %} - {% endwith %} - {% if can_edit %} - {% trans 'Edit Mugshot' %} -
- {% blocktrans trimmed %} - Pictures provided by libravatar - (which falls back to Gravatar).
- Change your picture there. - {% endblocktrans %} -
- {% endif %} - {% endblock mugshot %} -
-
- {% block side_menu %} - {% if can_edit %} -
+
+ {% block side_menu %} + {% if can_edit %} + + {% endif %} + {% endblock side_menu %} + {% spaceless %} + {% block name %} +

+ {% if profile.homepage %} + + {% endif %} + {{ profile.display_name }} + {% if profile.homepage %} + + {% endif %} +

+ {% endblock name %} + {% block social %} + {% if profile.twitter_handle %} +

+ +

+ {% endif %} + {% if profile.github_username %} +

+ + {% blocktrans with username=profile.github_username %}GitHub: {{ username }}{% endblocktrans %} + +

+ {% endif %} + {% endblock social %} + {% endspaceless %} +
+
+ {% if profile.bio %} +
+ {{ profile.bio|linebreaks }} +
+ {% endif %} + {% if can_edit %} + {% if profile.pending_talks.exists or profile.accepted_talks.exists or profile.provisional_talks.exists%} + {% block speaker_registered %} + {% if profile.is_registered %} +
+ {% blocktrans trimmed %} + Registered + {% endblocktrans %} +
+ {% else %} +
+ {% blocktrans trimmed %} + WARNING: + Talk proposal submitted, but speaker hasn't registered to attend. + {% endblocktrans %} + {% if WAFER_REGISTRATION_OPEN %} + {% trans "Register now!" %} {% endif %} - {% endif %} - {% if WAFER_TALKS_OPEN %} -
  • {% trans 'Submit Talk Proposal' %}
  • - {% endif %} - - {% endif %} - {% endblock side_menu %} - {% spaceless %} - {% block name %} -

    - {% if profile.homepage %} - - {% endif %} - {{ profile.display_name }} - {% if profile.homepage %} - - {% endif %} -

    - {% endblock name %} - {% block social %} - {% if profile.twitter_handle %} -

    - +

    + {% endif %} + {% if WAFER_REGISTRATION_MODE == 'ticket' and profile.is_registered %} +

    Tickets: + {{ profile.ticket_types }}

    - {% endif %} - {% if profile.github_username %} -

    - - {% blocktrans with username=profile.github_username %}GitHub: {{ username }}{% endblocktrans %} - -

    - {% endif %} - {% endblock social %} - {% endspaceless %} -
    -
    - {% if profile.bio %} -
    - {{ profile.bio|linebreaks }} -
    - {% endif %} - {% if can_edit %} - {% if profile.pending_talks.exists or profile.accepted_talks.exists or profile.provisional_talks.exists%} - {% block speaker_registered %} - {% if profile.is_registered %} -
    - {% blocktrans trimmed %} - Registered - {% endblocktrans %} -
    - {% else %} -
    - {% blocktrans trimmed %} - WARNING: - Talk proposal submitted, but speaker hasn't registered to attend. - {% endblocktrans %} - {% if WAFER_REGISTRATION_OPEN %} - {% trans "Register now!" %} - {% endif %} -
    - {% endif %} - {% if WAFER_REGISTRATION_MODE == 'ticket' and profile.is_registered %} -

    Tickets: - {{ profile.ticket_types }} -

    - {% endif %} - {% endblock speaker_registered %} + {% endif %} + {% endblock speaker_registered %} + {% endif %} {% endif %} - {% endif %} +
    {# Accepted talks are globally visible #} {% if profile.accepted_talks.exists %} -

    {% trans 'Accepted Talks:' %}

    - {% for talk in profile.accepted_talks %} -
    -
    -

    - - {{ talk.title }} - -

    -

    {{ talk.abstract }}

    -
    -
    - {% endfor %} - {% endif %} - {% if profile.cancelled_talks.exists %} -

    {% trans 'Cancelled Talks:' %}

    - {% for talk in profile.cancelled_talks %} -
    -
    -

    - - {{ talk.title }} - -

    -

    {{ talk.abstract }}

    -
    -
    - {% endfor %} - {% endif %} - {# Submitted talk proposals are only visible to the owner #} - {% if can_edit %} - {% if profile.provisional_talks.exists %} -

    {% trans 'Provisionally Accepted Talks:' %}

    - {% for talk in profile.provisional_talks %} +
    +

    {% trans 'Accepted Talks:' %}

    + {% for talk in profile.accepted_talks %}

    @@ -163,22 +134,14 @@

    {% endfor %} - {% endif %} - {% if profile.pending_talks.exists %} -

    {% trans 'Submitted or Under Consideration Talks:' %}

    - {% for talk in profile.pending_talks %} +
    + {% endif %} + {% if profile.cancelled_talks.exists %} +
    +

    {% trans 'Cancelled Talks:' %}

    + {% for talk in profile.cancelled_talks %}
    - {% comment %} - Because this is one of the author's pending talks, we don't - need to check for edit permission's on the talk explictly. - This doesn't show the edit button for people with 'change-talk' - permissions, but we accept that tradeoff for simplicity here. - {% endcomment %} - - {% trans 'Edit' %} -

    {{ talk.title }} @@ -188,6 +151,53 @@

    {% endfor %} +
    + {% endif %} + {# Submitted talk proposals are only visible to the owner #} + {% if can_edit %} + {% if profile.provisional_talks.exists %} +
    +

    {% trans 'Provisionally Accepted Talks:' %}

    + {% for talk in profile.provisional_talks %} +
    +
    +

    + + {{ talk.title }} + +

    +

    {{ talk.abstract }}

    +
    +
    + {% endfor %} +
    + {% endif %} + {% if profile.pending_talks.exists %} +
    +

    {% trans 'Submitted or Under Consideration Talks:' %}

    + {% for talk in profile.pending_talks %} +
    +
    + {% comment %} + Because this is one of the author's pending talks, we don't + need to check for edit permission's on the talk explictly. + This doesn't show the edit button for people with 'change-talk' + permissions, but we accept that tradeoff for simplicity here. + {% endcomment %} + + {% trans 'Edit' %} + +

    + + {{ talk.title }} + +

    +

    {{ talk.abstract }}

    +
    +
    + {% endfor %} +
    {% endif %} {% endif %} {% endwith %} From 960eeaa015ca9ef8fb5dd1e81cc790c5a11efce4 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sat, 7 Oct 2023 10:20:02 +0200 Subject: [PATCH 2/2] Break up the profile page into snippets for easier customization. --- .../users/templates/wafer.users/profile.html | 207 +----------------- .../snippets/profile_10-preamble.html | 1 + .../wafer.users/snippets/profile_20-bio.html | 65 ++++++ .../wafer.users/snippets/profile_25-menu.html | 25 +++ .../snippets/profile_30-registered.html | 31 +++ .../snippets/profile_40-talks.html | 85 +++++++ .../snippets/profile_50-epilogue.html | 1 + 7 files changed, 215 insertions(+), 200 deletions(-) create mode 100644 wafer/users/templates/wafer.users/snippets/profile_10-preamble.html create mode 100644 wafer/users/templates/wafer.users/snippets/profile_20-bio.html create mode 100644 wafer/users/templates/wafer.users/snippets/profile_25-menu.html create mode 100644 wafer/users/templates/wafer.users/snippets/profile_30-registered.html create mode 100644 wafer/users/templates/wafer.users/snippets/profile_40-talks.html create mode 100644 wafer/users/templates/wafer.users/snippets/profile_50-epilogue.html diff --git a/wafer/users/templates/wafer.users/profile.html b/wafer/users/templates/wafer.users/profile.html index 0408a5e1..035b8d13 100644 --- a/wafer/users/templates/wafer.users/profile.html +++ b/wafer/users/templates/wafer.users/profile.html @@ -1,207 +1,14 @@ {% extends "wafer/base.html" %} -{% load i18n %} {% block title %}{{ object.userprofile.display_name }} - {{ WAFER_CONFERENCE_NAME }}{% endblock %} {% block container_class %}userprofile{% endblock %} {% block content %} -
    - {% with profile=object.userprofile %} -
    - {% block preamble %} - {% endblock preamble %} -
    -
    - {% block mugshot %} - {% with profile.avatar_url as avatar_url %} - {% if avatar_url != None %} - - {% endif %} - {% endwith %} - {% if can_edit %} - {% trans 'Edit Mugshot' %} -
    - {% blocktrans trimmed %} - Pictures provided by libravatar - (which falls back to Gravatar).
    - Change your picture there. - {% endblocktrans %} -
    - {% endif %} - {% endblock mugshot %} -
    -
    - {% block side_menu %} - {% if can_edit %} - - {% endif %} - {% endblock side_menu %} - {% spaceless %} - {% block name %} -

    - {% if profile.homepage %} - - {% endif %} - {{ profile.display_name }} - {% if profile.homepage %} - - {% endif %} -

    - {% endblock name %} - {% block social %} - {% if profile.twitter_handle %} -

    - -

    - {% endif %} - {% if profile.github_username %} -

    - - {% blocktrans with username=profile.github_username %}GitHub: {{ username }}{% endblocktrans %} - -

    - {% endif %} - {% endblock social %} - {% endspaceless %} -
    -
    - {% if profile.bio %} -
    - {{ profile.bio|linebreaks }} -
    - {% endif %} - {% if can_edit %} - {% if profile.pending_talks.exists or profile.accepted_talks.exists or profile.provisional_talks.exists%} - {% block speaker_registered %} - {% if profile.is_registered %} -
    - {% blocktrans trimmed %} - Registered - {% endblocktrans %} -
    - {% else %} -
    - {% blocktrans trimmed %} - WARNING: - Talk proposal submitted, but speaker hasn't registered to attend. - {% endblocktrans %} - {% if WAFER_REGISTRATION_OPEN %} - {% trans "Register now!" %} - {% endif %} -
    - {% endif %} - {% if WAFER_REGISTRATION_MODE == 'ticket' and profile.is_registered %} -

    Tickets: - {{ profile.ticket_types }} -

    - {% endif %} - {% endblock speaker_registered %} - {% endif %} - {% endif %} -
    - {# Accepted talks are globally visible #} - {% if profile.accepted_talks.exists %} -
    -

    {% trans 'Accepted Talks:' %}

    - {% for talk in profile.accepted_talks %} -
    -
    -

    - - {{ talk.title }} - -

    -

    {{ talk.abstract }}

    -
    -
    - {% endfor %} -
    - {% endif %} - {% if profile.cancelled_talks.exists %} -
    -

    {% trans 'Cancelled Talks:' %}

    - {% for talk in profile.cancelled_talks %} -
    -
    -

    - - {{ talk.title }} - -

    -

    {{ talk.abstract }}

    -
    -
    - {% endfor %} -
    - {% endif %} - {# Submitted talk proposals are only visible to the owner #} - {% if can_edit %} - {% if profile.provisional_talks.exists %} -
    -

    {% trans 'Provisionally Accepted Talks:' %}

    - {% for talk in profile.provisional_talks %} -
    -
    -

    - - {{ talk.title }} - -

    -

    {{ talk.abstract }}

    -
    -
    - {% endfor %} -
    - {% endif %} - {% if profile.pending_talks.exists %} - - {% endif %} - {% endif %} - {% endwith %} -
    +
    + {% include "wafer.users/snippets/profile_10-preamble.html" %} + {% include "wafer.users/snippets/profile_20-bio.html" %} + {% include "wafer.users/snippets/profile_30-registered.html" %} + {% include "wafer.users/snippets/profile_40-talks.html" %} + {% include "wafer.users/snippets/profile_50-epilogue.html" %} +
    {% endblock content %} {% block extra_foot %}