Skip to content

Commit

Permalink
Merge pull request #560 from OpenUpSA/fix/old-committee-meetings
Browse files Browse the repository at this point in the history
Fallbacks for old event committee meetings without linked committee
  • Loading branch information
paulmwatson authored Aug 14, 2024
2 parents f3c8839 + 6952045 commit 7b16b45
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
17 changes: 14 additions & 3 deletions pmg/templates/committee_layout.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
{% extends "base.html" %}

{% block title %}{{ committee.name }} | PMG{% endblock %}
{% block title %}
{% if committee %}
{{ committee.name }} |
{% endif %}
PMG
{% endblock %}

{% block breadcrumb %}
<ol class="breadcrumb">
{% block committee_breadcrumb %}
{% if not from_page %}
<li><a href="{{ url_for('committees') }}">Committees</a></li>
<li><a href="/committees#{% if committee.house.sphere == 'provincial' %}prov{% elif committee.ad_hoc %}adhoc{% else %}{{ committee.house.short_name }}{% endif %}">{{ committee.house.name }}</a></li>
{% if committee %}
<li><a href="/committees#{% if committee.house.sphere == 'provincial' %}prov{% elif committee.ad_hoc %}adhoc{% else %}{{ committee.house.short_name }}{% endif %}">{{ committee.house.name }}</a></li>
{% endif %}
{% else %}
<li><a href="{{ url_for('provincial_legislatures_list') }}">Provincial Legislatures</a></li>
<li><a href="{{ url_for('provincial_legislatures_detail', slug=from_page) }}">{{ committee.house.name }}</a></li>
{% if committee %}
<li><a href="{{ url_for('provincial_legislatures_detail', slug=from_page) }}">{{ committee.house.name }}</a></li>
{% endif %}
<li><a href="{{ url_for('provincial_committees', slug=from_page) }}">Committees</a></li>
{% endif %}
{% endblock %}
Expand All @@ -22,6 +31,7 @@
<div class="col-sm-8">
<header class="committee-header">
{% block committee_title %}
{% if committee %}
<div class="row">
{% if not committee.premium %}
<h1 class="col-xs-12 committee-name">{{ committee.name }}</h1>
Expand All @@ -36,6 +46,7 @@ <h4 class="light-red">{{ committee.house.name }}</h4>
<h4 class="light-red">{{ committee.house.name }} Committee</h4>
{% endif %}
<div class="{% if not committee.about %}no-about{% endif %}">{% include '_social_sharing.html' %}</div>
{% endif %}
{% endblock %}
</header>

Expand Down
6 changes: 5 additions & 1 deletion pmg/templates/committee_meeting.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

{% block committee_breadcrumb %}
{{ super() }}
<li><a href="{{ url_for('committee_detail', committee_id=committee.id) }}">{{ committee.name }}</a></li>
{% if committee %}
<li><a href="{{ url_for('committee_detail', committee_id=committee.id) }}">{{ committee.name }}</a></li>
{% endif %}
{% endblock %}

{% block javascript %}
Expand All @@ -20,7 +22,9 @@ <h1>{{ event.title }}</h1>
{% if event.premium_but_free %}
<div class="premium-but-free"><i class="fa fa-fw fa-unlock-alt" aria-hidden="true"></i> This premium content has been made freely available</div>
{% endif %}
{% if committee %}
<h4><a href="{{ url_for('committee_detail', committee_id=committee.id) }}">{{ committee.name }}</a></h4>
{% endif %}
{% if event.date %}
<h5 class="date">{{ event.date | pretty_date("long") }}</h5>
{% endif %}
Expand Down
8 changes: 6 additions & 2 deletions pmg/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,14 @@ def committee_meeting(event_id):
) + sorted(
[a for a in attendance if not a["chairperson"]], key=sorter
) # noqa
if event["committee"]:
event_committee_name = event["committee"]["name"]
else:
event_committee_name = "[UNKNOWN COMMITTEE]"
if event["chairperson"]:
social_summary = (
"A meeting of the "
+ event["committee"]["name"]
+ event_committee_name
+ " committee held on "
+ pretty_date(event["date"], "long")
+ ", lead by "
Expand All @@ -811,7 +815,7 @@ def committee_meeting(event_id):
else:
social_summary = (
"A meeting of the "
+ event["committee"]["name"]
+ event_committee_name
+ " committee held on "
+ pretty_date(event["date"], "long")
+ "."
Expand Down

0 comments on commit 7b16b45

Please sign in to comment.