mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 11:03:04 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			photos
			...
			feature/ea
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					858199e476 | ||
| 
						 | 
					f6ecbd899d | 
@@ -61,6 +61,11 @@ NEWS_TYPES = [
 | 
			
		||||
    ("CALL", _("Call")),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
WEEKMAIL_TYPE = [
 | 
			
		||||
    ("WEEKMAIL", _("Weekmail")),
 | 
			
		||||
    ("INVITATION", _("Invitation")),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class News(models.Model):
 | 
			
		||||
    """The news class"""
 | 
			
		||||
@@ -178,6 +183,9 @@ class Weekmail(models.Model):
 | 
			
		||||
    protip = models.TextField(_("protip"), blank=True)
 | 
			
		||||
    conclusion = models.TextField(_("conclusion"), blank=True)
 | 
			
		||||
    sent = models.BooleanField(_("sent"), default=False)
 | 
			
		||||
    type = models.CharField(
 | 
			
		||||
        _("type"), max_length=16, choices=WEEKMAIL_TYPE, default="WEEKMAIL"
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        ordering = ["-id"]
 | 
			
		||||
@@ -215,6 +223,17 @@ class Weekmail(models.Model):
 | 
			
		||||
            None, "com/weekmail_renderer_text.jinja", context={"weekmail": self}
 | 
			
		||||
        ).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):
 | 
			
		||||
        """
 | 
			
		||||
        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.
 | 
			
		||||
        """
 | 
			
		||||
        if self.type == "INVITATION":
 | 
			
		||||
            return (
 | 
			
		||||
                "http://" + settings.SITH_URL + static("com/img/invitation_bannerP22.png")
 | 
			
		||||
            )
 | 
			
		||||
        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):
 | 
			
		||||
        """
 | 
			
		||||
        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') }}?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') }}" onclick="{{weekmail.switch_type()}}">{% trans %}Switch invitation/weekmail{% endtrans %}</a></p>
 | 
			
		||||
<h4>{% trans %}Articles in no weekmail yet{% endtrans %}</h4>
 | 
			
		||||
<table>
 | 
			
		||||
    <thead>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user