Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
0aef7656
Commit
0aef7656
authored
Jan 07, 2017
by
Skia
🤘
Browse files
Add quick notifications prototype
parent
9d1eaed6
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/static/core/js/script.js
View file @
0aef7656
...
...
@@ -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
()
{
...
...
core/static/core/style.css
View file @
0aef7656
...
...
@@ -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
;
...
...
core/templates/core/base.jinja
View file @
0aef7656
...
...
@@ -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"
>
...
...
core/views/__init__.py
View file @
0aef7656
...
...
@@ -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
*
...
...
sith/settings.py
View file @
0aef7656
...
...
@@ -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"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment