From 7ed8ecb9a62b59eeeba8cc1bf383c8be93f085c0 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Mon, 21 Jan 2019 09:52:46 +0000
Subject: [PATCH] Show the future states to staff

---
 .../funds/templates/funds/includes/status_bar.html   | 12 ++++++------
 opentech/apply/funds/workflow.py                     |  7 ++++++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/opentech/apply/funds/templates/funds/includes/status_bar.html b/opentech/apply/funds/templates/funds/includes/status_bar.html
index 5134aa5b2..042260bda 100644
--- a/opentech/apply/funds/templates/funds/includes/status_bar.html
+++ b/opentech/apply/funds/templates/funds/includes/status_bar.html
@@ -9,14 +9,14 @@
                         {% endif %}">
                 <span class="status-bar__tooltip"
                 {% if phase.step != current_phase.step %}
-                    {% if public %}
-                        {% if phase.step > current_phase.step %}
-                            data-title="{{ phase.future_name }}" aria-label="{{ current_phase.future_name }}"
+                    {% 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.public_name }}" aria-label="{{ phase.public_name }}"
+                            data-title="{{ phase }}" aria-label="{{ phase }}"
                         {% endif %}
-                    {% else %}
-                        data-title="{{ phase }}" aria-label="{{ phase }}"
                     {% endif %}
                 {% else %}
                     {% if public %}
diff --git a/opentech/apply/funds/workflow.py b/opentech/apply/funds/workflow.py
index 835d6be56..f6336b9fc 100644
--- a/opentech/apply/funds/workflow.py
+++ b/opentech/apply/funds/workflow.py
@@ -72,8 +72,13 @@ class Phase:
     def __init__(self, name, display, stage, permissions, step, public=None, future=None, transitions=dict()):
         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.public_name
+        self.future_name = future or self.display_name
         self.stage = stage
         self.permissions = Permissions(permissions)
         self.step = step
-- 
GitLab