Put actions at the top on single template page

The links to the right of the template take up valuable horizontal
space. This means that the preview of email and letter templates isn’t
as big as it could be. By making the letter preview bigger it removes
the need to click through to the PDF to see a preview.

Reuses the navigation style used on the API integration page, because I
think it damages consistency to create another new button style.
This commit is contained in:
Chris Hill-Scott
2017-03-10 16:46:28 +00:00
parent de30558d57
commit 14bd05c8a5
2 changed files with 93 additions and 16 deletions

View File

@@ -33,6 +33,57 @@ def test_should_show_page_for_one_template(
mock_get_service_template.assert_called_with(service_one['id'], template_id)
@pytest.mark.parametrize('permissions, links_to_be_shown', [
(
['view_activity'],
[]
),
(
['manage_templates'],
['.edit_service_template']
),
(
['send_texts', 'send_emails', 'send_letters'],
['.send_messages', '.send_test']
),
(
['send_texts', 'send_emails', 'send_letters', 'manage_templates'],
['.send_messages', '.send_test', '.edit_service_template']
),
])
def test_should_be_able_to_view_a_template_with_links(
client,
mock_get_service_template,
active_user_with_permissions,
mocker,
service_one,
fake_uuid,
permissions,
links_to_be_shown,
):
active_user_with_permissions._permissions[service_one['id']] = permissions
client.login(active_user_with_permissions, mocker, service_one)
response = client.get(url_for(
'.view_template',
service_id=service_one['id'],
template_id=fake_uuid
))
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
links_in_page = page.select('.pill-separate-item')
assert len(links_in_page) == len(links_to_be_shown)
for index, link_to_be_shown in enumerate(links_to_be_shown):
assert links_in_page[index]['href'] == url_for(
link_to_be_shown,
service_id=service_one['id'],
template_id=fake_uuid,
)
def test_should_show_sms_template_with_downgraded_unicode_characters(
logged_in_client,
mocker,