Showing cover on the offer details page
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 16 May 2013 10:07:39 +0000 (12:07 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 3 Jun 2013 08:03:41 +0000 (10:03 +0200)
apps/funding/static/funding/funding.scss
apps/funding/templates/funding/offer_detail.html
apps/funding/templates/funding/tags/funding.html
apps/funding/templatetags/funding_tags.py

index 059cc16..2b06dc6 100755 (executable)
     padding: .2em 1em;
     border-radius: 0 0 0 1em;
     font-size: 13px;
+}
+
+.funding-cover {
+    float:left;
+    margin-right: 10px;
 }
\ No newline at end of file
index da50f13..898f847 100755 (executable)
 
 <div class="normal-text">{{ object.description|safe }}</div>
 
-{% funding object %}
+{% funding object show_title=False %}
 <div class="white-box">
+    {% if object.cover %}
+        <img src="{{ object.cover.url }}" class="funding-cover"/>
+    {% endif %}
     <div class="normal-text">
     {% offer_status object %}
     {% offer_status_more object %}
     <p><a href="{% url 'infopage' 'wesprzyj' %}">{% trans "Learn more" %}</a>.</p>
     </div>
     
+    <div style="clear:both;"></div>
 
     {% if object.is_current %}
         <div class="normal-text">
index 2ee991a..5bc232f 100755 (executable)
@@ -17,7 +17,7 @@
         style="display: inline-block;">
     {% if link %}<a href="{% if is_current %}{% url 'funding_current' offer.slug %}{% else %}{{ offer.get_absolute_url }}{% endif %}">{% endif %}
     {% if is_current %}<strong style="margin-right: .6em;">{% trans "Help free the book!" %}</strong>{% endif %}
-    <span class="funding-title{% if not is_current %}-strong{% endif %}">{{ offer }}</span>
+    {% if show_title %}<span class="funding-title{% if not is_current %}-strong{% endif %}">{{ offer }}</span>{% endif %}
 
     <div class="progress"
         style="text-align: center; background-size: {{ percentage|stringformat:'.2f' }}% 1px;"
index 2d6ea35..7ebc726 100755 (executable)
@@ -5,7 +5,7 @@ register = template.Library()
 
 
 @register.inclusion_tag("funding/tags/funding.html", takes_context=True)
-def funding(context, offer=None, link=False, closeable=False, add_class=""):
+def funding(context, offer=None, link=False, closeable=False, show_title=True, add_class=""):
     if offer is None and context.get('funding_no_show_current') is None:
         offer = Offer.current()
     if offer is None:
@@ -21,6 +21,7 @@ def funding(context, offer=None, link=False, closeable=False, add_class=""):
         'percentage': 100 * offer_sum / offer.target,
         'link': link,
         'closeable': closeable,
+        'show_title': show_title,
         'add_class': add_class,
     }