mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
Apply review comments
This commit is contained in:
@ -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")
|
||||
|
||||
|
@ -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 %}
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user