refactor: Move dev-only templates to `templates/zerver/development`.

This a prep commit for adding a check to lint to ensure
only development-related templates entrypoint name
starts with `dev`.
This commit is contained in:
Riken Shah 2021-04-16 15:37:13 +00:00 committed by Tim Abbott
parent e27268837b
commit bd9e6ae97e
9 changed files with 17 additions and 7 deletions

View File

@ -635,7 +635,10 @@ html_rules: List["Rule"] = [
"description": "Don't use inline event handlers (onclick=, etc. attributes) in HTML. Instead,"
"attach a jQuery event handler ($('#foo').on('click', function () {...})) when "
"the DOM is ready (inside a $(function () {...}) block).",
"exclude": {"templates/zerver/dev_login.html", "templates/corporate/upgrade.html"},
"exclude": {
"templates/zerver/development/dev_login.html",
"templates/corporate/upgrade.html",
},
"good_lines": ["($('#foo').on('click', function () {}"],
"bad_lines": [
"<button id='foo' onclick='myFunction()'>Foo</button>",
@ -661,7 +664,7 @@ html_rules: List["Rule"] = [
"templates/zerver/emails/email_base_messages.html",
# Email log templates; should clean up.
"templates/zerver/email.html",
"templates/zerver/email_log.html",
"templates/zerver/development/email_log.html",
# Social backend logos are dynamically loaded
"templates/zerver/accounts_home.html",
"templates/zerver/login.html",

View File

@ -757,7 +757,7 @@ def login_page(
extra_context = kwargs.pop("extra_context", {})
extra_context["next"] = next
if dev_auth_enabled() and kwargs.get("template_name") == "zerver/dev_login.html":
if dev_auth_enabled() and kwargs.get("template_name") == "zerver/development/dev_login.html":
if "new_realm" in request.POST:
try:
realm = get_realm(request.POST["new_realm"])

View File

@ -32,7 +32,9 @@ def email_page(request: HttpRequest) -> HttpResponse:
except FileNotFoundError:
content = ""
return render(
request, "zerver/email_log.html", {"log": content, "forward_address": get_forward_address()}
request,
"zerver/development/email_log.html",
{"log": content, "forward_address": get_forward_address()},
)

View File

@ -36,7 +36,7 @@ def dev_panel(request: HttpRequest) -> HttpResponse:
# We set isolated_page to avoid clutter from footer/header.
"isolated_page": True,
}
return render(request, "zerver/integrations/development/dev_panel.html", context)
return render(request, "zerver/development/dev_panel.html", context)
def send_webhook_fixture_message(

View File

@ -49,13 +49,18 @@ urls = [
{"document_root": os.path.join(settings.DEPLOY_ROOT, "docs/_build/html")},
),
# The special no-password login endpoint for development
path("devlogin/", login_page, {"template_name": "zerver/dev_login.html"}, name="login_page"),
path(
"devlogin/",
login_page,
{"template_name": "zerver/development/dev_login.html"},
name="login_page",
),
# Page for testing email templates
path("emails/", email_page),
path("emails/generate/", generate_all_emails),
path("emails/clear/", clear_emails),
# Listing of useful URLs and various tools for development
path("devtools/", TemplateView.as_view(template_name="zerver/dev_tools.html")),
path("devtools/", TemplateView.as_view(template_name="zerver/development/dev_tools.html")),
# Register New User and Realm
path("devtools/register_user/", register_development_user, name="register_dev_user"),
path("devtools/register_realm/", register_development_realm, name="register_dev_realm"),