From b343beb40d734e691459348dba09a1522ee41300 Mon Sep 17 00:00:00 2001 From: Bachurin Sergey Date: Wed, 27 May 2015 07:48:02 +0300 Subject: [PATCH] django messages in dialogs --- project/myauth/views.py | 2 +- project/static/js/dialogs.js | 12 ++++++++++++ project/templates/base.html | 16 +++++++++++----- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/project/myauth/views.py b/project/myauth/views.py index 9b9e1a6..4d4ee41 100644 --- a/project/myauth/views.py +++ b/project/myauth/views.py @@ -89,7 +89,7 @@ def register(request): def confirm_registered_email(request, key): """Подтверждение зарегистрированного email.""" success_url = 'customer_profile_edit' - success_msg = u'E-mail подтверждён.' + success_msg = u'Ваш e-mail подтверждён. Спасибо за регистрацию.' user = get_object_or_404(models.DokUser, username__iexact = key) # ключ = имя пользователя models.ConfirmEmail.objects.confirm(user) diff --git a/project/static/js/dialogs.js b/project/static/js/dialogs.js index e0bcd24..6e30507 100644 --- a/project/static/js/dialogs.js +++ b/project/static/js/dialogs.js @@ -1,5 +1,6 @@ $(document).ready(function() { var dlg_msg = $('#dialog-message'); + var dlg_django_msg = $('#django-message'); $('form', '#dialogs').each(function() { var form = $(this); @@ -110,6 +111,17 @@ $(document).ready(function() { } } }); + dlg_django_msg.dialog({ + modal: true, + autoOpen: true, + //resizable: false, + //width: 310, + buttons: { + 'Закрыть': function() { + $(this).dialog('close'); + } + } + }); }); function clear_form_errors(form) { diff --git a/project/templates/base.html b/project/templates/base.html index 028e084..9042517 100644 --- a/project/templates/base.html +++ b/project/templates/base.html @@ -15,12 +15,9 @@ {% cms_toolbar %} -{% if messages or license_15days %} +{% if license_15days %}
-
+
+ {% if messages %} +
+ +
+ {% endif %} {% block common_js %}