From 6b7bdf8c4f7338c886ff91bc29d733c1ff801a2b Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 5 Oct 2017 10:47:46 +0200 Subject: [PATCH] Item creation UX: Clearer placeholders, defaults --- src/pretix/base/models/items.py | 1 + src/pretix/control/forms/item.py | 16 ++++++++++------ .../static/pretixcontrol/js/ui/hidequota.js | 3 +++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/pretix/base/models/items.py b/src/pretix/base/models/items.py index 94f45020e..4b1e16cbc 100644 --- a/src/pretix/base/models/items.py +++ b/src/pretix/base/models/items.py @@ -175,6 +175,7 @@ class Item(LoggedModel): related_name="items", blank=True, null=True, verbose_name=_("Category"), + help_text=_("If you have many products, you can optionally sort them into categories to keep things organized.") ) name = I18nCharField( max_length=255, diff --git a/src/pretix/control/forms/item.py b/src/pretix/control/forms/item.py index 5a8c2207a..f5ea54fd8 100644 --- a/src/pretix/control/forms/item.py +++ b/src/pretix/control/forms/item.py @@ -150,14 +150,18 @@ class ItemCreateForm(I18nModelForm): ) if not self.event.has_subevents: + choices = [ + (self.NONE, _("Do not add to a quota now")), + (self.EXISTING, _("Add product to an existing quota")), + (self.NEW, _("Create a new quota for this product")) + ] + if not self.event.quotas.exists(): + choices.remove(choices[1]) + self.fields['quota_option'] = forms.ChoiceField( label=_("Quota options"), widget=forms.RadioSelect, - choices=( - (self.NONE, _("Do not add to a quota now")), - (self.EXISTING, _("Add product to an existing quota")), - (self.NEW, _("Create a new quota for this product")) - ), + choices=choices, initial=self.NONE, required=False ) @@ -179,7 +183,7 @@ class ItemCreateForm(I18nModelForm): self.fields['quota_add_new_size'] = forms.IntegerField( min_value=0, label=_("Size"), - widget=forms.TextInput(attrs={'placeholder': _("New quota size")}), + widget=forms.TextInput(attrs={'placeholder': _("Number of tickets")}), help_text=_("Leave empty for an unlimited number of tickets."), required=False ) diff --git a/src/pretix/static/pretixcontrol/js/ui/hidequota.js b/src/pretix/static/pretixcontrol/js/ui/hidequota.js index 39326fa99..7c7c8c3f5 100644 --- a/src/pretix/static/pretixcontrol/js/ui/hidequota.js +++ b/src/pretix/static/pretixcontrol/js/ui/hidequota.js @@ -9,6 +9,9 @@ $(document).ready(function () { $("#existing-quota-group").children()[fn](); } else if (v === "new") { hideAll(animate); + if ($("#id_quota_add_new_name").val() === "") { + $("#id_quota_add_new_name").val($("input[name^=name_]").first().val()); + } $("#new-quota-group").children()[fn](); } else { hideAll(animate);