mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-13 13:29:23 +00:00
Compare commits
2 Commits
master
...
feature/ea
Author | SHA1 | Date | |
---|---|---|---|
858199e476 | |||
f6ecbd899d |
@ -61,6 +61,11 @@ NEWS_TYPES = [
|
|||||||
("CALL", _("Call")),
|
("CALL", _("Call")),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
WEEKMAIL_TYPE = [
|
||||||
|
("WEEKMAIL", _("Weekmail")),
|
||||||
|
("INVITATION", _("Invitation")),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class News(models.Model):
|
class News(models.Model):
|
||||||
"""The news class"""
|
"""The news class"""
|
||||||
@ -178,6 +183,9 @@ class Weekmail(models.Model):
|
|||||||
protip = models.TextField(_("protip"), blank=True)
|
protip = models.TextField(_("protip"), blank=True)
|
||||||
conclusion = models.TextField(_("conclusion"), blank=True)
|
conclusion = models.TextField(_("conclusion"), blank=True)
|
||||||
sent = models.BooleanField(_("sent"), default=False)
|
sent = models.BooleanField(_("sent"), default=False)
|
||||||
|
type = models.CharField(
|
||||||
|
_("type"), max_length=16, choices=WEEKMAIL_TYPE, default="WEEKMAIL"
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["-id"]
|
ordering = ["-id"]
|
||||||
@ -215,6 +223,17 @@ class Weekmail(models.Model):
|
|||||||
None, "com/weekmail_renderer_text.jinja", context={"weekmail": self}
|
None, "com/weekmail_renderer_text.jinja", context={"weekmail": self}
|
||||||
).content.decode("utf-8")
|
).content.decode("utf-8")
|
||||||
|
|
||||||
|
def switch_type(self):
|
||||||
|
"""
|
||||||
|
Switch the type of weekmail we are sending :
|
||||||
|
- a simple weekmail
|
||||||
|
- or an invitation
|
||||||
|
"""
|
||||||
|
if self.type == "INVITATION":
|
||||||
|
self.type = "WEEKMAIL"
|
||||||
|
else:
|
||||||
|
self.type = "INVITATION"
|
||||||
|
|
||||||
def render_html(self):
|
def render_html(self):
|
||||||
"""
|
"""
|
||||||
Renders an HTML version of the mail with images and fancy CSS.
|
Renders an HTML version of the mail with images and fancy CSS.
|
||||||
@ -227,10 +246,15 @@ class Weekmail(models.Model):
|
|||||||
"""
|
"""
|
||||||
Return an absolute link to the banner.
|
Return an absolute link to the banner.
|
||||||
"""
|
"""
|
||||||
|
if self.type == "INVITATION":
|
||||||
|
return (
|
||||||
|
"http://" + settings.SITH_URL + static("com/img/invitation_bannerP22.png")
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
"http://" + settings.SITH_URL + static("com/img/invitation_bannerP22.png")
|
"http://" + settings.SITH_URL + static("com/img/weekmail_bannerV2P22.png")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_footer(self):
|
def get_footer(self):
|
||||||
"""
|
"""
|
||||||
Return an absolute link to the footer.
|
Return an absolute link to the footer.
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<p><a href="{{ url('com:weekmail_preview') }}">{% trans %}Preview{% endtrans %}</a></p>
|
<p><a href="{{ url('com:weekmail_preview') }}">{% trans %}Preview{% endtrans %}</a></p>
|
||||||
<p><a href="{{ url('com:weekmail_preview') }}?send=true">{% trans %}Send{% endtrans %}</a></p>
|
<p><a href="{{ url('com:weekmail_preview') }}?send=true">{% trans %}Send{% endtrans %}</a></p>
|
||||||
<p><a href="{{ url('com:weekmail_article') }}">{% trans %}New article{% endtrans %}</a></p>
|
<p><a href="{{ url('com:weekmail_article') }}">{% trans %}New article{% endtrans %}</a></p>
|
||||||
|
<p><a href="{{ url('com:weekmail') }}" onclick="{{weekmail.switch_type()}}">{% trans %}Switch invitation/weekmail{% 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>
|
||||||
|
Reference in New Issue
Block a user