Improve UX

This commit is contained in:
Mira Weller
2024-04-30 21:49:58 +02:00
parent f38ecd0ec7
commit 046898678b
4 changed files with 17 additions and 11 deletions
@@ -138,8 +138,13 @@
{% bootstrap_field timemachine_form.now_dt layout="control" show_label=False field_class="col-md-6" %}
<div class="text-right">
<button type="submit" class="btn btn-default btn-lg btn-save">
{% trans "Enable time machine" %}
{% if request.session.timemachine_now_dt %}{% trans "Change" %}{% else %}{% trans "Enable time machine" %}{% endif %}
</button>
{% if request.session.timemachine_now_dt %}
<button name="timemachine_disable" value="true" type="submit" class="btn btn-default btn-lg btn-save">
{% trans "Disable" %}
</button>
{% endif %}
</div>
</form>
+4 -4
View File
@@ -980,12 +980,12 @@ class EventLive(EventPermissionRequiredMixin, TemplateView):
return ctx
def post(self, request, *args, **kwargs):
if self.timemachine_form.is_valid():
if request.POST.get("timemachine_disable"):
del request.session['timemachine_now_dt']
messages.success(self.request, _('Time machine disabled!'))
elif self.timemachine_form.is_valid():
request.session['timemachine_now_dt'] = str(self.timemachine_form.cleaned_data['now_dt'])
return redirect(eventreverse(request.event, "presale:event.index"))
elif request.POST.get("timemachine_disable"):
request.session['timemachine_now_dt'] = None
messages.success(self.request, _('Time machine disabled!'))
elif request.POST.get("live") == "true" and not self.request.event.live_issues:
with transaction.atomic():
request.event.live = True
@@ -34,16 +34,16 @@
</div>
{% endif %}
{% if request.now_dt_is_fake %}
<div class="offline-banner">
<div class="timemachine-banner">
<div class="container">
<span class="fa fa-clock-o" aria-hidden="true"></span>
{% trans "You are currently using the time machine. The ticket shop is rendered as if it were" %} {{ request.now_dt }}
<a href="{{ site_url }}{% url "control:event.live" event=event.slug organizer=event.organizer.slug %}">
<a href="{{ site_url }}{% url "control:event.live" event=event.slug organizer=event.organizer.slug %}" class="btn-link">
{% trans "Change" %}
</a>
<form action="{{ site_url }}{% url "control:event.live" event=event.slug organizer=event.organizer.slug %}" method="post" class="download-btn-form">
{% csrf_token %}
<input type="submit" class="btn btn-link" value="{% trans "Go back to current time" %}" name="timemachine_disable">
<button type="submit" class="btn-link" value="true" name="timemachine_disable">{% trans "Go back to current time" %}</button>
</form>
</div>
</div>
@@ -187,18 +187,19 @@ article.item-with-variations .product-row:last-child:after {
div.front-page {
margin-top: 30px;
}
.offline-banner {
background: $brand-danger;
.offline-banner, .timemachine-banner {
color: white;
width: 100%;
padding: 5px;
text-align: center;
a {
a, .btn-link {
text-decoration: underline;
color: white;
}
}
.offline-banner { background: $brand-danger; }
.timemachine-banner { background: $brand-warning; }
#questions_group .panel-title a {
line-height: 22px;
}