mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-28 21:46:33 +02:00
linted
This commit is contained in:
parent
8b801105f6
commit
f8d7cfdb6a
2 changed files with 15 additions and 16 deletions
|
@ -252,7 +252,7 @@ TEMPLATES = [
|
||||||
"registrar.context_processors.add_path_to_context",
|
"registrar.context_processors.add_path_to_context",
|
||||||
"registrar.context_processors.portfolio_permissions",
|
"registrar.context_processors.portfolio_permissions",
|
||||||
"registrar.context_processors.is_widescreen_mode",
|
"registrar.context_processors.is_widescreen_mode",
|
||||||
"registrar.context_processors.is_widescreen_left_justified"
|
"registrar.context_processors.is_widescreen_left_justified",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -101,24 +101,19 @@ def portfolio_permissions(request):
|
||||||
def is_widescreen_mode(request):
|
def is_widescreen_mode(request):
|
||||||
widescreen_paths = [
|
widescreen_paths = [
|
||||||
"/domain-request/",
|
"/domain-request/",
|
||||||
] # If this list is meant to include specific paths, populate it.
|
] # If this list is meant to include specific paths, populate it.
|
||||||
portfolio_widescreen_paths = [
|
portfolio_widescreen_paths = [
|
||||||
"/domains/",
|
"/domains/",
|
||||||
"/requests/",
|
"/requests/",
|
||||||
"/no-organization-requests/",
|
"/no-organization-requests/",
|
||||||
"/no-organization-domains/",
|
"/no-organization-domains/",
|
||||||
"/members/"
|
"/members/",
|
||||||
]
|
]
|
||||||
# widescreen_paths can be a bear as it trickles down sub-urls. exclude_paths gives us a way out.
|
# widescreen_paths can be a bear as it trickles down sub-urls. exclude_paths gives us a way out.
|
||||||
exclude_paths = [
|
exclude_paths = ["/domains/edit", "/admin/"]
|
||||||
"/domains/edit",
|
|
||||||
"/admin/"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Check if the current path matches a widescreen path or the root path.
|
# Check if the current path matches a widescreen path or the root path.
|
||||||
is_widescreen = (
|
is_widescreen = any(path in request.path for path in widescreen_paths) or request.path == "/"
|
||||||
any(path in request.path for path in widescreen_paths)
|
|
||||||
or request.path == "/" )
|
|
||||||
|
|
||||||
# Check if the user is an organization user and the path matches portfolio paths.
|
# Check if the user is an organization user and the path matches portfolio paths.
|
||||||
is_portfolio_widescreen = (
|
is_portfolio_widescreen = (
|
||||||
|
@ -130,22 +125,25 @@ def is_widescreen_mode(request):
|
||||||
is_excluded = any(exclude_path in request.path for exclude_path in exclude_paths)
|
is_excluded = any(exclude_path in request.path for exclude_path in exclude_paths)
|
||||||
|
|
||||||
# Return a dictionary with the widescreen mode status.
|
# Return a dictionary with the widescreen mode status.
|
||||||
return {"is_widescreen_mode": (is_widescreen or is_portfolio_widescreen or get_is_widescreen_left_justified(request)) and not is_excluded}
|
return {
|
||||||
|
"is_widescreen_mode": (is_widescreen or is_portfolio_widescreen or get_is_widescreen_left_justified(request))
|
||||||
|
and not is_excluded
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_is_widescreen_left_justified(request):
|
def get_is_widescreen_left_justified(request):
|
||||||
include_paths = [
|
include_paths = [
|
||||||
"/user-profile",
|
"/user-profile",
|
||||||
"/request/",
|
"/request/",
|
||||||
"/domain/",
|
"/domain/",
|
||||||
]
|
]
|
||||||
portfolio_include_paths = [
|
portfolio_include_paths = [
|
||||||
"/organization/",
|
"/organization/",
|
||||||
"/senior-official/",
|
"/senior-official/",
|
||||||
"/member/",
|
"/member/",
|
||||||
"/members/new-member",
|
"/members/new-member",
|
||||||
]
|
]
|
||||||
exclude_paths = [
|
exclude_paths = []
|
||||||
]
|
|
||||||
|
|
||||||
is_excluded = any(exclude_path in request.path for exclude_path in exclude_paths)
|
is_excluded = any(exclude_path in request.path for exclude_path in exclude_paths)
|
||||||
|
|
||||||
|
@ -161,7 +159,8 @@ def get_is_widescreen_left_justified(request):
|
||||||
|
|
||||||
return (is_widescreen_left_justified or is_portfolio_widescreen_left_justified) and not is_excluded
|
return (is_widescreen_left_justified or is_portfolio_widescreen_left_justified) and not is_excluded
|
||||||
|
|
||||||
|
|
||||||
def is_widescreen_left_justified(request):
|
def is_widescreen_left_justified(request):
|
||||||
|
|
||||||
# Return a dictionary with the widescreen mode status.
|
# Return a dictionary with the widescreen mode status.
|
||||||
return {"is_widescreen_left_justified": get_is_widescreen_left_justified(request)}
|
return {"is_widescreen_left_justified": get_is_widescreen_left_justified(request)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue