diff --git a/hc/front/views.py b/hc/front/views.py index ad2ebfab..4eee91b1 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -696,7 +696,11 @@ def add_email(request): else: form = AddEmailForm() - ctx = {"page": "channels", "form": form} + ctx = { + "page": "channels", + "project": request.project, + "form": form + } return render(request, "integrations/add_email.html", ctx) @@ -716,6 +720,7 @@ def add_webhook(request): ctx = { "page": "channels", + "project": request.project, "form": form, "now": timezone.now().replace(microsecond=0).isoformat() } @@ -774,7 +779,11 @@ def add_pd(request, state=None): "callback": callback }) - ctx = {"page": "channels", "connect_url": connect_url} + ctx = { + "page": "channels", + "project": request.project, + "connect_url": connect_url + } return render(request, "integrations/add_pd.html", ctx) @@ -792,9 +801,14 @@ def add_pagertree(request): else: form = AddUrlForm() - ctx = {"page": "channels", "form": form} + ctx = { + "page": "channels", + "project": request.project, + "form": form + } return render(request, "integrations/add_pagertree.html", ctx) + @login_required def add_pagerteam(request): if request.method == "POST": @@ -809,7 +823,11 @@ def add_pagerteam(request): else: form = AddUrlForm() - ctx = {"page": "channels", "form": form} + ctx = { + "page": "channels", + "project": request.project, + "form": form + } return render(request, "integrations/add_pagerteam.html", ctx) @@ -835,6 +853,9 @@ def add_slack(request): "slack_client_id": settings.SLACK_CLIENT_ID } + if request.user.is_authenticated: + ctx["project"] = request.project + if settings.SLACK_CLIENT_ID and request.user.is_authenticated: ctx["state"] = _prepare_state(request, "slack") @@ -909,6 +930,7 @@ def add_pushbullet(request): ctx = { "page": "channels", + "project": request.project, "authorize_url": authorize_url } return render(request, "integrations/add_pushbullet.html", ctx) @@ -957,6 +979,7 @@ def add_discord(request): ctx = { "page": "channels", + "project": request.project, "authorize_url": auth_url } @@ -1020,6 +1043,7 @@ def add_pushover(request): # Show Integration Settings form ctx = { "page": "channels", + "project": request.project, "po_retry_delay": td(seconds=settings.PUSHOVER_EMERGENCY_RETRY_DELAY), "po_expiration": td(seconds=settings.PUSHOVER_EMERGENCY_EXPIRATION), } @@ -1040,7 +1064,11 @@ def add_opsgenie(request): else: form = AddUrlForm() - ctx = {"page": "channels", "form": form} + ctx = { + "page": "channels", + "project": request.project, + "form": form + } return render(request, "integrations/add_opsgenie.html", ctx) @@ -1058,7 +1086,11 @@ def add_victorops(request): else: form = AddUrlForm() - ctx = {"page": "channels", "form": form} + ctx = { + "page": "channels", + "project": request.project, + "form": form + } return render(request, "integrations/add_victorops.html", ctx) @@ -1110,6 +1142,8 @@ def add_telegram(request): return redirect("hc-channels") ctx = { + "page": "channels", + "project": request.project, "chat_id": chat_id, "chat_type": chat_type, "chat_name": chat_name, @@ -1141,6 +1175,7 @@ def add_sms(request): ctx = { "page": "channels", + "project": request.project, "form": form, "profile": request.project.owner_profile } @@ -1171,6 +1206,7 @@ def add_trello(request): ctx = { "page": "channels", + "project": request.project, "authorize_url": authorize_url } @@ -1203,6 +1239,7 @@ def add_matrix(request): ctx = { "page": "channels", + "project": request.project, "form": form, "matrix_user_id": settings.MATRIX_USER_ID } diff --git a/templates/accounts/project.html b/templates/accounts/project.html index e6a72bf1..d379df5b 100644 --- a/templates/accounts/project.html +++ b/templates/accounts/project.html @@ -1,4 +1,4 @@ -{% extends "base_project.html" %} +{% extends "base.html" %} {% load compress static hc_extras %} {% block title %}Project Settings - {{ project }}{% endblock %} diff --git a/templates/base.html b/templates/base.html index 35da84fe..4529c0a6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -64,10 +64,12 @@ - - {% if request.user.is_authenticated %} + + + {% if request.user.is_authenticated and project %} + {{ project }} + + {% elif request.user.is_authenticated%} - {% else %} + {% else %} - {% endif %} + {% endif %} - diff --git a/templates/base_project.html b/templates/base_project.html deleted file mode 100644 index fbd5ea2c..00000000 --- a/templates/base_project.html +++ /dev/null @@ -1,169 +0,0 @@ -{% load compress staticfiles hc_extras %} - - - - {% block title %}{% site_name %} - Monitor Cron Jobs. Get Notified When Your Cron Jobs Fail{% endblock %} - {% block description %} - - {% endblock %} - {% block keywords %} - - {% endblock %} - - - - - - - {% compress css %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {% endcompress %} - - - {% debug_warning %} - - - {% block containers %} -
- {% block content %}{% endblock %} -
- {% endblock %} - - - - - {% block scripts %} - {% compress js %} - - - {% endcompress %} - {% endblock %} - - diff --git a/templates/front/badges.html b/templates/front/badges.html index d64eb5fa..1ac159e0 100644 --- a/templates/front/badges.html +++ b/templates/front/badges.html @@ -1,4 +1,4 @@ -{% extends "base_project.html" %} +{% extends "base.html" %} {% load compress static hc_extras %} {% block title %}Account Settings - {% site_name %}{% endblock %} diff --git a/templates/front/channels.html b/templates/front/channels.html index c2d48d1f..b9fea3e0 100644 --- a/templates/front/channels.html +++ b/templates/front/channels.html @@ -1,4 +1,4 @@ -{% extends "base_project.html" %} +{% extends "base.html" %} {% load compress humanize static hc_extras %} {% block title %}Integrations - {% site_name %}{% endblock %} diff --git a/templates/front/details.html b/templates/front/details.html index b96ac673..74676335 100644 --- a/templates/front/details.html +++ b/templates/front/details.html @@ -1,4 +1,4 @@ -{% extends "base_project.html" %} +{% extends "base.html" %} {% load compress humanize static hc_extras %} {% block title %}{{ check|down_title }}{% endblock %} diff --git a/templates/front/log.html b/templates/front/log.html index 0634c7a2..35e9f215 100644 --- a/templates/front/log.html +++ b/templates/front/log.html @@ -1,4 +1,4 @@ -{% extends "base_project.html" %} +{% extends "base.html" %} {% load compress humanize staticfiles hc_extras %} {% block title %}My Checks - {% site_name %}{% endblock %} @@ -9,7 +9,7 @@
-{% endblock %} \ No newline at end of file +{% endblock %}