Skip to content

Conversation

@duartegalvao
Copy link
Member

This PR adds the ability to add placeholders on text (input and textarea) fields, which are then displayed to the user. It also adds a template for Certificates of Attendance.

This is done by adding a placeholders dict in the attributes of the field, like so:

  - name: text
    type: textarea
    attributes:
      label: Certificate Text
      value: >-
        The Organizing Comitee certifies that {person} ({person_affiliation}) participated in the event {event}, which took place {date}, at {venue}.
      placeholders:
        person: registration.personal_data.first_name
        person_affiliation: registration.personal_data.affiliation
        event: event.title
        date: event.start_dt
        venue: custom_fields.venue

And in the HTML, calling the format_html filter:

{{ custom_fields.text | format_html(
      person='<em>{} {}</em>'.format(personal_data.first_name | escape, personal_data.last_name | escape),
      person_affiliation='<em>{}</em>'.format(personal_data.affiliation | escape),
      event='<em>{}</em>'.format(event.title | escape),
      date=date,
      venue='<em>{}</em>'.format((custom_fields.venue or event.venue_name) | escape)
    ) }}

Resulting in this view when generating receipts:
image

The Certificate of Attendance looks like so:
image

@ThiefMaster ThiefMaster force-pushed the receipts-placeholders branch from 20f9873 to 84296e7 Compare October 30, 2024 15:38
@ThiefMaster ThiefMaster added this to the v3.3 milestone Oct 31, 2024
@ThiefMaster ThiefMaster merged commit 8cc13e8 into indico:master Oct 31, 2024
@ThiefMaster ThiefMaster deleted the receipts-placeholders branch October 31, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants