Skip to content

Dashboard statusbar tags

hypha.apply.dashboard.templatetags.dashboard_statusbar_tags

register module-attribute

register = Library()

project_status_bar

project_status_bar(current_status, user, author=False, css_class='')
Source code in hypha/apply/dashboard/templatetags/dashboard_statusbar_tags.py
@register.inclusion_tag("dashboard/includes/project_status_bar.html")
def project_status_bar(current_status, user, author=False, css_class=""):
    is_applicant = user == author if author else user.is_applicant

    statuses = PROJECT_STATUS_CHOICES

    if is_applicant:
        statuses = PROJECT_PUBLIC_STATUSES

    return {
        "statuses": statuses,
        "current_status_index": [status for status, _ in PROJECT_STATUS_CHOICES].index(
            current_status
        ),
        "current_status": current_status,
        "class": css_class,
    }