+ def basic_info(self):
+ offer_sum = self.sum()
+ return {
+ 'offer': self,
+ 'sum': offer_sum,
+ 'is_current': self.is_current(),
+ 'is_win': offer_sum >= self.target,
+ 'missing': self.target - offer_sum,
+ 'percentage': min(100, 100 * offer_sum / self.target),
+
+ 'show_title': True,
+ 'show_title_calling': True,
+ }
+
+ @cached_render('funding/includes/funding.html')
+ def top_bar(self):
+ ctx = self.basic_info()
+ ctx.update({
+ 'link': True,
+ 'closeable': True,
+ 'add_class': 'funding-top-header',
+ })
+ return ctx
+
+ @cached_render('funding/includes/funding.html')
+ def list_bar(self):
+ ctx = self.basic_info()
+ ctx.update({
+ 'link': True,
+ 'show_title_calling': False,
+ })
+ return ctx
+
+ @cached_render('funding/includes/funding.html')
+ def detail_bar(self):
+ ctx = self.basic_info()
+ ctx.update({
+ 'show_title': False,
+ })
+ return ctx
+
+ @cached_render('funding/includes/offer_status.html')
+ def status(self):
+ return {'offer': self}
+
+ @cached_render('funding/includes/offer_status_more.html')
+ def status_more(self):
+ return {'offer': self}
+
+ @cached_render('funding/2022/includes/funding.html')
+ def top_bar_2022(self):
+ ctx = self.basic_info()
+ ctx.update({
+ 'link': True,
+ 'closeable': True,
+ 'add_class': 'funding-top-header',
+ })
+ return ctx
+
+ @cached_render('funding/2022/includes/funding.html')
+ def detail_bar_2022(self):
+ ctx = self.basic_info()
+ ctx.update({
+ 'show_title': False,
+ })
+ return ctx
+