-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cff448
commit 9f85cfb
Showing
2 changed files
with
25 additions
and
14 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
exporter/applications/templatetags/show_application_link.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django import template | ||
from django.utils.safestring import mark_safe | ||
from django.urls import reverse | ||
|
||
|
||
register = template.Library() | ||
|
||
@register.simple_tag | ||
def show_application_link(application, template="application_link.html"): | ||
is_f680_application = application['case_type']['sub_type']['key'] == 'f680_clearance' | ||
is_draft_or_editiable = application['status']['key'] == "draft" or application['status']['key'] == "applicant_editing" | ||
application_display_text = application['name'] | ||
|
||
if is_f680_application and is_draft_or_editiable: | ||
link_target = reverse("f680:summary", kwargs={"pk": application["id"]}) | ||
elif is_f680_application and not is_draft_or_editiable: | ||
link_target = "#" | ||
elif not is_f680_application and is_draft_or_editiable: | ||
link_target = reverse("applications:task_list", kwargs={"pk": application["id"]}) | ||
else: | ||
link_target = reverse("applications:application", kwargs={"pk": application["id"]}) | ||
|
||
return mark_safe(f'<a class="govuk-link govuk-link--no-visited-state app-icon-label" href="{link_target}">{application_display_text}</a>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters