mirror of
https://github.com/pretix/pretix.git
synced 2026-05-21 17:54:08 +00:00
change order-status to text-blob
This commit is contained in:
41
src/pretix/base/templatetags/textblob.py
Normal file
41
src/pretix/base/templatetags/textblob.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#
|
||||||
|
# This file is part of pretix (Community Edition).
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||||
|
# Copyright (C) 2020-2021 rami.io GmbH and contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||||
|
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||||
|
#
|
||||||
|
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||||
|
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||||
|
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||||
|
# this file, see <https://pretix.eu/about/en/license>.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||||
|
# <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
from django import template
|
||||||
|
from django.utils.html import format_html, mark_safe
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def textblob(type, *args, **kwargs):
|
||||||
|
return format_html(
|
||||||
|
'<span class="text-blob-{}">{}',
|
||||||
|
type or "info",
|
||||||
|
"" if not kwargs["icon"] else format_html(
|
||||||
|
'<i class="fa fa-{}" aria-hidden="true"></i> ',
|
||||||
|
kwargs["icon"]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def endtextblob():
|
||||||
|
return mark_safe('</span>')
|
||||||
@@ -1,46 +1,29 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
{% load textblob %}
|
||||||
{# Changes should be replicated in pretixcontrol/orders/fragment_order_status.html and in pretix/base/models/orders.py #}
|
{# Changes should be replicated in pretixcontrol/orders/fragment_order_status.html and in pretix/base/models/orders.py #}
|
||||||
{% if order.status == "n" %}
|
{% if order.status == "n" %}
|
||||||
{% if order.require_approval %}
|
{% if order.require_approval %}
|
||||||
<span class="text-blob-warning">
|
{% textblob "warning" icon="exclamation-triangle" %}{% trans "Approval pending" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-exclamation-triangle" aria-hidden="true"></i> {% trans "Approval pending" %}
|
|
||||||
</span>
|
|
||||||
{% elif order.total == 0 %}
|
{% elif order.total == 0 %}
|
||||||
<span class="text-blob-warning">
|
{% textblob "warning" icon="exclamation-triangle" %}{% trans "Confirmation pending" context "order state" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-exclamation-triangle" aria-hidden="true"></i> {% trans "Confirmation pending" context "order state" %}
|
|
||||||
</span>
|
|
||||||
{% elif event.settings.payment_pending_hidden %}
|
{% elif event.settings.payment_pending_hidden %}
|
||||||
{# intentionally left blank #}
|
{# intentionally left blank #}
|
||||||
{% elif order.valid_if_pending %}
|
{% elif order.valid_if_pending %}
|
||||||
<span class="text-blob-info">
|
{% textblob "info" icon="info-circle" %}{% trans "Confirmed" context "order state" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-info-circle" aria-hidden="true"></i> {% trans "Confirmed" context "order state" %}
|
|
||||||
</span>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="text-blob-warning">
|
{% textblob "warning" icon="exclamation-triangle" %}{% trans "Payment pending" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-exclamation-triangle" aria-hidden="true"></i> {% trans "Payment pending" %}
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif order.status == "p" %}
|
{% elif order.status == "p" %}
|
||||||
{% if order.count_positions == 0 %}
|
{% if order.count_positions == 0 %}
|
||||||
<span class="text-blob-info">
|
{% textblob "info" icon="info-circle" %}{% trans "Canceled (paid fee)" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-info-circle" aria-hidden="true"></i> {% trans "Canceled (paid fee)" %}
|
|
||||||
</span>
|
|
||||||
{% elif order.total == 0 %}
|
{% elif order.total == 0 %}
|
||||||
<span class="text-blob-success">
|
{% textblob "success" icon="check" %}{% trans "Confirmed" context "order state" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-check" aria-hidden="true"></i> {% trans "Confirmed" context "order state" %}
|
|
||||||
</span>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="text-blob-success">
|
{% textblob "success" icon="check" %}{% trans "Paid" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-check" aria-hidden="true"></i> {% trans "Paid" %}
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif order.status == "e" %}
|
{% elif order.status == "e" %}
|
||||||
<span class="text-blob-danger">
|
{% textblob "danger" icon="minus" %}{% trans "Expired" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-minus" aria-hidden="true"></i> {% trans "Expired" %}
|
|
||||||
</span>
|
|
||||||
{% elif order.status == "c" %}
|
{% elif order.status == "c" %}
|
||||||
<span class="text-blob-danger">
|
{% textblob "danger" icon="times" %}{% trans "Canceled" %}{% endtextblob %}
|
||||||
<i class="status-dot fa fa-times" aria-hidden="true"></i> {% trans "Canceled" %}
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ h2 .label {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
&:has(.status-dot) {
|
&:has(>.fa:first-child) {
|
||||||
padding-left: .4em;
|
padding-left: .4em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -552,7 +552,7 @@ h2 .label {
|
|||||||
.text-blob-warning {
|
.text-blob-warning {
|
||||||
color: var(--pretix-brand-warning-shade-42);
|
color: var(--pretix-brand-warning-shade-42);
|
||||||
background: var(--pretix-brand-warning-tint-85);
|
background: var(--pretix-brand-warning-tint-85);
|
||||||
.status-dot {
|
.fa {
|
||||||
color: var(--pretix-brand-warning);
|
color: var(--pretix-brand-warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user