diff --git a/opentech/apply/funds/templates/funds/includes/status_bar.html b/opentech/apply/funds/templates/funds/includes/status_bar.html index 042260bda01a8ae7210d619585ae4b3ffc6afdf9..eb5235a2ec9213c99817cb3f12941e53e70e6e78 100644 --- a/opentech/apply/funds/templates/funds/includes/status_bar.html +++ b/opentech/apply/funds/templates/funds/includes/status_bar.html @@ -1,3 +1,4 @@ +{% load statusbar_tags %} <div class="status-bar {{ class }}"> {% for phase in phases %} {% ifchanged phase.step %} @@ -8,23 +9,8 @@ status-bar__item--is-complete {% endif %}"> <span class="status-bar__tooltip" - {% if phase.step != current_phase.step %} - {% if phase.step > current_phase.step %} - data-title="{{ phase.future_name }}" aria-label="{{ current_phase.future_name }}" - {% else %} - {% if public %} - data-title="{{ phase.public_name }}" aria-label="{{ phase.public_name }}" - {% else %} - data-title="{{ phase }}" aria-label="{{ phase }}" - {% endif %} - {% endif %} - {% else %} - {% if public %} - data-title="{{ current_phase.public_name }}" aria-label="{{ current_phase.public_name }}" - {% else %} - data-title="{{ current_phase }}" aria-label="{{ current_phase }}" - {% endif %} - {% endif %} + {% status_display current_phase phase public as display_text %} + data-title="{{ display_text }}" aria-label="{{ display_text }}" ></span> <svg class="status-bar__icon"><use xlink:href="#tick-alt"></use></svg> </div> diff --git a/opentech/apply/funds/templatetags/statusbar_tags.py b/opentech/apply/funds/templatetags/statusbar_tags.py index ae889c972a966dcaf3dea5b3bd9cd215cda6f34a..438adb2180ffe5c9c604c5f432f5e3e8a618779e 100644 --- a/opentech/apply/funds/templatetags/statusbar_tags.py +++ b/opentech/apply/funds/templatetags/statusbar_tags.py @@ -34,3 +34,23 @@ def status_bar(workflow, current_phase, user, css_class='', same_stage=False): 'class': css_class, 'public': user.is_applicant, } + + +@register.simple_tag() +def status_display(current_phase, phase, public): + if phase.step == current_phase.step: + if public: + return current_phase.public_name + else: + return current_phase.display_name + + if phase.step > current_phase.step: + if public: + return phase.future_name_public + else: + return phase.future_name_staff + + if public: + return phase.public_name + else: + return phase.display_name diff --git a/opentech/apply/funds/workflow.py b/opentech/apply/funds/workflow.py index f6336b9fc731b51710d58a54a3fdd436f6b74da4..39cb99ecd230dee979b823c34a8be8502f15e542 100644 --- a/opentech/apply/funds/workflow.py +++ b/opentech/apply/funds/workflow.py @@ -73,12 +73,11 @@ class Phase: self.name = name self.display_name = display if public and future: - # This prevent having to check that the display name fallback is ok for the - # public to see raise ValueError("Cant provide both a future and a public name") self.public_name = public or self.display_name - self.future_name = future or self.display_name + self.future_name_staff = future or self.display_name + self.future_name_public = future or self.public_name self.stage = stage self.permissions = Permissions(permissions) self.step = step @@ -477,7 +476,7 @@ DoubleStageDefinition = [ { 'invited_to_proposal': { 'display': 'Concept Accepted', - 'future': 'Preliminary Decision', + 'future': 'Preliminary Determination', 'transitions': { 'draft_proposal': { 'display': 'Progress', @@ -623,7 +622,7 @@ DoubleStageDefinition = [ { 'proposal_accepted': { 'display': 'Accepted', - 'future': 'Application Outcome', + 'future': 'Final Determination', 'stage': Proposal, 'permissions': no_permissions, },