--- /dev/null
+$(function() {
+ $('.funding .close').click(function(e) {\r
+ e.preventDefault();
+ var fundNode = $(e.target).parent();\r
+ fundNode.slideUp(function(){fundingHandle.show()});
+ if(Modernizr.localstorage)
+ localStorage['hide-offer-id'] = fundNode.attr('data-offer-id');\r
+ });
+
+
+ var fundingTopHeader = $('.funding-top-header');
+ var fundingHandle = $('.funding-handle');
+ if(fundingTopHeader) {
+ var currentOfferId = fundingTopHeader.attr('data-offer-id');
+ var toggle = true;
+ if(Modernizr.localstorage) {
+ toggle = localStorage['hide-offer-id'] !== currentOfferId;
+ }
+ fundingTopHeader.toggle(toggle);
+ fundingHandle.toggle(!toggle);
+ }
+ fundingHandle.click(function(e) {
+ fundingTopHeader.slideDown();
+ $(e.target).hide();
+ localStorage.removeItem('hide-offer-id');
+ });\r
+});
\ No newline at end of file
background: orange;
margin: auto;
padding: 5px 0;
+ position: relative;
a.call {
height: 1.2em;
width: 9em;
font-weight: bold;
font-size: 1.5em;
}
-
+ .close {
+ position: absolute;
+ top: 0px;
+ right: 5px;
+ }
}
.funding-top-header {
}
}
}
+
+.funding-handle {
+ position: absolute;
+ top: 0;
+ right: 0;
+ z-index:2;
+ background: orange;
+ cursor:pointer;
+ padding: .2em 1em;
+ border-radius: 0 0 0 1em;
+ font-size: 13px;
+}
\ No newline at end of file
{% load time_tags %}
{% if offer %}
{% spaceless %}
-<div class="funding {{ add_class }}" style="">
+<div class="funding {{ add_class }}" data-offer-id="{{offer.id}}" style="">
+ {% if closeable %}<a href="#" class="close">X</a>{% endif %}
{% if link and is_current %}
<div style="float:left; padding-right: .6em;">
<a class="call honking" href="{% url 'funding_current' offer.slug %}">
</div>
<div style="clear: both"></div>
</div>
+{% if closeable %}
+ <div class="funding-handle">{% trans "Help free the book!" %}</div>
+{% endif %}
{% endspaceless %}
{% endif %}
@register.inclusion_tag("funding/tags/funding.html", takes_context=True)
-def funding(context, offer=None, link=False, add_class=""):
+def funding(context, offer=None, link=False, closeable=False, add_class=""):
if offer is None and context.get('funding_no_show_current') is None:
offer = Offer.current()
if offer is None:
'missing': offer.target - offer_sum,
'percentage': 100 * offer_sum / offer.target,
'link': link,
+ 'closeable': closeable,
'add_class': add_class,
}
{% include "annoy.html" %}
{% block bodycontent %}
- {% funding link=1 add_class="funding-top-header" %}
+ {% funding link=1 closeable=1 add_class="funding-top-header" %}
<div id="header-bg"></div>
<div id="header">
'sponsors/js/sponsors.js',
'player/openplayer.js',
'js/search.js',
-
+ 'funding/funding.js',
+
'js/annoy.js',
),
'output_filename': 'js/base.min.js',