Skip to content

Commit

Permalink
Add local unit local branch name in email context (#2368)
Browse files Browse the repository at this point in the history
  • Loading branch information
susilnem authored Jan 3, 2025
1 parent 6d1bce5 commit 4ba9aa5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions local_units/dev_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ def get(self, request):
if context is None:
return HttpResponse("No context found for the email preview.")

context["local_branch_name"] = "Test Local Branch"
template = loader.get_template("email/local_units/local_unit.html")
return HttpResponse(template.render(context, request))
1 change: 1 addition & 0 deletions local_units/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def get_email_context(instance):
local_unit_data = PrivateLocalUnitSerializer(instance).data
email_context = {
"id": local_unit_data["id"],
"local_branch_name": local_unit_data["local_branch_name"],
"frontend_url": settings.FRONTEND_URL,
}
return email_context
Expand Down
14 changes: 7 additions & 7 deletions notifications/templates/email/local_units/local_unit.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,43 @@ <h3>Dear {{full_name}}</h3>
<tr>
{% if new_local_unit %}
<td align="center" class="pb-30">
A new local unit has been added and is awaiting your validation. Kindly review the information and validate or delete as necessary.
A new local unit "{{local_branch_name}}" has been added and is awaiting your validation. Kindly review the information and validate or delete as necessary.
</td>
{% endif %}

{% if update_local_unit %}
<td align="center" class="pb-30">
The local unit has been updated and is awaiting your validation. Kindly review the information and validate or delete as necessary.
The local unit "{{local_branch_name}}" has been updated and is awaiting your validation. Kindly review the information and validate or delete as necessary.
</td>
{% endif %}

{% if validate_success %}
<td align="center" class="pb-30">
Your request for the local unit has been successfully validated. The local unit is now visible and marked as validated.
Your request for the local unit "{{local_branch_name}}" has been successfully validated. The local unit is now visible and marked as validated.
</td>
{% endif %}

{% if revert_reason %}
<td align="center" class="pb-30">
Your local unit has been reverted. {{revert_reason}}. Please review and resubmit if applicable.
Your local unit "{{local_branch_name}}" has been reverted. {{revert_reason}}. Please review and resubmit if applicable.
</td>
{% endif %}

{% if deprecate_local_unit %}
<td align="center" class="pb-30">
Your local unit has been deprecated. {{deprecate_reason}}. Please contact the administrator for more information.
Your local unit "{{local_branch_name}}" has been deprecated. {{deprecate_reason}}. Please contact the administrator for more information.
</td>
{% endif %}

{% if is_validator_regional_admin %}
<td align="center" class="pb-30">
The new local unit has been pending validation for over 14 days. Kindly review and validate or delete as necessary.
The new local unit "{{local_branch_name}}" has been pending validation for over 14 days. Kindly review and validate or delete as necessary.
</td>
{% endif %}

{% if is_validator_global_admin %}
<td align="center" class="pb-30">
The new local unit has been pending validation for over 28 days and requires your attention. Please review and validate
The new local unit "{{local_branch_name}}" has been pending validation for over 28 days and requires your attention. Please review and validate
or delete as necessary.
</td>
{% endif %}
Expand Down

0 comments on commit 4ba9aa5

Please sign in to comment.