mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-23 01:19:27 -04:00
Merge pull request #2208 from alphagov/label-message-type-search
Label the search box dependent on message type
This commit is contained in:
@@ -877,7 +877,19 @@ class SearchUsersForm(StripWhitespaceForm):
|
||||
|
||||
class SearchNotificationsForm(StripWhitespaceForm):
|
||||
|
||||
to = SearchField('Search by phone number or email address')
|
||||
to = SearchField()
|
||||
|
||||
labels = {
|
||||
'email': 'Search by email address',
|
||||
'sms': 'Search by phone number',
|
||||
}
|
||||
|
||||
def __init__(self, message_type, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.to.label.text = self.labels.get(
|
||||
message_type,
|
||||
'Search by phone number or email address',
|
||||
)
|
||||
|
||||
|
||||
class PlaceholderForm(StripWhitespaceForm):
|
||||
|
||||
@@ -183,7 +183,10 @@ def view_notifications(service_id, message_type=None):
|
||||
status=request.args.get('status') or 'sending,delivered,failed',
|
||||
page=request.args.get('page', 1),
|
||||
to=request.form.get('to', ''),
|
||||
search_form=SearchNotificationsForm(to=request.form.get('to', '')),
|
||||
search_form=SearchNotificationsForm(
|
||||
message_type=message_type,
|
||||
to=request.form.get('to', ''),
|
||||
),
|
||||
download_link=url_for(
|
||||
'.download_notifications_csv',
|
||||
service_id=current_service.id,
|
||||
|
||||
Reference in New Issue
Block a user