Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
AE
Sith
Commits
147809bb
Commit
147809bb
authored
Jan 11, 2017
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some great weekmail improvements
parent
83555a36
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
297 additions
and
129 deletions
+297
-129
com/templates/com/weekmail.jinja
com/templates/com/weekmail.jinja
+3
-3
com/templates/com/weekmail_preview.jinja
com/templates/com/weekmail_preview.jinja
+12
-0
com/views.py
com/views.py
+12
-4
core/templates/core/base.jinja
core/templates/core/base.jinja
+1
-1
core/views/user.py
core/views/user.py
+2
-2
locale/fr/LC_MESSAGES/django.po
locale/fr/LC_MESSAGES/django.po
+266
-119
sith/settings.py
sith/settings.py
+1
-0
No files found.
com/templates/com/weekmail.jinja
View file @
147809bb
...
@@ -6,9 +6,9 @@
...
@@ -6,9 +6,9 @@
{%
endblock
%}
{%
endblock
%}
{%
block
content
%}
{%
block
content
%}
<h3>
{%
trans
%}
Weekmail
{%
endtrans
%}
</h3>
<h3>
{%
trans
%}
Weekmail
{%
endtrans
%}
{{
object.id
}}
</h3>
<p><a
href=
"
{{
url
(
'com:weekmail_preview'
)
}}
"
target=
"_blank"
>
{%
trans
%}
Preview
{%
endtrans
%}
</a></p>
<p><a
href=
"
{{
url
(
'com:weekmail_preview'
)
}}
"
>
{%
trans
%}
Preview
{%
endtrans
%}
</a></p>
<p><a
href=
"
?send
"
>
{%
trans
%}
Send
{%
endtrans
%}
</a></p>
<p><a
href=
"
{{
url
(
'com:weekmail_preview'
)
}}
?send=true
"
>
{%
trans
%}
Send
{%
endtrans
%}
</a></p>
<h4>
{%
trans
%}
Articles in no weekmail yet
{%
endtrans
%}
</h4>
<h4>
{%
trans
%}
Articles in no weekmail yet
{%
endtrans
%}
</h4>
<table>
<table>
<thead>
<thead>
...
...
com/templates/com/weekmail_preview.jinja
View file @
147809bb
...
@@ -6,6 +6,18 @@
...
@@ -6,6 +6,18 @@
{%
endblock
%}
{%
endblock
%}
{%
block
content
%}
{%
block
content
%}
<a
href=
"
{{
url
(
'com:weekmail'
)
}}
"
>
{%
trans
%}
Back
{%
endtrans
%}
</a>
{%
if
request.GET
[
'send'
]
%}
<p>
{%
trans
%}
Are you sure you want to send this weekmail?
{%
endtrans
%}
</p>
{%
if
request.LANGUAGE_CODE
!=
settings.LANGUAGE_CODE
[
:
2
]
%}
<p><strong>
{%
trans
%}
Warning: you are sending the weekmail in another language than the default one!
{%
endtrans
%}
</strong></p>
{%
endif
%}
<form
method=
"post"
action=
""
>
{%
csrf_token
%}
<button
type=
"submit"
name=
"send"
value=
"validate"
>
{%
trans
%}
Send
{%
endtrans
%}
</button>
</form>
{%
endif
%}
<hr>
{{
weekmail_rendered
|
safe
}}
{{
weekmail_rendered
|
safe
}}
{%
endblock
%}
{%
endblock
%}
...
...
com/views.py
View file @
147809bb
from
django.shortcuts
import
render
,
redirect
,
get_object_or_404
from
django.shortcuts
import
render
,
redirect
,
get_object_or_404
from
django.http
import
HttpResponseRedirect
from
django.views.generic
import
ListView
,
DetailView
,
RedirectView
from
django.views.generic
import
ListView
,
DetailView
,
RedirectView
from
django.views.generic.edit
import
UpdateView
,
CreateView
,
DeleteView
from
django.views.generic.edit
import
UpdateView
,
CreateView
,
DeleteView
from
django.views.generic.detail
import
SingleObjectMixin
from
django.views.generic.detail
import
SingleObjectMixin
...
@@ -231,10 +232,20 @@ class NewsDetailView(CanViewMixin, DetailView):
...
@@ -231,10 +232,20 @@ class NewsDetailView(CanViewMixin, DetailView):
# Weekmail
# Weekmail
class
WeekmailPreviewView
(
DetailView
):
class
WeekmailPreviewView
(
ComTabsMixin
,
DetailView
):
model
=
Weekmail
model
=
Weekmail
template_name
=
'com/weekmail_preview.jinja'
template_name
=
'com/weekmail_preview.jinja'
success_url
=
reverse_lazy
(
'com:weekmail'
)
success_url
=
reverse_lazy
(
'com:weekmail'
)
current_tab
=
"weekmail"
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
()
try
:
if
request
.
POST
[
'send'
]
==
"validate"
:
self
.
object
.
send
()
return
HttpResponseRedirect
(
reverse
(
'com:weekmail'
)
+
"?qn_weekmail_send_success"
)
except
:
pass
return
super
(
WeekmailEditView
,
self
).
get
(
request
,
*
args
,
**
kwargs
)
def
get_object
(
self
,
queryset
=
None
):
def
get_object
(
self
,
queryset
=
None
):
return
self
.
model
.
objects
.
filter
(
sent
=
False
).
order_by
(
'-id'
).
first
()
return
self
.
model
.
objects
.
filter
(
sent
=
False
).
order_by
(
'-id'
).
first
()
...
@@ -291,9 +302,6 @@ class WeekmailEditView(ComTabsMixin, QuickNotifMixin, UpdateView):
...
@@ -291,9 +302,6 @@ class WeekmailEditView(ComTabsMixin, QuickNotifMixin, UpdateView):
art
.
rank
=
-
1
art
.
rank
=
-
1
art
.
save
()
art
.
save
()
self
.
quick_notif_list
+=
[
'qn_success'
]
self
.
quick_notif_list
+=
[
'qn_success'
]
if
'send'
in
request
.
GET
.
keys
():
self
.
object
.
send
()
self
.
quick_notif_list
+=
[
'qn_success'
]
return
super
(
WeekmailEditView
,
self
).
get
(
request
,
*
args
,
**
kwargs
)
return
super
(
WeekmailEditView
,
self
).
get
(
request
,
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
...
...
core/templates/core/base.jinja
View file @
147809bb
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
<ul
id=
"quick_notif"
>
<ul
id=
"quick_notif"
>
{%
for
n
in
quick_notifs
%}
{%
for
n
in
quick_notifs
%}
<li>
{{
n
}}
</li>
<li>
{{
n
}}
</li>
{%
endfor
%}
{%
endfor
%}
</ul>
</ul>
...
...
core/views/user.py
View file @
147809bb
...
@@ -17,7 +17,7 @@ from django.utils import timezone
...
@@ -17,7 +17,7 @@ from django.utils import timezone
from
datetime
import
timedelta
,
datetime
,
date
from
datetime
import
timedelta
,
datetime
,
date
import
logging
import
logging
from
core.views
import
CanViewMixin
,
CanEditMixin
,
CanEditPropMixin
,
TabedViewMixin
from
core.views
import
CanViewMixin
,
CanEditMixin
,
CanEditPropMixin
,
TabedViewMixin
,
QuickNotifMixin
from
core.views.forms
import
RegisteringForm
,
UserPropForm
,
UserProfileForm
,
LoginForm
,
UserGodfathersForm
from
core.views.forms
import
RegisteringForm
,
UserPropForm
,
UserProfileForm
,
LoginForm
,
UserGodfathersForm
from
core.models
import
User
,
SithFile
,
Preferences
from
core.models
import
User
,
SithFile
,
Preferences
from
club.models
import
Club
from
club.models
import
Club
...
@@ -415,7 +415,7 @@ class UserUpdateGroupView(UserTabsMixin, CanEditPropMixin, UpdateView):
...
@@ -415,7 +415,7 @@ class UserUpdateGroupView(UserTabsMixin, CanEditPropMixin, UpdateView):
context_object_name
=
"profile"
context_object_name
=
"profile"
current_tab
=
"groups"
current_tab
=
"groups"
class
UserToolsView
(
UserTabsMixin
,
TemplateView
):
class
UserToolsView
(
QuickNotifMixin
,
UserTabsMixin
,
TemplateView
):
"""
"""
Displays the logged user's tools
Displays the logged user's tools
"""
"""
...
...
locale/fr/LC_MESSAGES/django.po
View file @
147809bb
This diff is collapsed.
Click to expand it.
sith/settings.py
View file @
147809bb
...
@@ -471,6 +471,7 @@ SITH_QUICK_NOTIF = {
...
@@ -471,6 +471,7 @@ SITH_QUICK_NOTIF = {
'qn_fail'
:
_
(
"Fail!"
),
'qn_fail'
:
_
(
"Fail!"
),
'qn_weekmail_new_article'
:
_
(
"You successfully posted an article in the Weekmail"
),
'qn_weekmail_new_article'
:
_
(
"You successfully posted an article in the Weekmail"
),
'qn_weekmail_article_edit'
:
_
(
"You successfully edited an article in the Weekmail"
),
'qn_weekmail_article_edit'
:
_
(
"You successfully edited an article in the Weekmail"
),
'qn_weekmail_send_success'
:
_
(
"You successfully sent the Weekmail"
),
}
}
try
:
try
:
...
...
Write
Preview
Markdown
is supported
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