mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 10:34:21 +00:00
Add quick notifications prototype
This commit is contained in:
parent
9d1eaed625
commit
0aef7656b8
@ -35,6 +35,9 @@ $( function() {
|
||||
popup.html('<iframe src="/file/popup" width="100%" height="95%"></iframe><div id="file_id" value="null" />');
|
||||
popup.dialog({title: $(this).text()}).dialog( "open" );
|
||||
});
|
||||
$("#quick_notif li").click(function () {
|
||||
$(this).hide();
|
||||
})
|
||||
} );
|
||||
|
||||
function display_notif() {
|
||||
|
@ -122,6 +122,15 @@ nav a:hover {
|
||||
}
|
||||
|
||||
/*--------------------------------CONTENT------------------------------*/
|
||||
#quick_notif {
|
||||
width: 90%;
|
||||
margin: 0px auto;
|
||||
list-style-type: none;
|
||||
background: lightblue;
|
||||
}
|
||||
#quick_notif li {
|
||||
padding: 10px;
|
||||
}
|
||||
#content {
|
||||
width: 88%;
|
||||
margin: 0px auto;
|
||||
|
@ -100,6 +100,12 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
<ul id="quick_notif">
|
||||
{% for n in quick_notifs %}
|
||||
<li>{{ n }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<div id="content">
|
||||
{% if list_of_tabs %}
|
||||
<div class="tool-bar">
|
||||
|
@ -147,6 +147,34 @@ class TabedViewMixin(View):
|
||||
kwargs['list_of_tabs'] = self.get_list_of_tabs()
|
||||
return kwargs
|
||||
|
||||
class QuickNotifMixin():
|
||||
quick_notif_list = []
|
||||
def get_success_url(self):
|
||||
ret = super(QuickNotifMixin, self).get_success_url()
|
||||
try:
|
||||
if '?' in ret:
|
||||
ret += '&' + self.quick_notif_url_arg
|
||||
else:
|
||||
ret += '?' + self.quick_notif_url_arg
|
||||
except: pass
|
||||
return ret
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Add quick notifications to context"""
|
||||
kwargs = super(QuickNotifMixin, self).get_context_data(**kwargs)
|
||||
kwargs['quick_notifs'] = []
|
||||
print(self.quick_notif_list)
|
||||
for n in self.quick_notif_list:
|
||||
kwargs['quick_notifs'].append(settings.SITH_QUICK_NOTIF[n])
|
||||
self.quick_notif_list = [] # In some cases, the class can stay instanciated, so we need to reset the list
|
||||
for k,v in settings.SITH_QUICK_NOTIF.items():
|
||||
for gk in self.request.GET.keys():
|
||||
if k == gk:
|
||||
kwargs['quick_notifs'].append(v)
|
||||
print(self.quick_notif_list)
|
||||
return kwargs
|
||||
|
||||
|
||||
from .user import *
|
||||
from .page import *
|
||||
from .files import *
|
||||
|
@ -466,6 +466,13 @@ SITH_NOTIFICATIONS = [
|
||||
('GENERIC', _("You have a notification")),
|
||||
]
|
||||
|
||||
SITH_QUICK_NOTIF = {
|
||||
'qn_success': _("Success!"),
|
||||
'qn_fail': _("Fail!"),
|
||||
'qn_weekmail_new_article': _("You successfully posted an article in the Weekmail"),
|
||||
'qn_weekmail_article_edit': _("You successfully edited an article in the Weekmail"),
|
||||
}
|
||||
|
||||
try:
|
||||
from .settings_custom import *
|
||||
print("Custom settings imported")
|
||||
|
Loading…
Reference in New Issue
Block a user