From c824b0dfaf4747cb2d8d9e80a873796f39ee98ee Mon Sep 17 00:00:00 2001 From: HungNgien Date: Tue, 7 Jan 2025 16:44:49 +0700 Subject: [PATCH] Event Tickets Dashboard: Add an info box for the organizer and teams (#482) * Add info box * Remove css, add teams to context * Add link for detail organizer and teams * Add custom css * Change background to none * Add css style --- .../event/fragment_info_box.html | 19 ++++++ .../event/fragment_timeline.html | 62 +++++++++---------- .../templates/pretixcontrol/event/index.html | 13 +++- src/pretix/control/views/dashboards.py | 2 +- .../static/eventyay-common/scss/custom.scss | 39 ++++++++++++ 5 files changed, 99 insertions(+), 36 deletions(-) create mode 100644 src/pretix/control/templates/pretixcontrol/event/fragment_info_box.html diff --git a/src/pretix/control/templates/pretixcontrol/event/fragment_info_box.html b/src/pretix/control/templates/pretixcontrol/event/fragment_info_box.html new file mode 100644 index 000000000..02b50f4e0 --- /dev/null +++ b/src/pretix/control/templates/pretixcontrol/event/fragment_info_box.html @@ -0,0 +1,19 @@ +{% load i18n %} +
+

+ {% trans "Event organizer" %} +

+
+
+
+ {% trans "This event is organized by" %} {{ request.organizer }} +
+
+ {% trans "Teams of the organizer are" %} + + {% for id, name in organizer_teams %} + {{ name }} + {% if not forloop.last %}, {% endif %} + {% endfor %} +
+
diff --git a/src/pretix/control/templates/pretixcontrol/event/fragment_timeline.html b/src/pretix/control/templates/pretixcontrol/event/fragment_timeline.html index 387757809..cec0f2f57 100644 --- a/src/pretix/control/templates/pretixcontrol/event/fragment_timeline.html +++ b/src/pretix/control/templates/pretixcontrol/event/fragment_timeline.html @@ -1,36 +1,34 @@ {% load i18n %} -
-
-

- {% trans "Your timeline" %} -

-
-
- {% regroup timeline by date as tl_list %} - {% for day in tl_list %} -
-
- {{ day.grouper|date:"SHORT_DATE_FORMAT" }} -
-
- {% for e in day.list %} - {{ e.time|date:"TIME_FORMAT" }} +
+

+ {% trans "Your timeline" %} +

+
+
+ {% regroup timeline by date as tl_list %} + {% for day in tl_list %} +
+
+ {{ day.grouper|date:"SHORT_DATE_FORMAT" }} +
+
+ {% for e in day.list %} + {{ e.time|date:"TIME_FORMAT" }} +   + + {{ e.entry.description }} + + {% if e.entry.edit_url %}   - - {{ e.entry.description }} - - {% if e.entry.edit_url %} -   - - - - {% endif %} - {% if forloop.revcounter > 1 %} -
- {% endif %} - {% endfor %} -
+ + + + {% endif %} + {% if forloop.revcounter > 1 %} +
+ {% endif %} + {% endfor %}
- {% endfor %} -
+
+ {% endfor %}
diff --git a/src/pretix/control/templates/pretixcontrol/event/index.html b/src/pretix/control/templates/pretixcontrol/event/index.html index f33c117a6..08d578675 100644 --- a/src/pretix/control/templates/pretixcontrol/event/index.html +++ b/src/pretix/control/templates/pretixcontrol/event/index.html @@ -108,9 +108,16 @@

{% include "pretixcontrol/event/fragment_subevent_choice_simple.html" %} {% endif %} - {% if not request.event.has_subevents or subevent %} - {% include "pretixcontrol/event/fragment_timeline.html" %} - {% endif %} +
+ {% if not request.event.has_subevents or subevent %} +
+ {% include "pretixcontrol/event/fragment_timeline.html" %} +
+ {% endif %} +
+ {% include "pretixcontrol/event/fragment_info_box.html" %} +
+
{% for w in widgets %}
diff --git a/src/pretix/control/views/dashboards.py b/src/pretix/control/views/dashboards.py index 68017f398..17fdb3043 100644 --- a/src/pretix/control/views/dashboards.py +++ b/src/pretix/control/views/dashboards.py @@ -321,7 +321,6 @@ def event_index(request, organizer, event): 'can_change_event_settings', request=request) can_view_vouchers = request.user.has_event_permission(request.organizer, request.event, 'can_view_vouchers', request=request) - widgets = [] if can_view_orders: for r, result in event_dashboard_widgets.send(sender=request.event, subevent=subevent, lazy=True): @@ -390,6 +389,7 @@ def event_index(request, organizer, event): ] ctx['today'] = now().astimezone(request.event.timezone).date() ctx['nearly_now'] = now().astimezone(request.event.timezone) - timedelta(seconds=20) + ctx['organizer_teams'] = request.organizer.teams.values_list('id', 'name') resp = render(request, 'pretixcontrol/event/index.html', ctx) # resp['Content-Security-Policy'] = "style-src 'unsafe-inline'" return resp diff --git a/src/pretix/static/eventyay-common/scss/custom.scss b/src/pretix/static/eventyay-common/scss/custom.scss index 2decc6e73..a2ecfb65a 100644 --- a/src/pretix/static/eventyay-common/scss/custom.scss +++ b/src/pretix/static/eventyay-common/scss/custom.scss @@ -26,3 +26,42 @@ } } } + + +.custom { + margin-left: 0px; + margin-right: 0px; + } + +.dashboard .widget-container.no-padding { + padding: 0; + background: none; + border: 1px solid #e5e5e5; +} + +.dashboard .widget-container.widget-small.no-padding.column { + padding: 0; + background: none; + border-color: #e5e5e5; + margin-right: 10px; +} + +.dashboard .widget-container.widget-small.no-padding.last-column { + padding: 0; + background: none; + border-color: #e5e5e5; + margin-right: 0px; +} + +@media (max-width: $screen-sm-max) { + .dashboard .widget-container.widget-small.no-padding.column { + width: 100%; + margin-right: 0px; + } +} + +@media (max-width: $screen-xs-max) { + .dashboard .widget-container.widget-small.no-padding.column { + margin-right: 0px; + } +}