link-service-to-organisations-tweaks

This commit is contained in:
chrisw
2018-02-14 16:13:11 +00:00
parent dd2231056d
commit 14b80622b7
13 changed files with 62 additions and 46 deletions

View File

@@ -3,34 +3,34 @@ from flask import Blueprint
main = Blueprint('main', __name__) # noqa
from app.main.views import ( # noqa
add_service,
api_keys,
choose_service,
code_not_received,
conversation,
dashboard,
email_branding,
feedback,
forgot_password,
inbound_number,
index,
invites,
jobs,
letter_jobs,
manage_users,
new_password,
notifications,
organisations,
platform_admin,
providers,
register,
send,
service_settings,
sign_in,
sign_out,
styleguide,
templates,
register,
two_factor,
verify,
send,
add_service,
code_not_received,
jobs,
dashboard,
templates,
service_settings,
forgot_password,
new_password,
styleguide,
user_profile,
verify
choose_service,
api_keys,
manage_users,
invites,
feedback,
providers,
platform_admin,
letter_jobs,
email_branding,
conversation,
organisations,
notifications,
inbound_number
)

View File

@@ -789,6 +789,7 @@ def link_service_to_organisation(service_id):
return render_template(
'views/service-settings/link-service-to-organisation.html',
has_organisations=organisations,
form=form,
)

View File

@@ -1,5 +1,6 @@
<nav class="navigation">
<ul>
<li><a href="{{ url_for('.organisation_dashboard', org_id=current_org.id) }}">Dashboard</a></li>
{% if current_user.has_permissions(admin_override=True) %}
<li><a href="{{ url_for('.organisation_users', org_id=current_org.id) }}">Team members</a></li>
{% endif %}

View File

@@ -1,7 +1,7 @@
{% extends "admin_template.html" %}
{% block per_page_title %}
{% block service_page_title %}{% endblock %} {{ current_service.name }}
{% block org_page_title %}{% endblock %} {{ current_org.name }}
{% endblock %}
{% block fullwidth_content %}
@@ -13,18 +13,10 @@
<a href="{{ url_for('main.choose_service') }}" class="navigation-service-switch">Switch service</a>
</div>
<div class="grid-row">
{% if help %}
<div class="column-one-third">
{% else %}
<div class="column-one-quarter">
{% endif %}
<div class="column-one-quarter">
{% include "org_nav.html" %}
</div>
{% if help %}
<main role="main" class="column-two-thirds column-main">
{% else %}
<main role="main" class="column-three-quarters column-main">
{% endif %}
<main role="main" class="column-three-quarters column-main">
{% include 'flash_messages.html' %}
{% block maincolumn_content %}{% endblock %}
</main>

View File

@@ -6,7 +6,7 @@
Create an organisation
{% endblock %}
{% block service_page_title %}
{% block org_page_title %}
Create an organisation
{% endblock %}

View File

@@ -5,7 +5,7 @@
Organisations
{% endblock %}
{% block service_page_title %}
{% block org_page_title %}
Organisations
{% endblock %}

View File

@@ -4,7 +4,7 @@
{{ current_org.name }}
{% endblock %}
{% block service_page_title %}
{% block org_page_title %}
{{ current_org.name }}
{% endblock %}

View File

@@ -6,7 +6,7 @@
Update an organisation
{% endblock %}
{% block service_page_title %}
{% block org_page_title %}
Update an organisation
{% endblock %}

View File

@@ -1,6 +1,6 @@
{% extends "org_template.html" %}
{% block service_page_title %}
{% block org_page_title %}
Team members
{% endblock %}

View File

@@ -248,7 +248,6 @@
{% if current_user.has_permissions(admin_override=True) %}
<h2 class="heading-medium">Platform admin settings</h2>
{% call mapping_table(
caption='Settings',
field_headings=['Label', 'Value', 'Action'],
@@ -257,7 +256,7 @@
) %}
{% call row() %}
{{ text_field('Organisation')}}
{{ optional_text_field(organisation or 'Not Set') }}
{{ optional_text_field(organisation or None) }}
{{ edit_field('Change', url_for('.link_service_to_organisation', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}

View File

@@ -14,9 +14,13 @@
Link service to organisation
</h1>
<form method="post">
{{ radios(form.organisations) }}
{% if has_organisations %}
{{ radios(form.organisations) }}
{% else %}
<p> No organisations </p>
{% endif %}
{{ page_footer(
'Save',
'Save' if has_organisations,
back_link=url_for('.service_settings', service_id=current_service.id),
back_link_text='Back to settings'
) }}

View File

@@ -150,4 +150,4 @@ def test_organisation_services_show(
assert normalize_spaces(page.select('.browse-list-item')[i].text) == service_name
assert normalize_spaces(
page.select('.browse-list-item a')[i]['href']
) == '/services/{}/dashboard'.format(service_id)
) == '/services/{}'.format(service_id)

View File

@@ -2037,6 +2037,25 @@ def test_select_organisation(
) == 'Org {}'.format(i + 1)
def test_select_organisation_shows_message_if_no_orgs(
logged_in_platform_admin_client,
service_one,
mock_get_service_organisation,
mocker
):
mocker.patch('app.organisations_client.get_organisations', return_value=[])
response = logged_in_platform_admin_client.get(
url_for('.link_service_to_organisation', service_id=service_one['id']),
)
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert normalize_spaces(page.select_one('main p').text) == "No organisations"
assert not page.select_one('main button')
def test_update_service_organisation(
logged_in_platform_admin_client,
service_one,