From: Kostas Papadimitriou Date: Mon, 11 Jun 2012 11:16:20 +0000 (+0300) Subject: Improved user notifications X-Git-Tag: astakos/v0.6.0^0 X-Git-Url: https://code.grnet.gr/git/astakos/commitdiff_plain/ad956265a537551598698177862b06b5a50f0987?hp=98b4e383aa0fb7267a8b3f97d4a5183d2bb55aaf Improved user notifications additional settings to set messages that get displayed on different im pages (signin, signup, profile pages). --- diff --git a/snf-astakos-app/Changelog b/snf-astakos-app/Changelog index 79937ac..69b5e27 100644 --- a/snf-astakos-app/Changelog +++ b/snf-astakos-app/Changelog @@ -25,6 +25,8 @@ v0.6 Logging level controlled by ASTAKOS_LOGGING_LEVEL setting. - Email change mechanism Enabled using ASTAKOS_EMAILCHANGE_ENABLED setting (disabled by default) +- Additional user notification settings + ASTAKOS_SIGNUP_MESSAGES, ASTAKOS_PROFILE_MESSAGES, ASTAKOS_GLOBAL_MESSAGES v0.5.1 diff --git a/snf-astakos-app/astakos/im/context_processors.py b/snf-astakos-app/astakos/im/context_processors.py index 94499f4..5f636a2 100644 --- a/snf-astakos-app/astakos/im/context_processors.py +++ b/snf-astakos-app/astakos/im/context_processors.py @@ -32,7 +32,8 @@ # or implied, of GRNET S.A. from astakos.im.settings import IM_MODULES, INVITATIONS_ENABLED, IM_STATIC_URL, \ - COOKIE_NAME, LOGIN_MESSAGES, PROFILE_EXTRA_LINKS + COOKIE_NAME, LOGIN_MESSAGES, SIGNUP_MESSAGES, PROFILE_MESSAGES, \ + GLOBAL_MESSAGES, PROFILE_EXTRA_LINKS from astakos.im.api.admin import get_menu from astakos.im.util import get_query @@ -57,7 +58,10 @@ def media(request): def custom_messages(request): return { + 'GLOBAL_MESSAGES' : GLOBAL_MESSAGES, + 'SIGNUP_MESSAGES' : SIGNUP_MESSAGES, 'LOGIN_MESSAGES' : LOGIN_MESSAGES, + 'PROFILE_MESSAGES' : PROFILE_MESSAGES, 'PROFILE_EXTRA_LINKS' : PROFILE_EXTRA_LINKS } diff --git a/snf-astakos-app/astakos/im/settings.py b/snf-astakos-app/astakos/im/settings.py index 863130c..6976ebd 100644 --- a/snf-astakos-app/astakos/im/settings.py +++ b/snf-astakos-app/astakos/im/settings.py @@ -70,6 +70,18 @@ RE_USER_EMAIL_PATTERNS = getattr(settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', []) # e.g. {'warning': 'This warning message will be displayed on the top of login page'} LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', {}) +# Messages to display on login page header +# e.g. {'warning': 'This warning message will be displayed on the top of signup page'} +SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', {}) + +# Messages to display on login page header +# e.g. {'warning': 'This warning message will be displayed on the top of profile page'} +PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', {}) + +# Messages to display on all pages +# e.g. {'warning': 'This warning message will be displayed on the top of every page'} +GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', {}) + # messages to display as extra actions in account forms # e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'} PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {}) @@ -85,4 +97,4 @@ EMAILCHANGE_ACTIVATION_DAYS = getattr(settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_ # Set the astakos main functions logging severity (None to disable) from logging import INFO -LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO) \ No newline at end of file +LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO) diff --git a/snf-astakos-app/astakos/im/static/im/css/custom.css b/snf-astakos-app/astakos/im/static/im/css/custom.css index e69de29..c1d3519 100644 --- a/snf-astakos-app/astakos/im/static/im/css/custom.css +++ b/snf-astakos-app/astakos/im/static/im/css/custom.css @@ -0,0 +1,2 @@ +ul.messages li { margin-bottom: 5px } +ul.messages { background-color: transparent; } diff --git a/snf-astakos-app/astakos/im/templates/im/account_base.html b/snf-astakos-app/astakos/im/templates/im/account_base.html index 98ceb36..f61414f 100644 --- a/snf-astakos-app/astakos/im/templates/im/account_base.html +++ b/snf-astakos-app/astakos/im/templates/im/account_base.html @@ -1,5 +1,16 @@ {% extends "im/base_two_cols.html" %} +{% block extra_messages %} + {% if not messages %} + {% for msg_type, msg in GLOBAL_MESSAGES.items %} +
  • {{ msg|safe }}
  • + {% endfor %} + {% for msg_type, msg in PROFILE_MESSAGES.items %} +
  • {{ msg|safe }}
  • + {% endfor %} + {% endif %} +{% endblock %} + {% load filters %} {% block page.title %}Profile{% endblock %} diff --git a/snf-astakos-app/astakos/im/templates/im/login_base.html b/snf-astakos-app/astakos/im/templates/im/login_base.html index c4ad88f..4cfce43 100644 --- a/snf-astakos-app/astakos/im/templates/im/login_base.html +++ b/snf-astakos-app/astakos/im/templates/im/login_base.html @@ -2,6 +2,9 @@ {% block extra_messages %} {% if not messages %} + {% for msg_type, msg in GLOBAL_MESSAGES.items %} +
  • {{ msg|safe }}
  • + {% endfor %} {% for msg_type, msg in LOGIN_MESSAGES.items %}
  • {{ msg|safe }}
  • {% endfor %} diff --git a/snf-astakos-app/astakos/im/templates/im/signup.html b/snf-astakos-app/astakos/im/templates/im/signup.html index c5e5a0a..c7194b1 100644 --- a/snf-astakos-app/astakos/im/templates/im/signup.html +++ b/snf-astakos-app/astakos/im/templates/im/signup.html @@ -1,5 +1,15 @@ {% extends 'im/base_two_cols.html' %} +{% block extra_messages %} + {% if not messages %} + {% for msg_type, msg in GLOBAL_MESSAGES.items %} +
  • {{ msg|safe }}
  • + {% endfor %} + {% for msg_type, msg in SIGNUP_MESSAGES.items %} +
  • {{ msg|safe }}
  • + {% endfor %} + {% endif %} +{% endblock %} {% block page.title %} Signup diff --git a/snf-astakos-app/conf/20-snf-astakos-app-settings.conf b/snf-astakos-app/conf/20-snf-astakos-app-settings.conf index eec64a1..6506337 100644 --- a/snf-astakos-app/conf/20-snf-astakos-app-settings.conf +++ b/snf-astakos-app/conf/20-snf-astakos-app-settings.conf @@ -71,6 +71,18 @@ # e.g. {'warning': 'This warning message will be displayed on the top of login page'} #ASTAKOS_LOGIN_MESSAGES = {} +# Messages to display on signup page header +# e.g. {'warning': 'This warning message will be displayed on the top of signup page'} +#ASTAKOS_SIGNUP_MESSAGES = {} + +# Messages to display on profile page header +# e.g. {'warning': 'This warning message will be displayed on the top of profile pages'} +#ASTAKOS_PROFILE_MESSAGES = {} + +# Messages to display on global page header +# e.g. {'warning': 'This warning message will be displayed on the top of all pages'} +#ASTAKOS_GLOBAL_MESSAGES = {} + # messages to display as extra actions in account forms # e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'} #ASTAKOS_PROFILE_EXTRA_LINKS = {}