move trial mode services from org dashboard to separate page

the new page is platform admin only, and also has search built in
also, split test_organisation_invites into two files
This commit is contained in:
Leo Hemsted
2019-05-21 14:56:15 +01:00
parent a65450b118
commit 9795f2b838
6 changed files with 740 additions and 639 deletions

View File

@@ -70,7 +70,10 @@ def add_organisation():
@login_required
@user_has_permissions()
def organisation_dashboard(org_id):
organisation_services = organisations_client.get_organisation_services(org_id)
organisation_services = [
service for service in organisations_client.get_organisation_services(org_id)
if service['active'] and not service['restricted']
]
for service in organisation_services:
has_permission = current_user.has_permission_for_service(service['id'], 'view_activity')
service.update({'has_permission_to_view': has_permission})
@@ -81,6 +84,19 @@ def organisation_dashboard(org_id):
)
@main.route("/organisations/<org_id>/trial-services", methods=['GET'])
@login_required
@user_is_platform_admin
def organisation_trial_mode_services(org_id):
organisation_services = organisations_client.get_organisation_services(org_id)
return render_template(
'views/organisations/organisation/trial-mode-services.html',
search_form=SearchByNameForm(),
services=[service for service in organisation_services if not service['active'] or service['restricted']]
)
@main.route("/organisations/<org_id>/users", methods=['GET'])
@login_required
@user_has_permissions()

View File

@@ -207,6 +207,7 @@ class HeaderNavigation(Navigation):
'old_terms',
'old_using_notify',
'organisation_dashboard',
'organisation_trial_mode_services',
'organisation_settings',
'organisation_preview_email_branding',
'organisation_preview_letter_branding',
@@ -494,6 +495,7 @@ class MainNavigation(Navigation):
'old_terms',
'old_using_notify',
'organisation_dashboard',
'organisation_trial_mode_services',
'organisation_preview_email_branding',
'organisation_preview_letter_branding',
'organisation_settings',
@@ -712,6 +714,7 @@ class CaseworkNavigation(Navigation):
'old_terms',
'old_using_notify',
'organisation_dashboard',
'organisation_trial_mode_services',
'organisation_preview_email_branding',
'organisation_preview_letter_branding',
'organisation_settings',
@@ -870,6 +873,9 @@ class OrgNavigation(Navigation):
'invite_org_user',
'manage_org_users',
'remove_user_from_organisation',
},
'trial-services': {
'organisation_trial_mode_services',
}
}

View File

@@ -3,5 +3,8 @@
<li><a href="{{ url_for('.organisation_dashboard', org_id=current_org.id) }}" {{ org_navigation.is_selected('dashboard') }}>Services</a></li>
<li><a href="{{ url_for('.manage_org_users', org_id=current_org.id) }}" {{ org_navigation.is_selected('team-members') }}>Team members</a></li>
<li><a href="{{ url_for('.organisation_settings', org_id=current_org.id) }}" {{ org_navigation.is_selected('settings') }}>Settings</a></li>
{% if current_user.platform_admin %}
<li><a href="{{ url_for('.organisation_trial_mode_services', org_id=current_org.id) }}" {{ org_navigation.is_selected('trial-services') }}>Trial services</a></li>
{% endif %}
</ul>
</nav>

View File

@@ -0,0 +1,22 @@
{% extends "org_template.html" %}
{% from "components/live-search.html" import live_search %}
{% block org_page_title %}
Services
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-medium">
Trial mode services
</h1>
{{ live_search(target_selector='.browse-list-item', show=True, form=search_form, label='Search by name') }}
<ul>
{% for service in services %}
<li class="browse-list-item">
<a href="{{ url_for('main.service_dashboard', service_id=service.id) }}" class="browse-list-link">{{ service['name'] }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}