Skip to content

Commit

Permalink
Merge branch 'main' into fix/functional-test-filter-blog-title-check
Browse files Browse the repository at this point in the history
  • Loading branch information
willbarton authored Sep 12, 2022
2 parents 6ea03c7 + fb866c3 commit 30c9878
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
5 changes: 2 additions & 3 deletions cfgov/search/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
12 changes: 6 additions & 6 deletions cfgov/v1/views/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -118,7 +118,7 @@ def get_queryset(self):

class DocumentsReportView(ReportView):
header_icon = "doc-full"
title = "All documents"
title = "Documents"

list_export = [
"id",
Expand Down Expand Up @@ -157,7 +157,7 @@ def get_queryset(self):

class ImagesReportView(ReportView):
header_icon = "image"
title = "All images"
title = "Images"

list_export = [
"title",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
18 changes: 13 additions & 5 deletions cfgov/v1/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import re

from django.conf import settings
from django.contrib import admin
Expand Down Expand Up @@ -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,
)


Expand All @@ -214,7 +214,6 @@ def register_documents_report_menu_item():
"Documents",
reverse("documents_report"),
classnames="icon icon-" + DocumentsReportView.header_icon,
order=700,
)


Expand All @@ -235,7 +234,6 @@ def register_enforcements_actions_report_menu_item():
"Enforcement Actions",
reverse("enforcement_report"),
classnames="icon icon-" + EnforcementActionsReportView.header_icon,
order=700,
)


Expand All @@ -256,7 +254,6 @@ def register_images_report_menu_item():
"Images",
reverse("images_report"),
classnames="icon icon-" + ImagesReportView.header_icon,
order=700,
)


Expand All @@ -277,7 +274,6 @@ def register_ask_report_menu_item():
"Ask CFPB",
reverse("ask_report"),
classnames="icon icon-" + AskReportView.header_icon,
order=700,
)


Expand All @@ -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 = []

Expand Down
3 changes: 2 additions & 1 deletion test/cypress/integration/admin/admin-helpers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ export class AdminPage {
}

openExternalLinks() {
this.openNavigationTab( 'External links' );
this.openNavigationTab( 'Reports' );
this.selectSubMenu( 'External Links' );
}

searchExternalLink( link ) {
Expand Down

0 comments on commit 30c9878

Please sign in to comment.