Commit c7507e67 authored by fred's avatar fred

add support for notification messages

parent b6e5ba37
......@@ -532,6 +532,20 @@ div.text {
margin-bottom: 1em;
}
ul.messages {
position: absolute;
background: rgba(10, 10, 10, 0.8);
display: block;
top: 5px;
right: 0px;
color: white;
border-radius: 1em;
list-style: none;
z-index: 10;
box-shadow: 0px 0px 5px black;
}
[class^="icon-"]:after, [class*=" icon-"]:after,
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: FontAwesome;
......
......@@ -92,6 +92,16 @@
{% endblock %}
</div>
{% block beforecontent %}
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
<script>
$(document).ready(function() { $('.messages').delay(5000).fadeOut('slow'); });
</script>
{% endif %}
{% endblock %}
{% block content %}
{% endblock %}
......
......@@ -27,7 +27,7 @@ urlpatterns = patterns('',
url(r'^search/', search_view_factory(view_class=FacetedSearchView,
form_class=FacetedSearchForm, searchqueryset=sqs), name='haystack_search'),
url(r'^emissions/$', 'panikdb.views.emissions', name='emission-list'),
url(r'^emissions/$', 'panikdb.views.emissions_list', name='emission-list'),
url(r'^emissions/',
decorated_includes(login_required, include(emissions_urlpatterns))),
......
......@@ -6,6 +6,7 @@ from django.core.urlresolvers import reverse
from django.template import loader, Context
from django.views.generic.base import TemplateView, RedirectView
from django.views.generic.list import ListView
from django.contrib import messages
from emissions.models import *
from emissions.utils import period_program
......@@ -31,7 +32,7 @@ home = login_required(Home.as_view())
class EmissionListView(emissions.views.EmissionListView):
pass
emissions = login_required(EmissionListView.as_view())
emissions_list = login_required(EmissionListView.as_view())
......@@ -95,6 +96,7 @@ class FocusSetView(RedirectView):
def get_redirect_url(self, object_type, object_id):
if not self.request.user.has_perm('emissions.add_focus'):
raise PermissionDenied()
messages.success(self.request, emissions.views.SUCCESS_MESSAGE)
if object_type == 'emission':
emission = Emission.objects.get(id=object_id)
try:
......@@ -149,6 +151,7 @@ class FocusUnsetView(RedirectView):
def get_redirect_url(self, object_type, object_id):
if not self.request.user.has_perm('emissions.delete_focus'):
raise PermissionDenied()
messages.success(self.request, emissions.views.SUCCESS_MESSAGE)
if object_type == 'emission':
emission = Emission.objects.get(id=object_id)
focus = Focus.objects.get(emission=emission)
......
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