mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 18:37:33 -04:00
Merge pull request #467 from alphagov/tour-footer-link
Put a link to the tour in the footer
This commit is contained in:
@@ -42,8 +42,8 @@ def add_service():
|
|||||||
restricted=True,
|
restricted=True,
|
||||||
user_id=session['user_id'],
|
user_id=session['user_id'],
|
||||||
email_from=email_from)
|
email_from=email_from)
|
||||||
|
session['service_id'] = service_id
|
||||||
return redirect(url_for('main.tour', service_id=service_id, page=1))
|
return redirect(url_for('main.tour', page=1))
|
||||||
else:
|
else:
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/add-service.html',
|
'views/add-service.html',
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ def service_dashboard(service_id):
|
|||||||
|
|
||||||
if session.get('invited_user'):
|
if session.get('invited_user'):
|
||||||
session.pop('invited_user', None)
|
session.pop('invited_user', None)
|
||||||
return redirect(url_for("main.tour", service_id=service_id, page=1))
|
session['service_id'] = service_id
|
||||||
|
return redirect(url_for("main.tour", page=1))
|
||||||
|
|
||||||
statistics = statistics_api_client.get_statistics_for_service(service_id)['data']
|
statistics = statistics_api_client.get_statistics_for_service(service_id)['data']
|
||||||
template_statistics = aggregate_usage(template_statistics_client.get_template_statistics_for_service(service_id))
|
template_statistics = aggregate_usage(template_statistics_client.get_template_statistics_for_service(service_id))
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ headings = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<service_id>/tour/<int:page>")
|
@main.route("/tour/<int:page>")
|
||||||
@login_required
|
def tour(page):
|
||||||
def tour(service_id, page):
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/tour/{}.html'.format(page),
|
'views/tour/{}.html'.format(page),
|
||||||
current_page=page,
|
current_page=page,
|
||||||
|
|||||||
@@ -91,8 +91,11 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="column-one-third">
|
<div class="column-one-third">
|
||||||
<h2>Developers</h2>
|
<h2>Documentation</h2>
|
||||||
<a href="{{ url_for('main.documentation') }}">API documentation</a>
|
<ul>
|
||||||
|
<li><a href="{{ url_for('main.tour', page=1) }}">Take the tour</a></li>
|
||||||
|
<li><a href="{{ url_for('main.documentation') }}">API documentation</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<p>
|
<p>
|
||||||
We can remove these restrictions when you’re ready.
|
We can remove these restrictions when you’re ready.
|
||||||
</p>
|
</p>
|
||||||
<a href='{{ url_for('.tour', service_id=current_service.id, page=next_page) }}'>
|
<a href='{{ url_for('.tour', page=next_page) }}'>
|
||||||
Next
|
Next
|
||||||
</a>
|
</a>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
>
|
>
|
||||||
</picture>
|
</picture>
|
||||||
</p>
|
</p>
|
||||||
<a href='{{ url_for('.tour', service_id=current_service.id, page=next_page) }}'>
|
<a href='{{ url_for('.tour', page=next_page) }}'>
|
||||||
Next
|
Next
|
||||||
</a>
|
</a>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<p>
|
<p>
|
||||||
Developers, you can add data automatically using an API
|
Developers, you can add data automatically using an API
|
||||||
</p>
|
</p>
|
||||||
<a href='{{ url_for('.tour', service_id=current_service.id, page=next_page) }}'>
|
<a href='{{ url_for('.tour', page=next_page) }}'>
|
||||||
Next
|
Next
|
||||||
</a>
|
</a>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<p>
|
<p>
|
||||||
Notify merges your data with the template and sends the messages
|
Notify merges your data with the template and sends the messages
|
||||||
</p>
|
</p>
|
||||||
<a href="{{ url_for('.service_dashboard', service_id=current_service.id) }}">
|
<a href="{{ url_for('.show_all_services_or_dashboard') }}">
|
||||||
Next
|
Next
|
||||||
</a>
|
</a>
|
||||||
<picture class="banner-tour-image-flush-bottom">
|
<picture class="banner-tour-image-flush-bottom">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from flask import url_for
|
from flask import url_for, session
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
@@ -372,8 +372,8 @@ def test_new_invited_user_verifies_and_added_to_service(app_,
|
|||||||
mock_add_user_to_service.assert_called_with(data['service'], new_user_id, expected_permissions)
|
mock_add_user_to_service.assert_called_with(data['service'], new_user_id, expected_permissions)
|
||||||
mock_accept_invite.assert_called_with(data['service'], sample_invite['id'])
|
mock_accept_invite.assert_called_with(data['service'], sample_invite['id'])
|
||||||
mock_check_verify_code.assert_called_once_with(new_user_id, '12345', 'sms')
|
mock_check_verify_code.assert_called_once_with(new_user_id, '12345', 'sms')
|
||||||
|
assert service_one['id'] == session['service_id']
|
||||||
|
|
||||||
raw_html = response.data.decode('utf-8')
|
raw_html = response.data.decode('utf-8')
|
||||||
page = BeautifulSoup(raw_html, 'html.parser')
|
page = BeautifulSoup(raw_html, 'html.parser')
|
||||||
element = page.find('h2').text == 'Trial mode'
|
element = page.find('h2').text == 'Trial mode'
|
||||||
assert service_one['id'] in raw_html
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from flask import url_for
|
from flask import url_for, session
|
||||||
|
|
||||||
import app
|
import app
|
||||||
|
|
||||||
@@ -25,15 +25,18 @@ def test_should_add_service_and_redirect_to_next_page(app_,
|
|||||||
response = client.post(
|
response = client.post(
|
||||||
url_for('main.add_service'),
|
url_for('main.add_service'),
|
||||||
data={'name': 'testing the post'})
|
data={'name': 'testing the post'})
|
||||||
assert response.status_code == 302
|
|
||||||
assert response.location == url_for('main.tour', service_id=101, page=1, _external=True)
|
|
||||||
assert mock_get_services.called
|
assert mock_get_services.called
|
||||||
mock_create_service.asset_called_once_with(service_name='testing the post',
|
mock_create_service.assert_called_once_with(
|
||||||
active=False,
|
service_name='testing the post',
|
||||||
limit=app_.config['DEFAULT_SERVICE_LIMIT'],
|
active=False,
|
||||||
restricted=True,
|
message_limit=app_.config['DEFAULT_SERVICE_LIMIT'],
|
||||||
user_id=api_user_active.id,
|
restricted=True,
|
||||||
email_from='testing.the.post')
|
user_id=api_user_active.id,
|
||||||
|
email_from='testing.the.post'
|
||||||
|
)
|
||||||
|
assert session['service_id'] == 101
|
||||||
|
assert response.status_code == 302
|
||||||
|
assert response.location == url_for('main.tour', page=1, _external=True)
|
||||||
|
|
||||||
|
|
||||||
def test_should_return_form_errors_when_service_name_is_empty(app_,
|
def test_should_return_form_errors_when_service_name_is_empty(app_,
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ def test_should_render_tour_pages(
|
|||||||
):
|
):
|
||||||
with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
with app_.test_client() as client:
|
with app_.test_client() as client:
|
||||||
client.login(api_user_active, mocker)
|
response = client.get(url_for('main.tour', page=page))
|
||||||
response = client.get(url_for('main.tour', service_id=101, page=page))
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert 'Next' in response.get_data(as_text=True)
|
assert 'Next' in response.get_data(as_text=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user