]> git.parisson.com Git - mezzo.git/commitdiff
add thumb for various images
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 11 Apr 2016 12:24:42 +0000 (14:24 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 11 Apr 2016 12:24:42 +0000 (14:24 +0200)
app/festival/models.py
app/festival/templates/festival/inc/artist_card.html
app/templates/agenda/event_detail.html
app/templates/base.html

index d624d8bd5b101600b32ba830cf3dbef46671ec79..79c90116b9f640375157fec3a76c17469ca5eea8 100644 (file)
@@ -115,6 +115,13 @@ class Artist(Displayable, RichText, AdminThumbMixin):
         self.set_names()
         super(Artist, self).save(*args, **kwargs)
 
+    @property
+    def featured_image(self):
+        if self.photo_featured:
+            return self.photo_featured
+        else:
+            return self.photo
+
 
 class Media(Displayable, RichText):
     """Media"""
index 7774143888d8d3a7f994a2c02e65f3eec55327ef..f485b7f721e1c6ad35ea1bdaf504968c350a383a 100644 (file)
@@ -1,8 +1,10 @@
+{% load i18n pages_tags mezzanine_tags %}
+
 <div class="artist__item msry__item">
     <div class="artist__item__inner">
         <a href="{% url 'festival-artist-detail' artist.slug %}" class="artist__item__inner">
             <figure class="artist__item__img">
-                <img src="{% if artist.photo_featured %}{{ artist.photo_featured.url }}{% elif artist.photo %}/{{ artist.photo.url }}{% else %}{% endif %}" alt="Portrait {{ artist.name }}">
+                <img src="{{ MEDIA_URL }}{% thumbnail artist.featured_image 500 0 %}" alt="Portrait {{ artist.name }}">
             </figure>
             <h3 class="artist__item__name">
                 <span>
index f60b1d25affb6e2e3164d4d10b0db35c1373d022..7142950251176a15e7ec65acb7bb5b0067d1f6c7 100644 (file)
 <div class="push__calendar">
     <a href='{{ event|google_calendar_url }}' target="_blank" class="push__calendar__item">
         <i class="icon icon__calendar"></i>
-        Add to Google Calendar
+        {% trans "Add to" %} Google Calendar
     </a>
     <a href='{% icalendar_url %}' class="push__calendar__item">
         <i class="icon icon__windows"></i>
-        Add to Outlook/iCal
+        {% trans "Add to" %} Outlook/iCal
     </a>
 </div>
 {% endblock %}
index a78a96810b8c0eb92d0d0044cbb3956cba7b2d6d..f406c4f5d8d1994901799467f886245496cb6b9a 100644 (file)
@@ -91,7 +91,7 @@
         <ul id="lightSlider">
             {% featured_events as events %}
             {% for event in events %}
-              <li class="hero__slider__item" style="background-image: url({{ event.featured_image_header.url }});">
+              <li class="hero__slider__item" style="background-image: url({{ MEDIA_URL }}{% thumbnail event.featured_image_header 1920 0 %});">
                   <div class="hero__slider__infos">
                     <div class="container">
                       <p class="hero__slider__name">
 
 </script>
 </html>
-