1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django import template
6 from ssify import ssi_variable
7 from ssify.utils import ssi_cache_control
9 from ..models import Offer
10 from ..utils import sanitize_payment_title
11 from ..views import offer_bar
13 register = template.Library()
16 @ssi_variable(register, patch_response=[ssi_cache_control(must_revalidate=True, max_age=0)])
17 def current_offer(request=None):
18 offer = Offer.current()
19 return offer.pk if offer is not None else None
22 @register.inclusion_tag('funding/includes/funding.html')
23 def funding_top_bar():
24 return offer_bar(Offer.current(), link=True, closeable=True, add_class="funding-top-header")
27 register.filter(sanitize_payment_title)