mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 08:28:15 -04:00
'Change' link links to edit_service_notes
This commit is contained in:
@@ -1691,6 +1691,10 @@ class ServiceEditInboundNumberForm(StripWhitespaceForm):
|
|||||||
is_default = GovukCheckboxField("Make this text message sender the default")
|
is_default = GovukCheckboxField("Make this text message sender the default")
|
||||||
|
|
||||||
|
|
||||||
|
class EditServiceNotesForm(StripWhitespaceForm):
|
||||||
|
notes = TextAreaField(validators=[])
|
||||||
|
|
||||||
|
|
||||||
class ServiceLetterContactBlockForm(StripWhitespaceForm):
|
class ServiceLetterContactBlockForm(StripWhitespaceForm):
|
||||||
letter_contact_block = TextAreaField(
|
letter_contact_block = TextAreaField(
|
||||||
validators=[
|
validators=[
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ from app.main import main
|
|||||||
from app.main.forms import (
|
from app.main.forms import (
|
||||||
BrandingOptions,
|
BrandingOptions,
|
||||||
ConfirmPasswordForm,
|
ConfirmPasswordForm,
|
||||||
|
EditServiceNotesForm,
|
||||||
EstimateUsageForm,
|
EstimateUsageForm,
|
||||||
FreeSMSAllowance,
|
FreeSMSAllowance,
|
||||||
LinkOrganisationsForm,
|
LinkOrganisationsForm,
|
||||||
@@ -1188,6 +1189,34 @@ def edit_data_retention(service_id, data_retention_id):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@main.route("/services/<uuid:service_id>/notes", methods=['GET', 'POST'])
|
||||||
|
@user_has_permissions('manage_service')
|
||||||
|
def edit_service_notes(service_id):
|
||||||
|
form = EditServiceNotesForm()
|
||||||
|
|
||||||
|
if request.method == 'GET':
|
||||||
|
form.name.data = current_service.notes
|
||||||
|
|
||||||
|
if form.validate_on_submit():
|
||||||
|
|
||||||
|
if form.notes.data == current_service.notes:
|
||||||
|
return redirect(url_for('.service_settings', service_id=service_id))
|
||||||
|
|
||||||
|
try:
|
||||||
|
current_service.update(
|
||||||
|
notes=form.notes.data
|
||||||
|
)
|
||||||
|
except HTTPError as e:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
return redirect(url_for('.service_settings', service_id=service_id))
|
||||||
|
|
||||||
|
return render_template(
|
||||||
|
'views/service-settings/edit-service-notes.html',
|
||||||
|
form=form,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_branding_as_value_and_label(email_branding):
|
def get_branding_as_value_and_label(email_branding):
|
||||||
return [
|
return [
|
||||||
(branding['id'], branding['name'])
|
(branding['id'], branding['name'])
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ class HeaderNavigation(Navigation):
|
|||||||
'edit_organisation_name',
|
'edit_organisation_name',
|
||||||
'edit_organisation_type',
|
'edit_organisation_type',
|
||||||
'edit_provider',
|
'edit_provider',
|
||||||
|
'edit_service_notes',
|
||||||
'edit_service_template',
|
'edit_service_template',
|
||||||
'edit_template_postage',
|
'edit_template_postage',
|
||||||
'edit_user_org_permissions',
|
'edit_user_org_permissions',
|
||||||
@@ -578,6 +579,7 @@ class MainNavigation(Navigation):
|
|||||||
'edit_organisation_name',
|
'edit_organisation_name',
|
||||||
'edit_organisation_type',
|
'edit_organisation_type',
|
||||||
'edit_provider',
|
'edit_provider',
|
||||||
|
'edit_service_notes',
|
||||||
'edit_sms_provider_ratio',
|
'edit_sms_provider_ratio',
|
||||||
'edit_user_org_permissions',
|
'edit_user_org_permissions',
|
||||||
'email_branding',
|
'email_branding',
|
||||||
@@ -831,6 +833,7 @@ class CaseworkNavigation(Navigation):
|
|||||||
'edit_organisation_name',
|
'edit_organisation_name',
|
||||||
'edit_organisation_type',
|
'edit_organisation_type',
|
||||||
'edit_provider',
|
'edit_provider',
|
||||||
|
'edit_service_notes',
|
||||||
'edit_sms_provider_ratio',
|
'edit_sms_provider_ratio',
|
||||||
'edit_service_template',
|
'edit_service_template',
|
||||||
'edit_template_postage',
|
'edit_template_postage',
|
||||||
@@ -1152,6 +1155,7 @@ class OrgNavigation(Navigation):
|
|||||||
'download_notifications_csv',
|
'download_notifications_csv',
|
||||||
'edit_data_retention',
|
'edit_data_retention',
|
||||||
'edit_provider',
|
'edit_provider',
|
||||||
|
'edit_service_notes',
|
||||||
'edit_service_template',
|
'edit_service_template',
|
||||||
'edit_sms_provider_ratio',
|
'edit_sms_provider_ratio',
|
||||||
'edit_template_postage',
|
'edit_template_postage',
|
||||||
|
|||||||
@@ -338,7 +338,7 @@
|
|||||||
{% call row() %}
|
{% call row() %}
|
||||||
{{ text_field('Notes')}}
|
{{ text_field('Notes')}}
|
||||||
{{ optional_text_field(current_service.notes, default="No notes yet", wrap=True) }}
|
{{ optional_text_field(current_service.notes, default="No notes yet", wrap=True) }}
|
||||||
{{ edit_field('Change', url_for('.service_switch_count_as_live', service_id=current_service.id), suffix='the notes for the service') }}
|
{{ edit_field('Change', url_for('.edit_service_notes', service_id=current_service.id), suffix='the notes for the service') }}
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
{% call row() %}
|
{% call row() %}
|
||||||
|
|||||||
@@ -5232,3 +5232,20 @@ def test_update_service_data_retention_populates_form(
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||||
assert page.find('input', attrs={'name': 'days_of_retention'})['value'] == '5'
|
assert page.find('input', attrs={'name': 'days_of_retention'})['value'] == '5'
|
||||||
|
|
||||||
|
|
||||||
|
def test_service_settings_links_to_edit_service_notes_page_for_platform_admins(
|
||||||
|
mocker,
|
||||||
|
service_one,
|
||||||
|
platform_admin_client,
|
||||||
|
no_reply_to_email_addresses,
|
||||||
|
no_letter_contact_blocks,
|
||||||
|
single_sms_sender,
|
||||||
|
mock_get_service_settings_page_common,
|
||||||
|
mock_get_organisation,
|
||||||
|
):
|
||||||
|
response = platform_admin_client.get(url_for(
|
||||||
|
'.service_settings', service_id=SERVICE_ONE_ID
|
||||||
|
))
|
||||||
|
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||||
|
assert len(page.find_all('a', attrs={'href': '/services/{}/notes'.format(SERVICE_ONE_ID)})) == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user