mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Merge pull request #2100 from alphagov/contact-url-page
Add page to change a service's contact link
This commit is contained in:
@@ -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='Can’t 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")
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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(
|
||||
|
||||
28
app/templates/views/service-settings/contact_link.html
Normal file
28
app/templates/views/service-settings/contact_link.html
Normal 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 there’s 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 %}
|
||||
Reference in New Issue
Block a user