summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hyperkitty/lib/__init__.py7
-rw-r--r--hyperkitty/static/css/hyperkitty-common.css7
-rw-r--r--hyperkitty/static/js/hyperkitty.js2
-rw-r--r--hyperkitty/templates/base.html11
-rw-r--r--hyperkitty/views/accounts.py10
-rw-r--r--hyperkitty/views/list.py9
6 files changed, 27 insertions, 19 deletions
diff --git a/hyperkitty/lib/__init__.py b/hyperkitty/lib/__init__.py
index 017a0b6..7ae9ee9 100644
--- a/hyperkitty/lib/__init__.py
+++ b/hyperkitty/lib/__init__.py
@@ -26,10 +26,15 @@ import datetime
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.core.mail import EmailMessage
-from mailmanclient import Client
+FLASH_MESSAGES = {
+ "updated-ok": ("success", "The profile was successfully updated."),
+ "sent-ok": ("success", "The message has been sent successfully."),
+}
+
+
def gravatar_url(email):
'''Return a gravatar url for an email address'''
size = 64
diff --git a/hyperkitty/static/css/hyperkitty-common.css b/hyperkitty/static/css/hyperkitty-common.css
index 26b1153..0a3e114 100644
--- a/hyperkitty/static/css/hyperkitty-common.css
+++ b/hyperkitty/static/css/hyperkitty-common.css
@@ -33,13 +33,16 @@
/* Flash messages */
-.flashmsg {
+.flashmsgs {
position: absolute;
left: 0;
width: 100%;
text-align: center;
}
-.flashmsg .alert {
+.flashmsgs .flashmsg-wrapper {
+ display: block;
+}
+.flashmsgs .alert {
display: inline-block;
}
diff --git a/hyperkitty/static/js/hyperkitty.js b/hyperkitty/static/js/hyperkitty.js
index 05be5bc..79cec43 100644
--- a/hyperkitty/static/js/hyperkitty.js
+++ b/hyperkitty/static/js/hyperkitty.js
@@ -352,7 +352,7 @@ function setup_disabled_tooltips() {
}
function setup_flash_messages() {
- $('.flashmsg').delay(3000).fadeOut('slow');
+ $('.flashmsgs .alert-success').delay(3000).fadeOut('slow');
}
diff --git a/hyperkitty/templates/base.html b/hyperkitty/templates/base.html
index 00385a4..ceab0bf 100644
--- a/hyperkitty/templates/base.html
+++ b/hyperkitty/templates/base.html
@@ -59,9 +59,16 @@
</header>
{% if flash_messages %}
- <div class="flashmsg">
+ <div class="flashmsgs">
{% for flash_msg in flash_messages %}
- <div class="alert alert-{{ flash_msg.type }}">{{ flash_msg.msg }}</div>
+ <div class="flashmsg-wrapper">
+ <div class="alert alert-{{ flash_msg.type }}">
+ {% if flash_msg.type != "success" %}
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
+ {% endif %}
+ {{ flash_msg.msg }}
+ </div>
+ </div>
{% endfor %}
</div>
{% endif %}
diff --git a/hyperkitty/views/accounts.py b/hyperkitty/views/accounts.py
index 284eb15..70d7109 100644
--- a/hyperkitty/views/accounts.py
+++ b/hyperkitty/views/accounts.py
@@ -35,17 +35,12 @@ from social_auth.backends import SocialAuthBackend
from hyperkitty.models import UserProfile, Rating, Favorite
from hyperkitty.views.forms import RegistrationForm, UserProfileForm
-from hyperkitty.lib import get_store
+from hyperkitty.lib import get_store, FLASH_MESSAGES
logger = logging.getLogger(__name__)
-FLASH_MESSAGES = {
- "updated-ok": "The profile was successfully updated.",
-}
-
-
def login_view(request, *args, **kwargs):
if "extra_context" not in kwargs:
kwargs["extra_context"] = {}
@@ -120,7 +115,8 @@ def user_profile(request, user_email=None):
flash_messages = []
flash_msg = request.GET.get("msg")
if flash_msg:
- flash_msg = { "type": "success", "msg": FLASH_MESSAGES[flash_msg] }
+ flash_msg = { "type": FLASH_MESSAGES[flash_msg][0],
+ "msg": FLASH_MESSAGES[flash_msg][1] }
flash_messages.append(flash_msg)
context = {
diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py
index 1203c7d..000b7b3 100644
--- a/hyperkitty/views/list.py
+++ b/hyperkitty/views/list.py
@@ -33,6 +33,7 @@ from django.http import Http404
from hyperkitty.models import Tag, Favorite
from hyperkitty.lib import get_months, get_store, get_display_dates, daterange
+from hyperkitty.lib import FLASH_MESSAGES
from hyperkitty.lib.voting import get_votes
from forms import SearchForm
@@ -41,11 +42,6 @@ if settings.USE_MOCKUPS:
from hyperkitty.lib.mockup import generate_top_author, generate_thread_per_category
-FLASH_MESSAGES = {
- "sent-ok": "The message has been sent successfully.",
-}
-
-
def archives(request, mlist_fqdn, year=None, month=None, day=None):
if year is None and month is None:
today = datetime.date.today()
@@ -147,7 +143,8 @@ def _thread_list(request, mlist, threads, template_name='thread_list.html', extr
flash_messages = []
flash_msg = request.GET.get("msg")
if flash_msg:
- flash_msg = { "type": "success", "msg": FLASH_MESSAGES[flash_msg] }
+ flash_msg = { "type": FLASH_MESSAGES[flash_msg][0],
+ "msg": FLASH_MESSAGES[flash_msg][1] }
flash_messages.append(flash_msg)
context = {