mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Added a donut chart to the quota view
Moved morris.js out of the statistics plugin
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
from django.core.urlresolvers import resolve, reverse
|
||||
from django.dispatch import receiver
|
||||
from django.template import Context
|
||||
from django.template.loader import get_template
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from pretix.base.signals import order_paid, order_placed
|
||||
from pretix.control.signals import html_head, nav_event
|
||||
from pretix.control.signals import nav_event
|
||||
|
||||
|
||||
@receiver(nav_event, dispatch_uid="statistics_nav")
|
||||
@@ -26,17 +24,6 @@ def control_nav_import(sender, request=None, **kwargs):
|
||||
]
|
||||
|
||||
|
||||
@receiver(html_head, dispatch_uid="statistics_html_head")
|
||||
def html_head_presale(sender, request=None, **kwargs):
|
||||
url = resolve(request.path_info)
|
||||
if url.namespace == 'plugins:statistics':
|
||||
template = get_template('pretixplugins/statistics/control_head.html')
|
||||
ctx = Context({})
|
||||
return template.render(ctx)
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def clear_cache(sender, *args, **kwargs):
|
||||
cache = sender.get_cache()
|
||||
cache.delete('statistics_obd_data')
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
.morris-hover{position:absolute;z-index:1000}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0}
|
||||
.morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,8 +0,0 @@
|
||||
{% load staticfiles %}
|
||||
{% load compress %}
|
||||
|
||||
{% compress css %}
|
||||
<link type="text/css" rel="stylesheet" href="{% static "pretixplugins/statistics/morris.css" %}">
|
||||
{% endcompress %}
|
||||
<script type="text/javascript" src="{% static "pretixplugins/statistics/raphael-min.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "pretixplugins/statistics/morris.min.js" %}"></script>
|
||||
@@ -9,19 +9,14 @@ from django.views.generic import TemplateView
|
||||
|
||||
from pretix.base.models import Item, Order, OrderPosition
|
||||
from pretix.control.permissions import EventPermissionRequiredMixin
|
||||
from pretix.control.views import ChartContainingView
|
||||
from pretix.plugins.statistics.signals import clear_cache
|
||||
|
||||
|
||||
class IndexView(EventPermissionRequiredMixin, TemplateView):
|
||||
class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView):
|
||||
template_name = 'pretixplugins/statistics/index.html'
|
||||
permission = 'can_view_orders'
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
resp = super().get(request, *args, **kwargs)
|
||||
# required by raphael.js
|
||||
resp['Content-Security-Policy'] = "script-src {static} 'unsafe-eval'; style-src {static} 'unsafe-inline'"
|
||||
return resp
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
tz = timezone.get_current_timezone()
|
||||
|
||||
Reference in New Issue
Block a user