Apply review comments

This commit is contained in:
imperosol 2024-12-17 17:23:13 +01:00
parent 47876e3971
commit 8d643fc6b4
5 changed files with 37 additions and 17 deletions

View File

@ -109,7 +109,7 @@ class ProductController(ControllerBase):
@api_controller("/product-type", permissions=[IsCounterAdmin]) @api_controller("/product-type", permissions=[IsCounterAdmin])
class ProductTypeController(ControllerBase): class ProductTypeController(ControllerBase):
@route.get("", response=list[ProductTypeSchema], url_name="fetch-product-types") @route.get("", response=list[ProductTypeSchema], url_name="fetch_product_types")
def fetch_all(self): def fetch_all(self):
return ProductType.objects.order_by("order") return ProductType.objects.order_by("order")

View File

@ -13,8 +13,24 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<p><a href="{{ url('counter:new_producttype') }}">{% trans %}New product type{% endtrans %}</a></p> <p>
<a href="{{ url('counter:new_producttype') }}" class="btn btn-blue">
{% trans %}New product type{% endtrans %}
<i class="fa fa-plus"></i>
</a>
</p>
{% if producttype_list %} {% if producttype_list %}
<aside>
<p>
{% trans %}Product types are in the same order on this page and on the eboutic.{% endtrans %}
</p>
<p>
{% trans trimmed %}
You can reorder them here by drag-and-drop.
The changes will then be applied globally immediately.
{% endtrans %}
</p>
</aside>
<div x-data="productTypesList"> <div x-data="productTypesList">
<p <p
class="alert snackbar" class="alert snackbar"
@ -42,11 +58,3 @@
{% trans %}There is no product types in this website.{% endtrans %} {% trans %}There is no product types in this website.{% endtrans %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block script %}
{% endblock %}

View File

@ -87,5 +87,5 @@ def test_move_above_product_type(product_types: list[ProductType]):
) )
def test_controller_permissions(client: Client, user_factory, status_code): def test_controller_permissions(client: Client, user_factory, status_code):
client.force_login(user_factory()) client.force_login(user_factory())
response = client.get(reverse("api:fetch-product-types")) response = client.get(reverse("api:fetch_product_types"))
assert response.status_code == status_code assert response.status_code == status_code

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 13:10+0100\n" "POT-Creation-Date: 2024-12-17 17:04+0100\n"
"PO-Revision-Date: 2016-07-18\n" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n" "Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
@ -4198,15 +4198,27 @@ msgid "There is no products in this website."
msgstr "Il n'y a pas de produits dans ce site web." msgstr "Il n'y a pas de produits dans ce site web."
#: counter/templates/counter/producttype_list.jinja:4 #: counter/templates/counter/producttype_list.jinja:4
#: counter/templates/counter/producttype_list.jinja:26 #: counter/templates/counter/producttype_list.jinja:42
msgid "Product type list" msgid "Product type list"
msgstr "Liste des types de produit" msgstr "Liste des types de produit"
#: counter/templates/counter/producttype_list.jinja:16 #: counter/templates/counter/producttype_list.jinja:18
msgid "New product type" msgid "New product type"
msgstr "Nouveau type de produit" msgstr "Nouveau type de produit"
#: counter/templates/counter/producttype_list.jinja:42 #: counter/templates/counter/producttype_list.jinja:25
msgid "Product types are in the same order on this page and on the eboutic."
msgstr "Les types de produit sont dans le même ordre sur cette page et sur l'eboutic."
#: counter/templates/counter/producttype_list.jinja:28
msgid ""
"You can reorder them here by drag-and-drop. The changes will then be applied "
"globally immediately."
msgstr ""
"Vous pouvez les réorganiser ici. Les changements seront alors immédiatement "
"appliqués globalement."
#: counter/templates/counter/producttype_list.jinja:58
msgid "There is no product types in this website." msgid "There is no product types in this website."
msgstr "Il n'y a pas de types de produit dans ce site web." msgstr "Il n'y a pas de types de produit dans ce site web."

View File

@ -123,8 +123,8 @@ msgid "captured.%s"
msgstr "capture.%s" msgstr "capture.%s"
#: counter/static/bundled/counter/product-type-index.ts:36 #: counter/static/bundled/counter/product-type-index.ts:36
msgid "Products types successfully reordered" msgid "Products types reordered!"
msgstr "Types de produits réordonnés." msgstr "Types de produits réordonnés !"
#: counter/static/bundled/counter/product-type-index.ts:40 #: counter/static/bundled/counter/product-type-index.ts:40
#, javascript-format #, javascript-format