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])
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):
return ProductType.objects.order_by("order")

View File

@ -13,8 +13,24 @@
{% endblock %}
{% 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 %}
<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">
<p
class="alert snackbar"
@ -42,11 +58,3 @@
{% trans %}There is no product types in this website.{% endtrans %}
{% endif %}
{% 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):
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