Revision 60e78c99
b/snf-astakos-app/Changelog | ||
---|---|---|
1 | 1 |
Changelog |
2 | 2 |
--------- |
3 | 3 |
|
4 |
v0.7.1 |
|
5 |
^^^^^^ |
|
6 |
- ASTAKOS_*_MESSAGES settings changed from dict to tuple lists |
|
7 |
- Theme changes (new colors, new font) |
|
8 |
|
|
4 | 9 |
v0.7.0 |
5 | 10 |
^^^^^^ |
6 | 11 |
- Rename management commands |
b/snf-astakos-app/astakos/im/context_processors.py | ||
---|---|---|
57 | 57 |
return {'IM_STATIC_URL' : IM_STATIC_URL} |
58 | 58 |
|
59 | 59 |
def custom_messages(request): |
60 |
global GLOBAL_MESSAGES, SIGNUP_MESSAGES, LOGIN_MESSAGES, PROFILE_MESSAGES |
|
61 |
|
|
62 |
# keep backwards compatibility with dict settings |
|
63 |
if type(GLOBAL_MESSAGES) == dict: |
|
64 |
GLOBAL_MESSAGES = GLOBAL_MESSAGES.items() |
|
65 |
if type(SIGNUP_MESSAGES) == dict: |
|
66 |
SIGNUP_MESSAGES = SIGNUP_MESSAGES.items() |
|
67 |
if type(LOGIN_MESSAGES) == dict: |
|
68 |
LOGIN_MESSAGES = LOGIN_MESSAGES.items() |
|
69 |
if type(PROFILE_MESSAGES) == dict: |
|
70 |
PROFILE_MESSAGES = PROFILE_MESSAGES.items() |
|
71 |
|
|
60 | 72 |
EXTRA_MESSAGES_SET = bool(GLOBAL_MESSAGES or SIGNUP_MESSAGES or \ |
61 | 73 |
LOGIN_MESSAGES or PROFILE_MESSAGES) |
74 |
|
|
62 | 75 |
return { |
63 | 76 |
'GLOBAL_MESSAGES' : GLOBAL_MESSAGES, |
64 | 77 |
'SIGNUP_MESSAGES' : SIGNUP_MESSAGES, |
b/snf-astakos-app/astakos/im/settings.py | ||
---|---|---|
50 | 50 |
# Set recaptcha keys |
51 | 51 |
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '') |
52 | 52 |
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '') |
53 |
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
|
|
53 |
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS', |
|
54 | 54 |
{'theme' : 'custom', 'custom_theme_widget': 'okeanos_recaptcha'}) |
55 | 55 |
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True) |
56 | 56 |
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', True) |
... | ... | |
69 | 69 |
|
70 | 70 |
# Messages to display on login page header |
71 | 71 |
# e.g. {'warning': 'This warning message will be displayed on the top of login page'} |
72 |
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', {})
|
|
72 |
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', [])
|
|
73 | 73 |
|
74 | 74 |
# Messages to display on login page header |
75 | 75 |
# e.g. {'warning': 'This warning message will be displayed on the top of signup page'} |
76 |
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', {})
|
|
76 |
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', [])
|
|
77 | 77 |
|
78 | 78 |
# Messages to display on login page header |
79 | 79 |
# e.g. {'warning': 'This warning message will be displayed on the top of profile page'} |
80 |
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', {})
|
|
80 |
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', [])
|
|
81 | 81 |
|
82 | 82 |
# Messages to display on all pages |
83 | 83 |
# e.g. {'warning': 'This warning message will be displayed on the top of every page'} |
84 |
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', {})
|
|
84 |
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', [])
|
|
85 | 85 |
|
86 | 86 |
# messages to display as extra actions in account forms |
87 | 87 |
# e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'} |
b/snf-astakos-app/astakos/im/static/im/css/modules.css | ||
---|---|---|
30 | 30 |
.top-msg +.mainlogo { margin-top:-73px;} |
31 | 31 |
.top-msg .close { position:absolute; bottom:20px; right:20px; font-size:1.3em; font-weight:bold; border:0 none; color:#fff; text-decoration:none;} |
32 | 32 |
.top-msg .close:hover { color:#000;} |
33 |
.top-msg.success { background-color:#77C596; color: #fff} |
|
34 |
.top-msg.error { background-color:#EF4F54; color: #fff} |
|
35 |
.top-msg.warning { background-color:#F6921E; color: #fff} |
|
36 |
.top-msg.info { background-color:#C3C3B9; color: #fff} |
|
37 |
.top-msg.warning a { color: #3582AC} |
|
38 |
.top-msg.info a { color: #222} |
|
33 | 39 |
|
34 | 40 |
/* container */ |
35 | 41 |
.container .wrapper { padding-bottom:100px;} |
... | ... | |
280 | 286 |
.widjets li { width:50%; float:left; list-style:none outside; margin:30px 0; } |
281 | 287 |
.widjets li div { border:1px dashed #000; padding:20px 20px 70px; width:60%; margin:0 auto; position:relative; } |
282 | 288 |
.widjets li div img { max-width:100%; } |
283 |
.widjets li .btn { text-align:center; position:absolute; bottom:0; left:0; right:0; } |
|
289 |
.widjets li .btn { text-align:center; position:absolute; bottom:0; left:0; right:0; } |
b/snf-astakos-app/astakos/im/static/im/js/common.js | ||
---|---|---|
114 | 114 |
|
115 | 115 |
|
116 | 116 |
|
117 |
$('.top-msg .success').parents('.top-msg').css( |
|
118 |
{ |
|
119 |
backgroundColor: '#77C596', |
|
120 |
color: '#fff' |
|
121 |
} |
|
122 |
); |
|
123 |
|
|
124 |
$('.top-msg .error').parents('.top-msg').css( |
|
125 |
{ |
|
126 |
backgroundColor: '#EF4F54', |
|
127 |
color: '#fff' |
|
128 |
} |
|
129 |
); |
|
130 |
|
|
131 |
|
|
132 |
$('.top-msg .warning').parents('.top-msg').css( |
|
133 |
{ |
|
134 |
backgroundColor: '#F6921E', |
|
135 |
color: '#fff' |
|
136 |
} |
|
137 |
); |
|
138 |
|
|
139 |
$('.top-msg .info').parents('.top-msg').css( |
|
140 |
{ |
|
141 |
backgroundColor: '#C3C3B9', |
|
142 |
color: '#fff' |
|
143 |
} |
|
144 |
); |
|
117 |
$('.top-msg .success').parents('.top-msg').addClass('success'); |
|
118 |
$('.top-msg .error').parents('.top-msg').addClass('error'); |
|
119 |
$('.top-msg .warning').parents('.top-msg').addClass('warning'); |
|
120 |
$('.top-msg .info').parents('.top-msg').addClass('info'); |
|
145 | 121 |
|
146 | 122 |
// clouds homepage animation |
147 | 123 |
$('#animation a').hover( |
b/snf-astakos-app/astakos/im/templates/im/account_base.html | ||
---|---|---|
1 | 1 |
{% extends "im/base.html" %} |
2 | 2 |
|
3 |
{% block extra_messages %} |
|
4 |
{% if not messages %} |
|
5 |
{% for msg_type, msg in GLOBAL_MESSAGES.items %} |
|
6 |
<div class="{{ msg_type }}">{{ msg|safe }}</div> |
|
7 |
{% endfor %} |
|
8 |
{% for msg_type, msg in PROFILE_MESSAGES.items %} |
|
9 |
<div class="{{ msg_type }}">{{ msg|safe }}</div> |
|
10 |
{% endfor %} |
|
11 |
{% endif %} |
|
12 |
{% endblock %} |
|
13 |
|
|
14 | 3 |
{% load filters %} |
15 | 4 |
|
16 | 5 |
{% block page.title %}Profile{% endblock %} |
b/snf-astakos-app/astakos/im/templates/im/base.html | ||
---|---|---|
1 |
<!doctype html> |
|
1 |
{% load astakos_tags %}<!doctype html>
|
|
2 | 2 |
<head> |
3 | 3 |
{% block starthead %}{% endblock starthead %} |
4 | 4 |
<meta charset="UTF-8"> |
... | ... | |
74 | 74 |
|
75 | 75 |
<body> |
76 | 76 |
<div class="container"> |
77 |
<div class="wrapper"> |
|
78 |
{% if messages or EXTRA_MESSAGES_SET %} |
|
79 |
<div class="top-msg active"> |
|
80 |
{% block extra_messages %}{% endblock %} |
|
81 |
{% for message in messages %} |
|
82 |
<div{% if message.tags %} |
|
83 |
class="msg {{ message.tags }}"{% endif %}> |
|
84 |
{{ message|safe }}</div> |
|
85 |
{% endfor %} |
|
86 |
<a href="#" title="close" class="close">X</a> |
|
87 |
</div> |
|
88 |
{% endif %} |
|
77 |
<div class="wrapper"> |
|
78 |
|
|
79 |
{% display_messages %} |
|
80 |
|
|
89 | 81 |
<div class="mainlogo"> |
90 |
<a href="/im/">
|
|
82 |
<a href="{% url astakos.im.views.index %}">
|
|
91 | 83 |
<img src="{{ IM_STATIC_URL }}images/accounts-logo.png" alt="accounts" /> |
92 | 84 |
</a> |
93 | 85 |
</div> |
b/snf-astakos-app/astakos/im/templates/im/login_base.html | ||
---|---|---|
1 | 1 |
{% extends 'im/base_two_cols.html'%} |
2 | 2 |
|
3 |
{% block extra_messages %} |
|
4 |
{% if not messages %} |
|
5 |
{% for msg_type, msg in GLOBAL_MESSAGES.items %} |
|
6 |
<li class="{{ msg_type }}">{{ msg|safe }}</li> |
|
7 |
{% endfor %} |
|
8 |
{% for msg_type, msg in LOGIN_MESSAGES.items %} |
|
9 |
<li class="{{ msg_type }}">{{ msg|safe }}</li> |
|
10 |
{% endfor %} |
|
11 |
{% endif %} |
|
12 |
{% endblock %} |
|
13 |
|
|
14 | 3 |
{% block signup_class %}hidden{% endblock %} |
15 | 4 |
{% block page.title %}{% endblock %} |
16 | 5 |
|
b/snf-astakos-app/astakos/im/templates/im/signup.html | ||
---|---|---|
1 | 1 |
{% extends 'im/base_two_cols.html' %} |
2 | 2 |
|
3 |
{% block extra_messages %} |
|
4 |
{% if not messages %} |
|
5 |
{% for msg_type, msg in GLOBAL_MESSAGES.items %} |
|
6 |
<li class="{{ msg_type }}">{{ msg|safe }}</li> |
|
7 |
{% endfor %} |
|
8 |
{% for msg_type, msg in SIGNUP_MESSAGES.items %} |
|
9 |
<li class="{{ msg_type }}">{{ msg|safe }}</li> |
|
10 |
{% endfor %} |
|
11 |
{% endif %} |
|
12 |
{% endblock %} |
|
13 |
|
|
14 | 3 |
{% block page.title %} |
15 | 4 |
Signup |
16 | 5 |
{% endblock %} |
b/snf-astakos-app/astakos/im/templatetags/astakos_tags.py | ||
---|---|---|
1 |
from django import template |
|
2 |
from django.core.urlresolvers import reverse, resolve |
|
3 |
from django.conf import settings |
|
4 |
|
|
5 |
register = template.Library() |
|
6 |
|
|
7 |
MESSAGES_VIEWS_MAP = getattr(settings, 'ASTAKOS_MESSAGES_VIEWS_MAP', { |
|
8 |
'astakos.im.views.index': 'LOGIN_MESSAGES', |
|
9 |
'astakos.im.views.logout': 'LOGIN_MESSAGES', |
|
10 |
'astakos.im.views.login': 'LOGIN_MESSAGES', |
|
11 |
'astakos.im.views.signup': 'SIGNUP_MESSAGES', |
|
12 |
'astakos.im.views.edit_profile': 'PROFILE_MESSAGES', |
|
13 |
'astakos.im.views.change_password': 'PROFILE_MESSAGES', |
|
14 |
'astakos.im.views.invite': 'PROFILE_MESSAGES', |
|
15 |
'astakos.im.views.feedback': 'PROFILE_MESSAGES', |
|
16 |
}) |
|
17 |
|
|
18 |
@register.tag(name='display_messages') |
|
19 |
def display_messages(parser, token): |
|
20 |
return MessagesNode() |
|
21 |
|
|
22 |
class DummyMessage(object): |
|
23 |
def __init__(self, type, msg): |
|
24 |
self.message = msg |
|
25 |
self.tags = type |
|
26 |
|
|
27 |
def __repr__(self): |
|
28 |
return "%s: %s" % (self.tags, self.message) |
|
29 |
|
|
30 |
class MessagesNode(template.Node): |
|
31 |
|
|
32 |
def get_view_messages(self, context): |
|
33 |
messages = list(context['GLOBAL_MESSAGES']) |
|
34 |
try: |
|
35 |
view = resolve(context['request'].get_full_path())[0] |
|
36 |
view_name = "%s.%s" % (view.__module__, view.func_name) |
|
37 |
messages += context[MESSAGES_VIEWS_MAP.get(view_name)] |
|
38 |
return messages |
|
39 |
except Exception, e: |
|
40 |
return messages |
|
41 |
|
|
42 |
def render(self, context): |
|
43 |
if self not in context.render_context: |
|
44 |
messages = list(context['messages']) |
|
45 |
if context['EXTRA_MESSAGES_SET']: |
|
46 |
view_messages = self.get_view_messages(context) |
|
47 |
for msg_object in view_messages: |
|
48 |
messages.append(DummyMessage(msg_object[0], msg_object[1])) |
|
49 |
|
|
50 |
if not messages: |
|
51 |
return "" |
|
52 |
|
|
53 |
cls = messages[-1].tags |
|
54 |
content = '<div class="top-msg active %s">' % cls |
|
55 |
for msg in messages: |
|
56 |
content += '<div class="msg %s">%s</div>' % (msg.tags, msg.message) |
|
57 |
|
|
58 |
content += '<a href="#" title="close" class="close">X</a>' |
|
59 |
content += '</div>' |
|
60 |
context.render_context[self] = content |
|
61 |
|
|
62 |
return context.render_context[self] |
b/snf-astakos-app/conf/20-snf-astakos-app-settings.conf | ||
---|---|---|
68 | 68 |
#ASTAKOS_RE_USER_EMAIL_PATTERNS = [] |
69 | 69 |
|
70 | 70 |
# Messages to display on login page header |
71 |
# e.g. {'warning': 'This warning message will be displayed on the top of login page'}
|
|
72 |
#ASTAKOS_LOGIN_MESSAGES = {}
|
|
71 |
# e.g. [('warning', 'This warning message will be displayed on the top of login page')]
|
|
72 |
#ASTAKOS_LOGIN_MESSAGES = []
|
|
73 | 73 |
|
74 | 74 |
# Messages to display on signup page header |
75 |
# e.g. {'warning': 'This warning message will be displayed on the top of signup page'}
|
|
76 |
#ASTAKOS_SIGNUP_MESSAGES = {}
|
|
75 |
# e.g. [('warning', 'This warning message will be displayed on the top of signup page')]
|
|
76 |
#ASTAKOS_SIGNUP_MESSAGES = []
|
|
77 | 77 |
|
78 | 78 |
# Messages to display on profile page header |
79 |
# e.g. {'warning': 'This warning message will be displayed on the top of profile pages'}
|
|
80 |
#ASTAKOS_PROFILE_MESSAGES = {}
|
|
79 |
# e.g. [('warning', 'This warning message will be displayed on the top of profile pages')]
|
|
80 |
#ASTAKOS_PROFILE_MESSAGES = []
|
|
81 | 81 |
|
82 | 82 |
# Messages to display on global page header |
83 |
# e.g. {'warning': 'This warning message will be displayed on the top of all pages'}
|
|
84 |
#ASTAKOS_GLOBAL_MESSAGES = {}
|
|
83 |
# e.g. [('warning', 'This warning message will be displayed on the top of all pages')]
|
|
84 |
#ASTAKOS_GLOBAL_MESSAGES = []
|
|
85 | 85 |
|
86 | 86 |
# messages to display as extra actions in account forms |
87 | 87 |
# e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'} |
88 |
#ASTAKOS_PROFILE_EXTRA_LINKS = {}
|
|
88 |
#ASTAKOS_PROFILE_EXTRA_LINKS = []
|
|
89 | 89 |
|
90 | 90 |
# The number of unsuccessful login requests per minute allowed for a specific email |
91 | 91 |
#ASTAKOS_RATELIMIT_RETRIES_ALLOWED = 3 |
Also available in: Unified diff