diff --git a/accounts/views.py b/accounts/views.py index 16a58b45..3075ebf4 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -215,7 +215,8 @@ def landing(request): @login_required(login_url="login") def select_account(request): - return render(request, "accounts/select-account.html") + envi = dev_prod_or_local(request.get_host()) + return render(request, "accounts/select-account.html", {"envi": envi}) class CustomSocialSignupView(SignupView): diff --git a/institutions/views.py b/institutions/views.py index 1a1e3aa7..30e4aefd 100644 --- a/institutions/views.py +++ b/institutions/views.py @@ -1429,6 +1429,7 @@ def connections(request, pk): @member_required(roles=["admin", "editor"]) def connect_service_provider(request, pk): try: + envi = dev_prod_or_local(request.get_host()) institution = get_institution(pk) member_role = check_member_role(request.user, institution) if request.method == "GET": @@ -1505,6 +1506,7 @@ def connect_service_provider(request, pk): 'institution': institution, 'other_service_providers': other_service_providers, 'connected_service_providers': connected_service_providers, + 'envi': envi } return render(request, 'account_settings_pages/_connect-service-provider.html', context) diff --git a/templates/account_settings_pages/_connect-service-provider.html b/templates/account_settings_pages/_connect-service-provider.html index ef3c55c6..af2497ec 100644 --- a/templates/account_settings_pages/_connect-service-provider.html +++ b/templates/account_settings_pages/_connect-service-provider.html @@ -89,46 +89,55 @@

- {% if institution.is_subscribed or researcher.is_subscribed or community.is_approved %} - {% if not service_provider.certification_type == 'manual'%} - - {% elif service_provider.certification_type == 'manual' %} - - More Info - - {% endif %} - {% else %} - {% if not service_provider.certification_type == 'manual'%} -
- Connect + + {% elif service_provider.certification_type == 'manual' %} + + More Info - - Your account needs to be {% if community %}confirmed{% else %}subscribed{% endif %} to connect to Service Providers. - -
- {% elif service_provider.certification_type == 'manual' %} - - More Info - + {% endif %} + {% else %} + {% if not service_provider.certification_type == 'manual'%} +
+ + Connect + + + Your account needs to be {% if community %}confirmed{% else %}subscribed{% endif %} to connect to Service Providers. + +
+ {% elif service_provider.certification_type == 'manual' %} + + More Info + + {% endif %} {% endif %} + {% else %} +
+ + Connect + + + Connecting to Service Providers is not available in the Sandbox. + +
{% endif %} diff --git a/templates/accounts/select-account.html b/templates/accounts/select-account.html index f135890b..093be7bf 100644 --- a/templates/accounts/select-account.html +++ b/templates/accounts/select-account.html @@ -132,7 +132,16 @@

Choose an account

Create a new account or Join an existing account. Not sure which account type to create? Contact us.

- Create + {% if envi == 'SANDBOX' %} +
+ Create + + Creating this account is unavailable in the Sandbox + +
+ {% else %} + Create + {% endif %} Join
@@ -143,11 +152,16 @@

Choose an account

var joinBtn = document.getElementById('join-account'); var accountCards = document.getElementsByClassName('account-card'); var i; + var envi = "{{ envi }}" + var helptext = document.getElementById('helptext'); function showButtons(e) { for (i = 0; i < accountCards.length; i++) { accountCards[i].classList.remove('card-selected'); } + if (helptext) { + helptext.classList.add('hide'); + } selectedCard = e.closest('.account-card'); selectedCard.classList.add('card-selected'); @@ -181,7 +195,7 @@

Choose an account

joinBtn.classList.remove('action-btn'); joinBtn.classList.add('disabled-btn'); } - else if (e.value == 'service-provider') { + else if (e.value == 'service-provider' && !(envi == 'SANDBOX')) { createBtn.classList.remove('disabled-btn'); createBtn.classList.add('action-btn'); createBtn.setAttribute('href', '{% url "prep-service-provider" %}'); @@ -189,6 +203,11 @@

Choose an account

joinBtn.classList.remove('action-btn'); joinBtn.classList.add('disabled-btn'); } + else if (e.value == 'service-provider' && envi == 'SANDBOX') { + createBtn.classList.remove('action-btn'); + createBtn.classList.add('disabled-btn'); + helptext.classList.remove('hide'); + } } {% endblock %} \ No newline at end of file