refactor: organize constants and improve template rendering in views
This commit is contained in:
@@ -22,13 +22,16 @@
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="rating-input" class="form-label">Puntuación</label>
|
||||
<div class="star-rating d-flex gap-1" id="star-rating">
|
||||
{% for i in "12345" %}
|
||||
<span class="star fs-2 {% if form.initial.rating|default:0 >= i|add:0 %}text-warning text-dark{% else %}text-secondary{% endif %}" data-value="{{ i }}" style="cursor: pointer; font-size: 2rem;">★</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<label class="form-label" for="rating-input">
|
||||
Puntuación
|
||||
<div class="star-rating d-flex gap-1" id="star-rating">
|
||||
{% for i in "12345" %}
|
||||
<span class="star fs-2 {% if form.initial.rating|default:0 >= i|add:0 %}text-warning text-dark{% else %}text-secondary{% endif %}" data-value="{{ i }}" style="cursor: pointer; font-size: 2rem;">★</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<input type="hidden" name="rating" id="rating-input" value="{{ form.initial.rating|default:1 }}">
|
||||
</label>
|
||||
|
||||
{% if form.rating.errors %}
|
||||
<div class="text-danger small">{{ form.rating.errors }}</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Comercialmeria</title>
|
||||
<meta name="description" content="Sitio web de comercio local Almeriense">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
||||
<link rel="preload" href="{% static 'css/custom.css' %}" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<table border="0" cellpadding="0" style="width: 100%;">
|
||||
<tr>
|
||||
<td align="center" style="padding: 20px;">
|
||||
<table width="600" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid #eeeeee; background-color: #ffffff;">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if producto.primary_image %}
|
||||
<img src="{{ producto.primary_image.image.url }}" alt="{{ producto.primary_image.alt|default:producto.name }}" class="rounded" style="width: 200px; height: 200px; object-fit: cover;">
|
||||
<img src="{{ producto.primary_image.image.url }}" alt="{{ producto.primary_image.alt|default:producto.name }} - imagen principal" class="rounded" style="width: 200px; height: 200px; object-fit: cover;">
|
||||
<p class="mt-2 text-muted mb-0">Esta imagen no se puede cambiar desde aquí.</p>
|
||||
{% else %}
|
||||
<p class="text-muted">No hay imagen principal asignada.</p>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
async function loadReviews() {
|
||||
try {
|
||||
const response = await fetch("{% url 'product_reviews' product.id %}");
|
||||
@@ -157,6 +157,6 @@ async function loadReviews() {
|
||||
}
|
||||
}
|
||||
|
||||
loadReviews();
|
||||
await loadReviews();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user