From e1d5fa8638e71b0d69fae32381b7347c20e09dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Sat, 14 Oct 2017 22:04:11 +0300 Subject: [PATCH] Nicer "your settings have been updated" message. --- hc/accounts/views.py | 13 +++++++------ templates/accounts/badges.html | 2 +- templates/accounts/notifications.html | 14 ++++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/hc/accounts/views.py b/hc/accounts/views.py index 5d5d4db4..f600d6a1 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -237,6 +237,12 @@ def notifications(request): _ensure_own_team(request) profile = request.profile + ctx = { + "status": "default", + "page": "profile", + "profile": profile + } + if request.method == "POST": form = ReportSettingsForm(request.POST) if form.is_valid(): @@ -257,12 +263,7 @@ def notifications(request): profile.next_nag_date = None profile.save() - messages.success(request, "Your settings have been updated!") - - ctx = { - "page": "profile", - "profile": profile, - } + ctx["status"] = "info" return render(request, "accounts/notifications.html", ctx) diff --git a/templates/accounts/badges.html b/templates/accounts/badges.html index f0019dd0..58a78be2 100644 --- a/templates/accounts/badges.html +++ b/templates/accounts/badges.html @@ -13,7 +13,7 @@
diff --git a/templates/accounts/notifications.html b/templates/accounts/notifications.html index 2d1958bf..f6c8f58a 100644 --- a/templates/accounts/notifications.html +++ b/templates/accounts/notifications.html @@ -8,13 +8,6 @@

Settings

- {% if messages %} -
- {% for message in messages %} -

{{ message }}

- {% endfor %} -
- {% endif %}
@@ -27,7 +20,7 @@
-
+
{% csrf_token %} @@ -91,6 +84,11 @@ class="btn btn-default pull-right">Save Changes
+ {% if status == "info" %} + + {% endif %}