Skip to content

Commit

Permalink
Merge pull request #2701 from carpentries/feature/2696-link-to-other-…
Browse files Browse the repository at this point in the history
…related-scheduled-emails

[Emails] Link to other related scheduled emails
  • Loading branch information
pbanaszkiewicz authored Sep 15, 2024
2 parents 7577f1b + eded8e0 commit 9e77ae7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
4 changes: 1 addition & 3 deletions amy/templates/emails/email_template_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
{% if email_templates %}
<table class="table table-striped">
<tr>
<th>ID</th>
<th>Name</th>
<th>Active</th>
<th>Signal</th>
Expand All @@ -25,8 +24,7 @@
</tr>
{% for template in email_templates %}
<tr>
<td><a href="{{ template.get_absolute_url }}">{{ template.id }}</a></td>
<td>{{ template.name }}</td>
<td><a href="{{ template.get_absolute_url }}">{{ template.name }}</a></td>
<td>{{ template.active|yesno }}</td>
<td><code>{{ template.signal }}</code></td>
<td>{{ template.from_header }}</td>
Expand Down
14 changes: 13 additions & 1 deletion amy/templates/includes/event_details_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,20 @@
</td></tr>
<tr>
<th>Related scheduled emails:</th>
<td>
<td colspan="2">
{% include "includes/related_scheduled_emails.html" with object=event %}
</td>
</tr>
<tr>
<th>Related scheduled emails for recruitments:</th>
<td colspan="2">
{% with signups=related_instructor_recruitment_signups %}
{% for signup in signups %}
{% include "includes/related_scheduled_emails_no_empty_msg.html" with object=signup %}
{% empty %}
&mdash;
{% endfor %}
{% endwith %}
</td>
</tr>
</table>
14 changes: 13 additions & 1 deletion amy/templates/workshops/person.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,19 @@
{% with awards=person.award_set.all %}
{% for award in awards %}
{% include "includes/related_scheduled_emails_no_empty_msg.html" with object=award %}
{% empty%}
{% empty %}
&mdash;
{% endfor %}
{% endwith %}
</td>
</tr>
<tr>
<th>Related scheduled emails for recruitments:</th>
<td>
{% with signups=person.instructorrecruitmentsignup_set.all %}
{% for signup in signups %}
{% include "includes/related_scheduled_emails_no_empty_msg.html" with object=signup %}
{% empty %}
&mdash;
{% endfor %}
{% endwith %}
Expand Down
8 changes: 8 additions & 0 deletions amy/workshops/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
)
from emails.signals import persons_merged_signal
from fiscal.models import MembershipTask
from recruitment.models import InstructorRecruitmentSignup
from workshops.base_views import (
AMYCreateView,
AMYDeleteView,
Expand Down Expand Up @@ -1087,6 +1088,12 @@ def event_details(request, slug):
admin_lookup_form.helper = BootstrapHelper(
form_action=reverse("event_assign", args=[slug]), add_cancel_button=False
)
if hasattr(event, "instructorrecruitment"):
instructor_recruitment_signups = InstructorRecruitmentSignup.objects.filter(
recruitment=event.instructorrecruitment
)
else:
instructor_recruitment_signups = []

context = {
"title": "Event {0}".format(event),
Expand All @@ -1109,6 +1116,7 @@ def event_details(request, slug):
"longitude": event.longitude,
},
"recruitment_stats": recruitment_stats,
"related_instructor_recruitment_signups": instructor_recruitment_signups,
}
return render(request, "workshops/event.html", context)

Expand Down

0 comments on commit 9e77ae7

Please sign in to comment.