Skip to content

Commit

Permalink
Bugfix: Events register button incorrectly showing (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb authored Nov 6, 2024
1 parent 46ca9a0 commit c5ea2a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 11 additions & 3 deletions src/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,18 @@ def get_template(self, request, *args, **kwargs):
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)

is_online = self.event_type in {
types.EventType.ONLINE,
types.EventType.HYBRID,
}
is_in_person = self.event_type in {
types.EventType.IN_PERSON,
types.EventType.HYBRID,
}

context.update(
is_online=self.event_type == types.EventType.ONLINE,
is_in_person=self.event_type == types.EventType.IN_PERSON,
is_hybrid=self.event_type == types.EventType.HYBRID,
is_online=is_online,
is_in_person=is_in_person,
event_date_range=get_event_datetime_display_string(self),
)

Expand Down
10 changes: 5 additions & 5 deletions src/events/templates/events/event_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@
{% endif %}
<dt>Event type</dt>
<dd>
{% if is_online or is_in_person %}
{{ page.get_event_type_display }}
{% else %}
{% if is_online and is_in_person %}
In person or online
{% else %}
{{ page.get_event_type_display }}
{% endif %}
</dd>
</dl>
{% if not page.is_past_event %}
{% if page.offline_event_url and is_in_person or is_hybrid %}
{% if page.offline_event_url and is_in_person %}
<a href="{{ page.offline_event_url }}"
class="dwds-button dwds-button--inline dwds-button--secondary"
target="_blank">Register to join</a>
{% endif %}
{% if page.online_event_url and is_online or is_hybrid %}
{% if page.online_event_url and is_online %}
<a href="{{ page.online_event_url }}"
class="dwds-button dwds-button--inline dwds-button--secondary"
target="_blank">Watch event online</a>
Expand Down

0 comments on commit c5ea2a5

Please sign in to comment.