diff --git a/cfgov/search/wagtail_hooks.py b/cfgov/search/wagtail_hooks.py index 1fe4c968580..47452495a30 100644 --- a/cfgov/search/wagtail_hooks.py +++ b/cfgov/search/wagtail_hooks.py @@ -21,11 +21,10 @@ def register_external_links_url(): ] -@hooks.register("register_admin_menu_item") +@hooks.register("register_reports_menu_item") def register_external_links_menu(): return MenuItem( - "External links", + "External Links", reverse("external-links"), classnames="icon icon-link", - order=10000, ) diff --git a/cfgov/v1/views/reports.py b/cfgov/v1/views/reports.py index 215c8826dbf..777418cf2a3 100644 --- a/cfgov/v1/views/reports.py +++ b/cfgov/v1/views/reports.py @@ -72,7 +72,7 @@ def generate_filename(type): class PageMetadataReportView(PageReportView): header_icon = "doc-empty-inverse" - title = "Metadata for live pages" + title = "Page Metadata (for Live Pages)" list_export = PageReportView.list_export + [ "url", @@ -118,7 +118,7 @@ def get_queryset(self): class DocumentsReportView(ReportView): header_icon = "doc-full" - title = "All documents" + title = "Documents" list_export = [ "id", @@ -157,7 +157,7 @@ def get_queryset(self): class ImagesReportView(ReportView): header_icon = "image" - title = "All images" + title = "Images" list_export = [ "title", @@ -197,8 +197,8 @@ def get_queryset(self): class EnforcementActionsReportView(ReportView): - header_icon = "doc-full" - title = "Enforcement actions report" + header_icon = "form" + title = "Enforcement Actions" list_export = [ "title", @@ -243,7 +243,7 @@ def get_queryset(self): class AskReportView(ReportView): header_icon = "help" - title = "Ask CFPB report" + title = "Ask CFPB" list_export = [ "answer_base", diff --git a/cfgov/v1/wagtail_hooks.py b/cfgov/v1/wagtail_hooks.py index 7a35d6abcce..fb08a7a0536 100644 --- a/cfgov/v1/wagtail_hooks.py +++ b/cfgov/v1/wagtail_hooks.py @@ -1,4 +1,5 @@ import logging +import re from django.conf import settings from django.contrib import admin @@ -193,7 +194,6 @@ def register_page_metadata_report_menu_item(): "Page Metadata", reverse("page_metadata_report"), classnames="icon icon-" + PageMetadataReportView.header_icon, - order=700, ) @@ -214,7 +214,6 @@ def register_documents_report_menu_item(): "Documents", reverse("documents_report"), classnames="icon icon-" + DocumentsReportView.header_icon, - order=700, ) @@ -235,7 +234,6 @@ def register_enforcements_actions_report_menu_item(): "Enforcement Actions", reverse("enforcement_report"), classnames="icon icon-" + EnforcementActionsReportView.header_icon, - order=700, ) @@ -256,7 +254,6 @@ def register_images_report_menu_item(): "Images", reverse("images_report"), classnames="icon icon-" + ImagesReportView.header_icon, - order=700, ) @@ -277,7 +274,6 @@ def register_ask_report_menu_item(): "Ask CFPB", reverse("ask_report"), classnames="icon icon-" + AskReportView.header_icon, - order=700, ) @@ -292,6 +288,18 @@ def register_ask_report_url(): ] +@hooks.register("construct_reports_menu") +# Alphabetizie and title case report menu items +def clean_up_report_menu_items(request, report_menu_items): + cfpb_re = r"CFPB" + report_menu_items.sort(key=lambda item: item.label) + for index, item in enumerate(report_menu_items): + item.label = item.label.title() + if re.search(cfpb_re, item.label, re.IGNORECASE): + item.label = re.sub(cfpb_re, "CFPB", item.label, 0, re.IGNORECASE) + item.order = index + + def get_resource_tags(): tag_list = [] diff --git a/test/cypress/integration/admin/admin-helpers.cy.js b/test/cypress/integration/admin/admin-helpers.cy.js index 64d773d500d..4432ced79b1 100644 --- a/test/cypress/integration/admin/admin-helpers.cy.js +++ b/test/cypress/integration/admin/admin-helpers.cy.js @@ -197,7 +197,8 @@ export class AdminPage { } openExternalLinks() { - this.openNavigationTab( 'External links' ); + this.openNavigationTab( 'Reports' ); + this.selectSubMenu( 'External Links' ); } searchExternalLink( link ) {