mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 14:48:25 -04:00
Add letter class row to settings page, visible to platform admin
Added a new row to the settings table, 'Post class', which shows the default letter class of a service and is only visible to Platform Admin. Also added a new page to enable Platform Admin users to change the default letter class for a service - this only has two options at the moment, 1st class only and 2nd class only.
This commit is contained in:
@@ -684,6 +684,17 @@ class ServiceSwitchLettersForm(StripWhitespaceForm):
|
||||
)
|
||||
|
||||
|
||||
class ServiceLetterClassForm(StripWhitespaceForm):
|
||||
|
||||
letter_class = RadioField(
|
||||
'Postage classes',
|
||||
choices=[
|
||||
('first', '1st class only'),
|
||||
('second', '2nd class only'),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
class BrandingStyle(RadioField):
|
||||
|
||||
def post_validate(self, form, validation_stopped):
|
||||
|
||||
@@ -42,6 +42,7 @@ from app.main.forms import (
|
||||
ServiceDataRetentionForm,
|
||||
ServiceEditInboundNumberForm,
|
||||
ServiceInboundNumberForm,
|
||||
ServiceLetterClassForm,
|
||||
ServiceLetterContactBlockForm,
|
||||
ServicePreviewBranding,
|
||||
ServiceReplyToEmailForm,
|
||||
@@ -649,6 +650,19 @@ def service_set_letters(service_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/service-settings/set-letter-class", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def service_set_letter_class(service_id):
|
||||
form = ServiceLetterClassForm(letter_class=current_service.letter_class)
|
||||
|
||||
if form.validate_on_submit():
|
||||
service_api_client.update_service(service_id, letter_class=form.letter_class.data)
|
||||
return redirect(url_for(".service_settings", service_id=service_id))
|
||||
|
||||
return render_template('views/service-settings/set-letter-class.html', form=form)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/service-settings/set-auth-type", methods=['GET'])
|
||||
@login_required
|
||||
@user_has_permissions('manage_service')
|
||||
|
||||
Reference in New Issue
Block a user