diff --git a/amadeus/context_processors.py b/amadeus/context_processors.py index b28efeb..47bd62e 100644 --- a/amadeus/context_processors.py +++ b/amadeus/context_processors.py @@ -3,6 +3,7 @@ from datetime import datetime from themes.models import Themes from notifications.models import Notification from mural.models import MuralVisualizations +from chat.models import ChatVisualizations def theme(request): context = {} @@ -35,4 +36,16 @@ def mural_notifies(request): context['mural_notifications_count'] = notifications + return context + +def chat_notifies(request): + context = {} + + notifications = 0 + + if request.user.is_authenticated: + notifications = ChatVisualizations.objects.filter(viewed = False, user = request.user).count() + + context['chat_notifications_count'] = notifications + return context \ No newline at end of file diff --git a/amadeus/settings.py b/amadeus/settings.py index 9652874..8ca2238 100644 --- a/amadeus/settings.py +++ b/amadeus/settings.py @@ -118,6 +118,7 @@ TEMPLATES = [ 'amadeus.context_processors.theme', 'amadeus.context_processors.notifies', 'amadeus.context_processors.mural_notifies', + 'amadeus.context_processors.chat_notifies', ], }, }, diff --git a/amadeus/static/css/base/amadeus.css b/amadeus/static/css/base/amadeus.css index 3aeba58..f9c1bc8 100755 --- a/amadeus/static/css/base/amadeus.css +++ b/amadeus/static/css/base/amadeus.css @@ -1468,6 +1468,7 @@ div.dataTables_wrapper div.dataTables_paginate { #msg_editable { width: 100%; z-index: 1; + min-height: 20px; } .action-button { diff --git a/amadeus/static/js/socket.js b/amadeus/static/js/socket.js index f440bbe..6d6d15d 100644 --- a/amadeus/static/js/socket.js +++ b/amadeus/static/js/socket.js @@ -239,6 +239,43 @@ function messageReceived(content) { $(this).hide(); }); + } else { + var talk_line = $("#talk-" + content.container), + talk_notifies = talk_line.find('.chat_notify'), + actual_count = talk_notifies.text(); + + actual_count = parseInt(actual_count, 10) + 1; + + talk_notifies.text(actual_count); + + $('.chat_badge').each(function () { + var actual = $(this).text(); + + if (actual != "+99") { + actual = parseInt(actual, 10) + 1; + + if (actual > 99) { + actual = "+99"; + } + + $(this).text(actual); + } + + $(this).show(); + }); + + $('.chat-tabs').find('li').each(function () { + var identity = $(this).data('chat'); + + if (identity == content.subtype) { + var span = $(this).find('span'), + actual = span.text(); + + actual = parseInt(actual, 10) + 1; + + span.text(actual); + } + }); } if (("Notification" in window)) { diff --git a/amadeus/templates/base.html b/amadeus/templates/base.html index 23ae849..68eb560 100644 --- a/amadeus/templates/base.html +++ b/amadeus/templates/base.html @@ -209,6 +209,7 @@