feat: mixin for update forms
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
<form hx-post="{{ url }}" hx-swap="none">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="mb-4">
|
||||
<label for="{{ field.id_for_label }}"
|
||||
class="inline-block text-sm font-medium text-gray-900 dark:text-white ml-2">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{{ field }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% for k, error in form.errors.items %}
|
||||
<span class="flex justify-center mb-2 text-sm font-medium text-red-900 dark:text-red-400">{{ error }}</span>
|
||||
{% endfor %}
|
||||
|
||||
<button class="text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none
|
||||
focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600
|
||||
dark:hover:bg-primary-700 dark:focus:ring-primary-800"
|
||||
>
|
||||
{% translate 'Guardar' %}
|
||||
</button>
|
||||
</form>
|
||||
@@ -1,28 +1,25 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
<form hx-post="{% url 'web:user_info_component' %}" hx-swap="none">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<form hx-post="{{ url }}" hx-swap="none">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="mb-4">
|
||||
|
||||
<label for="{{ field.id_for_label }}"
|
||||
class="inline-block text-sm font-medium text-gray-900 dark:text-white ml-2">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{{ field }}
|
||||
<label for="{{ field.id_for_label }}"
|
||||
class="inline-block text-sm font-medium text-gray-900 dark:text-white ml-2">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{{ field }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% for k, error in form.errors.items %}
|
||||
{% for k, error in form.errors.items %}
|
||||
<span class="flex justify-center mb-2 text-sm font-medium text-red-900 dark:text-red-400">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
<button class="text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none
|
||||
<button class="text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none
|
||||
focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600
|
||||
dark:hover:bg-primary-700 dark:focus:ring-primary-800"
|
||||
>
|
||||
{% translate 'Guardar' %}
|
||||
</button>
|
||||
|
||||
|
||||
>
|
||||
{% translate 'Guardar' %}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
{% load static %}
|
||||
{% for address in customer_addresses %}
|
||||
<form
|
||||
id="edit_address_{{ address.pk }}"
|
||||
class="hidden py-2 md:py-4"
|
||||
hx-post="{% url 'web:update_customer_address' pk=address.pk %}"
|
||||
hx-on:htmx:after-request="htmx.toggleClass(htmx.find('#edit_address_{{ address.pk }}'), 'hidden'); htmx.toggleClass(htmx.find('#details_address_{{ address.pk }}'), 'hidden')"
|
||||
hx-swap="none"
|
||||
id="edit_address_{{ address.pk }}"
|
||||
class="hidden py-2 md:py-4"
|
||||
hx-post="{% url 'web:update_customer_address' pk=address.pk %}"
|
||||
hx-on:htmx:after-request="htmx.toggleClass(htmx.find('#edit_address_{{ address.pk }}'), 'hidden'); htmx.toggleClass(htmx.find('#details_address_{{ address.pk }}'), 'hidden')"
|
||||
hx-swap="none"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="mb-4 grid gap-4 sm:grid-cols-2 sm:gap-8 lg:gap-16">
|
||||
@@ -159,14 +159,8 @@
|
||||
{% translate 'Editar datos' %}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% if not forloop.last %}
|
||||
<hr class="h-px my-2 bg-gray-200 border-0 dark:bg-gray-700">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user