Skip to content

Commit

Permalink
Add Speaker profile features
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed Jul 9, 2024
1 parent 3a7ce23 commit ff6e7ff
Show file tree
Hide file tree
Showing 28 changed files with 1,401 additions and 181 deletions.
40 changes: 38 additions & 2 deletions backend/src/ploneconf/content/person.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from plone import api
from plone.app.multilingual.dx import directives as ml_directives
from plone.autoform import directives
from plone.dexterity.content import Container
from plone.schema.email import Email
from ploneconf import _
from typing import List
from zope import schema
from zope.interface import implementer
from zope.interface import Interface


PERMISSION = "cmf.ModifyPortalContent"


ACTIVITIES_TO_LABELS = {
"Keynote": "keynote-speaker",
"Talk": "speaker",
Expand All @@ -17,10 +23,36 @@
class IPerson(Interface):
"""Plone Conference Person."""

title = schema.TextLine(title=_("label_name", default="Name"), required=True)

description = schema.Text(
title=_("label_biography", default="Short Biography"),
description=_(
"help_description", default="Used in item listings and search results."
),
required=False,
missing_value="",
)
directives.order_before(description="*")
directives.order_before(title="*")
ml_directives.languageindependent("title")

email = Email(
title=_("Email address"),
description=_("Personal e-mail address"),
)
ml_directives.languageindependent("email")

categories = schema.List(
title=_("Categories"),
value_type=schema.Choice(
vocabulary="ploneconf.vocabularies.person_labels",
),
default=[],
required=False,
)
directives.read_permission(categories=PERMISSION, email=PERMISSION)
directives.write_permission(categories=PERMISSION, email=PERMISSION)


@implementer(IPerson)
Expand All @@ -37,15 +69,19 @@ def activities(self):
return [i.from_object for i in relations]

@property
def labels(self) -> List[str]:
def labels(self) -> List[dict]:
"""Return a list of labels to be applied to this person.
:returns: List of labels.
"""
activities = self.activities
labels = set()
categories = self.categories
activities = self.activities
for category in categories:
labels.add(category)
for activity in activities:
portal_type = activity.portal_type
if portal_type in ACTIVITIES_TO_LABELS:
labels.add(ACTIVITIES_TO_LABELS[portal_type])

return list(labels)
90 changes: 71 additions & 19 deletions backend/src/ploneconf/locales/en/LC_MESSAGES/ploneconf.po
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ msgstr ""
msgid "Audience"
msgstr ""

#: ploneconf/content/person.py:47
msgid "Categories"
msgstr ""

#: ploneconf/profiles/default/types/Sponsor.xml
msgid "Conference Sponsor."
msgstr ""
Expand All @@ -69,12 +73,12 @@ msgid "Duration of the training"
msgstr ""

#: ploneconf/profiles/default/types/Keynote.xml
#: ploneconf/profiles/default/types/Person.xml
#: ploneconf/profiles/default/types/Slot.xml
#: ploneconf/profiles/default/types/Sponsor.xml
msgid "Edit"
msgstr ""

#: ploneconf/content/person.py:21
#: ploneconf/content/person.py:41
msgid "Email address"
msgstr ""

Expand All @@ -94,11 +98,19 @@ msgstr ""
msgid "End time must be after start time."
msgstr ""

#: ploneconf/behaviors/links.py:41
#: ploneconf/behaviors/links.py:78
msgid "Facebook"
msgstr ""

#: ploneconf/behaviors/links.py:79
msgid "Facebook page url"
msgstr ""

#: ploneconf/behaviors/links.py:43
msgid "GitHub"
msgstr ""

#: ploneconf/behaviors/links.py:42
#: ploneconf/behaviors/links.py:44
msgid "GitHub profile organization"
msgstr ""

Expand All @@ -114,48 +126,56 @@ msgstr ""
msgid "Initial content for our website."
msgstr ""

#: ploneconf/behaviors/links.py:55
#: ploneconf/behaviors/links.py:57
msgid "Instagram"
msgstr ""

#: ploneconf/behaviors/links.py:56
#: ploneconf/behaviors/links.py:58
msgid "Instagram profile url"
msgstr ""

#: ploneconf/profiles.zcml:30
msgid "Install Production pas.plugins.authomatic."
msgstr ""

#: ploneconf/vocabularies/person.py:16
msgid "Instructor"
msgstr ""

#: ploneconf/profiles/default/types/Keynote.xml
msgid "Keynote"
msgstr ""

#: ploneconf/vocabularies/person.py:14
msgid "Keynote Speaker"
msgstr ""

#: ploneconf/behaviors/session.py:36
#: ploneconf/profiles/default/registry/plone.app.querystring.interfaces.IQueryField.xml
msgid "Level"
msgstr ""

#: ploneconf/behaviors/links.py:28
#: ploneconf/behaviors/links.py:30
msgid "Link to site"
msgstr ""

#: ploneconf/behaviors/links.py:62
#: ploneconf/behaviors/links.py:64
msgid "LinkedIn"
msgstr ""

#: ploneconf/behaviors/links.py:63
#: ploneconf/behaviors/links.py:65
msgid "LinkedIn profile url"
msgstr ""

#: ploneconf/behaviors/links.py:15
msgid "Links"
msgstr ""

#: ploneconf/behaviors/links.py:48
#: ploneconf/behaviors/links.py:50
msgid "Mastodon"
msgstr ""

#: ploneconf/behaviors/links.py:49
#: ploneconf/behaviors/links.py:51
msgid "Mastodon profile url"
msgstr ""

Expand All @@ -179,7 +199,7 @@ msgstr ""
msgid "Person Label"
msgstr ""

#: ploneconf/content/person.py:22
#: ploneconf/content/person.py:42
msgid "Personal e-mail address"
msgstr ""

Expand All @@ -199,6 +219,10 @@ msgstr ""
msgid "Plone Conference 2024: Uninstall"
msgstr ""

#: ploneconf/vocabularies/person.py:17
msgid "Plone Foundation Member"
msgstr ""

#: ploneconf/profiles.zcml:13
msgid "Policy package to install our site"
msgstr ""
Expand Down Expand Up @@ -227,7 +251,7 @@ msgstr ""
msgid "Should this level be displayed on the FrontPage?"
msgstr ""

#: ploneconf/behaviors/links.py:27
#: ploneconf/behaviors/links.py:29
msgid "Site"
msgstr ""

Expand All @@ -243,6 +267,10 @@ msgstr ""
msgid "Slot"
msgstr ""

#: ploneconf/vocabularies/person.py:15
msgid "Speaker"
msgstr ""

#: ploneconf/profiles/default/types/Sponsor.xml
msgid "Sponsor"
msgstr ""
Expand Down Expand Up @@ -313,34 +341,58 @@ msgid "Video embed code"
msgstr ""

#: ploneconf/profiles/default/types/Keynote.xml
#: ploneconf/profiles/default/types/Person.xml
#: ploneconf/profiles/default/types/Slot.xml
#: ploneconf/profiles/default/types/Sponsor.xml
msgid "View"
msgstr ""

#: ploneconf/content/sponsors/sponsor_level.py:14
msgid "Visibility"
msgstr ""

#: ploneconf/behaviors/links.py:34
#: ploneconf/behaviors/links.py:36
msgid "X"
msgstr ""

#: ploneconf/behaviors/links.py:35
#: ploneconf/behaviors/links.py:37
msgid "X profile url"
msgstr ""

#: ploneconf/behaviors/links.py:71
msgid "YouTube"
msgstr ""

#: ploneconf/behaviors/links.py:72
msgid "YouTube channel url"
msgstr ""

#. Default: "Used in item listings and search results."
#: ploneconf/content/sponsors/sponsor.py:18
#: ploneconf/content/person.py:30
#: ploneconf/content/sponsors/sponsor.py:22
msgid "help_description"
msgstr ""

#. Default: "Short Biography"
#: ploneconf/content/person.py:29
msgid "label_biography"
msgstr ""

#. Default: "Summary"
#: ploneconf/content/sponsors/sponsor.py:17
#: ploneconf/content/sponsors/sponsor.py:21
msgid "label_description"
msgstr ""

#. Default: "Name"
#: ploneconf/content/person.py:26
msgid "label_name"
msgstr ""

#. Default: "Text"
#: ploneconf/content/sponsors/sponsor.py:32
msgid "label_text"
msgstr ""

#. Default: "Title"
#: ploneconf/content/sponsors/sponsor.py:14
#: ploneconf/content/sponsors/sponsor.py:18
msgid "label_title"
msgstr ""
Loading

0 comments on commit ff6e7ff

Please sign in to comment.