Add functionality to show news_letter
This commit is contained in:
parent
57503d1cfa
commit
048faf479c
4 changed files with 28 additions and 0 deletions
|
@ -97,6 +97,15 @@ class Contact(models.Model):
|
|||
on_delete=models.SET_NULL,
|
||||
related_name='+',
|
||||
)
|
||||
news_letter_url = models.URLField(default='', blank=True)
|
||||
news_letter_text = models.CharField(default='', blank=True, max_length=256)
|
||||
news_letter_text_fr = models.CharField(max_length=255, blank=True, default="")
|
||||
news_letter_text_en = models.CharField(max_length=255, blank=True, default="")
|
||||
trans_news_letter_text = TranslatedField(
|
||||
'news_letter_text',
|
||||
'news_letter_text_fr',
|
||||
'news_letter_text_en',
|
||||
)
|
||||
|
||||
panels = Page.content_panels + [
|
||||
FieldPanel('title_fr'),
|
||||
|
@ -114,6 +123,13 @@ class Contact(models.Model):
|
|||
PageChooserPanel('contact_form', 'home.ContactForm'),
|
||||
]
|
||||
|
||||
panels = panels + [
|
||||
FieldPanel('news_letter_url', classname="full"),
|
||||
FieldPanel('news_letter_text'),
|
||||
FieldPanel('news_letter_text_fr'),
|
||||
FieldPanel('news_letter_text_en'),
|
||||
]
|
||||
|
||||
def phone_link(self):
|
||||
return 'tel:%s' % self.phone.replace(' ', '')
|
||||
def email_link(self):
|
||||
|
|
3
publichealth/home/templates/tags/news_letter.html
Normal file
3
publichealth/home/templates/tags/news_letter.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{% if contact.trans_news_letter_text %}
|
||||
<a href="{{ contact.news_letter_url }}">{{ contact.trans_news_letter_text }}</a>
|
||||
{% endif %}
|
|
@ -35,11 +35,19 @@ def get_contacts(the_site):
|
|||
'socials': social_contacts
|
||||
}
|
||||
|
||||
|
||||
# Contact information (footer)
|
||||
@register.inclusion_tag('tags/contact_info.html')
|
||||
def contact_info(the_site):
|
||||
return get_contacts(the_site)
|
||||
|
||||
|
||||
# Newsletter (footer)
|
||||
@register.inclusion_tag('tags/news_letter.html')
|
||||
def news_letter(the_site):
|
||||
return get_contacts(the_site)
|
||||
|
||||
|
||||
# Contact form (footer)
|
||||
@register.inclusion_tag('tags/footer_form.html')
|
||||
def footer_form(the_site):
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
</div>
|
||||
<div class="col-md-4" id="contact-form">
|
||||
{% footer_form the_site=the_site %}
|
||||
{% news_letter the_site=the_site %}
|
||||
</div>
|
||||
</div><!-- /row -->
|
||||
</div><!-- /container -->
|
||||
|
|
Loading…
Reference in a new issue