Merge pull request #2100 from alphagov/contact-url-page

Add page to change a service's contact link
This commit is contained in:
Katie Smith
2018-06-12 10:20:51 +01:00
committed by GitHub
7 changed files with 125 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ from wtforms import (
widgets,
)
from wtforms.fields.html5 import EmailField, SearchField, TelField
from wtforms.validators import DataRequired, Length, Optional, Regexp
from wtforms.validators import URL, DataRequired, Length, Optional, Regexp
from app.main.validators import (
Blacklist,
@@ -572,6 +572,14 @@ class ProviderForm(StripWhitespaceForm):
priority = IntegerField('Priority', [validators.NumberRange(min=1, max=100, message="Must be between 1 and 100")])
class ServiceContactLinkForm(StripWhitespaceForm):
url = StringField(
"URL",
validators=[DataRequired(message='Cant be empty'),
URL(message='Must be a valid URL')]
)
class ServiceReplyToEmailForm(StripWhitespaceForm):
email_address = email_address(label='Email reply to address', gov_user=False)
is_default = BooleanField("Make this email address the default")

View File

@@ -34,6 +34,7 @@ from app.main.forms import (
OrganisationTypeForm,
RenameServiceForm,
RequestToGoLiveForm,
ServiceContactLinkForm,
ServiceEditInboundNumberForm,
ServiceInboundNumberForm,
ServiceLetterContactBlockForm,
@@ -366,6 +367,25 @@ def resume_service(service_id):
return service_settings(service_id)
@main.route("/services/<service_id>/service-settings/contact-link", methods=['GET', 'POST'])
@login_required
@user_has_permissions('manage_service')
def service_set_contact_link(service_id):
form = ServiceContactLinkForm()
if request.method == 'GET':
form.url.data = current_service.get('contact_link')
if form.validate_on_submit():
service_api_client.update_service(
current_service['id'],
contact_link=form.url.data
)
return redirect(url_for('.service_settings', service_id=current_service['id']))
return render_template('views/service-settings/contact_link.html', form=form)
@main.route("/services/<service_id>/service-settings/set-email", methods=['GET'])
@login_required
@user_has_permissions('manage_service')

View File

@@ -211,6 +211,7 @@ class HeaderNavigation(Navigation):
'service_name_change',
'service_name_change_confirm',
'service_set_auth_type',
'service_set_contact_link',
'service_set_email',
'service_set_email_branding',
'service_set_inbound_number',
@@ -328,6 +329,7 @@ class MainNavigation(Navigation):
'service_name_change',
'service_name_change_confirm',
'service_set_auth_type',
'service_set_contact_link',
'service_set_email',
'service_set_email_branding',
'service_set_inbound_number',
@@ -631,6 +633,7 @@ class OrgNavigation(Navigation):
'service_name_change',
'service_name_change_confirm',
'service_set_auth_type',
'service_set_contact_link',
'service_set_email',
'service_set_email_branding',
'service_set_inbound_number',

View File

@@ -85,6 +85,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
'organisation_type',
'free_sms_fragment_limit',
'prefix_sms',
'contact_link',
}
if disallowed_attributes:
raise TypeError('Not allowed to update service attributes: {}'.format(

View File

@@ -0,0 +1,28 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Change link on Download your document page
{% endblock %}
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-five-sixths">
<h1 class="heading-large">Change link on Download your document page</h1>
<p>
When you send users a document to download, you need to include a link to your service
on the download page. This is so users can contact you if theres a problem (for example,
if the link to download the document has expired).
</p>
<form method="post">
{{ textbox(form.url, width='1-1') }}
{{ page_footer(
'Save',
back_link=url_for('.service_settings', service_id=current_service.id),
back_link_text='Back to settings'
) }}
</form>
</div>
</div>
{% endblock %}