Skip to content

Commit 79b0618

Browse files
committed
HYP-300 - Added another panel header status for pending actions
1 parent 13d814e commit 79b0618

File tree

5 files changed

+37
-12
lines changed

5 files changed

+37
-12
lines changed

app/projects/panels.py

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
# For signup steps that will always be displayed no matter what actions are taken.
1111
SIGNUP_STEP_PERMANENT_STATUS = 'permanent'
1212

13+
# For signup steps that have already been completed but are pending admin action.
14+
SIGNUP_STEP_PENDING_STATUS = 'pending'
15+
1316
class DataProjectPanel():
1417
"""
1518
The base class that holds information needed to when displaying a panel

app/projects/views.py

+23-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from profile.forms import RegistrationForm
1919
from hypatio.auth0authenticate import public_user_auth_and_jwt
2020
from hypatio.auth0authenticate import user_auth_and_jwt
21-
from projects.models import AGREEMENT_FORM_TYPE_EXTERNAL_LINK, TEAM_ACTIVE, TEAM_READY
21+
from projects.models import AGREEMENT_FORM_TYPE_EXTERNAL_LINK, TEAM_ACTIVE, TEAM_READY, TEAM_PENDING
2222
from projects.models import AGREEMENT_FORM_TYPE_STATIC
2323
from projects.models import AGREEMENT_FORM_TYPE_MODEL
2424
from projects.models import AGREEMENT_FORM_TYPE_FILE
@@ -32,6 +32,7 @@
3232
from projects.panels import SIGNUP_STEP_CURRENT_STATUS
3333
from projects.panels import SIGNUP_STEP_FUTURE_STATUS
3434
from projects.panels import SIGNUP_STEP_PERMANENT_STATUS
35+
from projects.panels import SIGNUP_STEP_PENDING_STATUS
3536
from projects.panels import DataProjectInformationalPanel
3637
from projects.panels import DataProjectSignupPanel
3738
from projects.panels import DataProjectActionablePanel
@@ -220,6 +221,7 @@ def get_context_data(self, **kwargs):
220221
context['SIGNUP_STEP_CURRENT_STATUS'] = SIGNUP_STEP_CURRENT_STATUS
221222
context['SIGNUP_STEP_FUTURE_STATUS'] = SIGNUP_STEP_FUTURE_STATUS
222223
context['SIGNUP_STEP_PERMANENT_STATUS'] = SIGNUP_STEP_PERMANENT_STATUS
224+
context['SIGNUP_STEP_PENDING_STATUS'] = SIGNUP_STEP_PENDING_STATUS
223225

224226
# If this project is informational only, just show them the description without requiring an account.
225227
if self.project.informational_only:
@@ -386,7 +388,7 @@ def get_manager_context(self, context):
386388

387389
return context
388390

389-
def get_step_status(self, step_name, step_complete, is_permanent=False):
391+
def get_step_status(self, step_name, step_complete, is_permanent=False, is_pending=False):
390392
"""
391393
Returns the status this step should have. If the given step is incomplete and we do not
392394
already have a current_step, then this step is the current step and update
@@ -399,6 +401,9 @@ def get_step_status(self, step_name, step_complete, is_permanent=False):
399401
if is_permanent:
400402
return SIGNUP_STEP_PERMANENT_STATUS
401403

404+
if is_pending:
405+
return SIGNUP_STEP_PENDING_STATUS
406+
402407
logger.debug(f"{self.project.project_key}/{step_name}: Completed step")
403408
return SIGNUP_STEP_COMPLETED_STATUS
404409

@@ -611,10 +616,7 @@ def setup_panel_request_access(self, context):
611616
prior_current_step = next((s for s in context["setup_panels"] if s.status == SIGNUP_STEP_CURRENT_STATUS ), None)
612617

613618
# This step is never completed, it is usually the last step.
614-
step_status = self.get_step_status('request_access', requested_access and not prior_current_step)
615-
616-
# Always show expanded when completed, unless a prior step is current
617-
expanded = requested_access and not prior_current_step
619+
step_status = self.get_step_status('request_access', requested_access and not prior_current_step, is_pending=True)
618620

619621
panel = DataProjectSignupPanel(
620622
title='Request Access',
@@ -623,7 +625,6 @@ def setup_panel_request_access(self, context):
623625
status=step_status,
624626
additional_context={
625627
'requested_access': requested_access,
626-
'expanded': expanded,
627628
}
628629
)
629630

@@ -650,8 +651,21 @@ def setup_panel_team(self, context):
650651
team_approved=False
651652
)
652653

653-
# This step is never completed.
654-
step_status = self.get_step_status('setup_team', False)
654+
# This step is completed/pending if the participant has been associated
655+
# with a team, or for a team leader, request for access has been made.
656+
if team and self.participant.user == team.team_leader:
657+
658+
# Step is completed if awaiting access
659+
completed = team.status == TEAM_READY
660+
elif team and self.participant.user != team.team_leader:
661+
662+
# Step is completed if awaiting access
663+
completed = True
664+
else:
665+
completed = False
666+
667+
# Determine step status
668+
step_status = self.get_step_status('setup_team', completed, is_pending=True)
655669

656670
panel = DataProjectSignupPanel(
657671
title='Join or Create a Team',

app/static/custom.css

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
float: right;
1818
color: gray;
1919
}
20+
.pending-step-header span:after {
21+
font-family:'Glyphicons Halflings';
22+
content:"\e023";
23+
float: right;
24+
color: #1F1C18;
25+
}
2026
.accordion-step-header span:after {
2127
font-family:'Glyphicons Halflings';
2228
content:"\e234";
@@ -41,4 +47,4 @@
4147
/* Colors the asterisks detail on the form red */
4248
.required-field-tip {
4349
color: rgb(153, 8, 8);
44-
}
50+
}

app/templates/projects/project.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ <h2 class="panel-title">
6262
current-step-header
6363
{% elif panel.status == SIGNUP_STEP_PERMANENT_STATUS %}
6464
current-step-header
65+
{% elif panel.status == SIGNUP_STEP_PENDING_STATUS %}
66+
pending-step-header
6567
{% else %}
6668
blocked-step-header
6769
{% endif %}">
6870
<span>{{ panel.title }}</span>
6971
</div>
7072
</h2>
7173
</div>
72-
{% if panel.status == SIGNUP_STEP_CURRENT_STATUS or panel.status == SIGNUP_STEP_PERMANENT_STATUS or panel.additional_context.expanded %}
74+
{% if panel.status == SIGNUP_STEP_CURRENT_STATUS or panel.status == SIGNUP_STEP_PERMANENT_STATUS or panel.status == SIGNUP_STEP_PENDING_STATUS %}
7375
<div class="panel-body">
7476
{% include panel.template %}
7577
</div>

app/templates/projects/signup/request-access.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
notify('success', 'Access request submitted', 'thumbs-up');
4242

4343
// Update panel class
44-
$(".container").find(".current-step-header").toggleClass("current-step-header completed-step-header");
44+
$(".container").find(".current-step-header").toggleClass("current-step-header pending-step-header");
4545
}
4646

4747
function onAccessRequestError() {

0 commit comments

Comments
 (0)