Commit 928150bb authored by Kostas Papadimitriou's avatar Kostas Papadimitriou

Improved user notifications

additional settings to set messages that get displayed on different
im pages (signin, signup, profile pages).
parent 16282168
......@@ -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
......
......@@ -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
}
......
......@@ -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)
ul.messages li { margin-bottom: 5px }
ul.messages { background-color: transparent; }
{% extends "im/base_two_cols.html" %}
{% block extra_messages %}
{% if not messages %}
{% for msg_type, msg in GLOBAL_MESSAGES.items %}
<li class="{{ msg_type }}">{{ msg|safe }}</li>
{% endfor %}
{% for msg_type, msg in PROFILE_MESSAGES.items %}
<li class="{{ msg_type }}">{{ msg|safe }}</li>
{% endfor %}
{% endif %}
{% endblock %}
{% load filters %}
{% block page.title %}Profile{% endblock %}
......
......@@ -2,6 +2,9 @@
{% block extra_messages %}
{% if not messages %}
{% for msg_type, msg in GLOBAL_MESSAGES.items %}
<li class="{{ msg_type }}">{{ msg|safe }}</li>
{% endfor %}
{% for msg_type, msg in LOGIN_MESSAGES.items %}
<li class="{{ msg_type }}">{{ msg|safe }}</li>
{% endfor %}
......
{% extends 'im/base_two_cols.html' %}
{% block extra_messages %}
{% if not messages %}
{% for msg_type, msg in GLOBAL_MESSAGES.items %}
<li class="{{ msg_type }}">{{ msg|safe }}</li>
{% endfor %}
{% for msg_type, msg in SIGNUP_MESSAGES.items %}
<li class="{{ msg_type }}">{{ msg|safe }}</li>
{% endfor %}
{% endif %}
{% endblock %}
{% block page.title %}
Signup
......
......@@ -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 = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment