fix: styling
This commit is contained in:
@@ -9,6 +9,7 @@ def web_settings(request):
|
||||
)
|
||||
|
||||
return {
|
||||
"web_title": settings.web_title,
|
||||
"logo": settings.logo.url if settings.logo else "",
|
||||
"navbar_categories": navbar_categories,
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from django.conf import settings
|
||||
from django.core.paginator import Paginator
|
||||
from django.utils.text import gettext_lazy as _
|
||||
|
||||
|
||||
class FilteredQuerysetMixin:
|
||||
@@ -25,3 +26,32 @@ class PaginatedQuerysetMixin:
|
||||
page = self.request.GET.get("page", 1)
|
||||
qs = paginator.get_page(page)
|
||||
return qs
|
||||
|
||||
|
||||
class StylingMixin:
|
||||
placeholder_for_field = {}
|
||||
styled_fields = []
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.style_fields()
|
||||
|
||||
def style_fields(self):
|
||||
for field_name in self.styled_fields:
|
||||
field = self.fields[field_name]
|
||||
field.required = True
|
||||
field.widget.attrs.update(
|
||||
{
|
||||
"class": "my-2 bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg "
|
||||
"focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 "
|
||||
"dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 "
|
||||
"dark:focus:border-primary-500"
|
||||
}
|
||||
)
|
||||
|
||||
if self.placeholder_for_field.get(field_name):
|
||||
field.widget.attrs.update(
|
||||
{
|
||||
"placeholder": self.placeholder_for_field.get(field_name),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Hola madafaka
|
||||
@@ -0,0 +1,3 @@
|
||||
{% load i18n %}{% autoescape off %}
|
||||
{% blocktranslate %}Password reset on {{ site_name }}{% endblocktranslate %}
|
||||
{% endautoescape %}
|
||||
@@ -8,7 +8,7 @@
|
||||
<a href="{% url 'web:index' %}"
|
||||
class="flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white">
|
||||
<img class="w-8 h-8 mr-2" src="{{ logo }}" alt="logo">
|
||||
{{ title }}
|
||||
{{ web_title }}
|
||||
</a>
|
||||
|
||||
<div
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<a href="{% url 'web:index' %}" class="flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white">
|
||||
<img class="w-8 h-8 mr-2" src="{{ logo }}" alt="logo">
|
||||
{{ title }}
|
||||
{{ web_title }}
|
||||
</a>
|
||||
|
||||
<div
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<a href="{% url 'web:index' %}" class="flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white">
|
||||
<img class="w-8 h-8 mr-2" src="{{ logo }}" alt="logo">
|
||||
{{ title }}
|
||||
{{ web_title }}
|
||||
</a>
|
||||
|
||||
<div
|
||||
@@ -20,7 +20,7 @@
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
|
||||
<div class="my-2 flex items-center">
|
||||
<div class="my-2">
|
||||
<label for="{{ field.id_for_label }}"
|
||||
class="inline-block text-sm font-medium text-gray-900 dark:text-white mr-2">
|
||||
{{ field.label }}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<a href="{% url 'web:index' %}" class="flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white">
|
||||
<img class="w-8 h-8 mr-2" src="{{ logo }}" alt="logo">
|
||||
{{ title }}
|
||||
{{ web_title }}
|
||||
</a>
|
||||
|
||||
<div
|
||||
@@ -21,7 +21,7 @@
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
|
||||
<div class="my-2 flex items-center">
|
||||
<div class="my-2">
|
||||
<label for="{{ field.id_for_label }}"
|
||||
class="inline-block text-sm font-medium text-gray-900 dark:text-white mr-2">
|
||||
{{ field.label }}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<a href="{% url 'web:index' %}"
|
||||
class="flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white">
|
||||
<img class="w-8 h-8 mr-2" src="{{ logo }}" alt="logo">
|
||||
{{ title }}
|
||||
{{ web_title }}
|
||||
</a>
|
||||
|
||||
<div
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
{{ product.price.price_with_tax }} €
|
||||
</p>
|
||||
|
||||
<!--
|
||||
<div class="flex items-center gap-2 mt-2 sm:mt-0">
|
||||
<div class="flex items-center gap-1">
|
||||
{% include 'components/icons/star.svg' %}
|
||||
@@ -48,6 +49,7 @@
|
||||
345 Reviews
|
||||
</a>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<div class="my-4 sm:gap-4 items-center flex sm:m-8">
|
||||
|
||||
+9
-3
@@ -129,14 +129,13 @@ class ResetPasswordView(TemplateView):
|
||||
template_name = "users/reset_password.html"
|
||||
form_class = PasswordResetForm
|
||||
redirect_to = "web:reset_password_email_sent"
|
||||
email_reset_password_template_name = "mails/reset_password.txt"
|
||||
html_reset_password_template_name = "mails/reset_password.html"
|
||||
subject_template_name = "mails/subject_reset_password.txt"
|
||||
|
||||
def get_email_options(self):
|
||||
return {
|
||||
"extra_email_context": {},
|
||||
"email_template_name": self.email_reset_password_template_name,
|
||||
"email_template_name": self.html_reset_password_template_name,
|
||||
"html_email_template_name": self.html_reset_password_template_name,
|
||||
"subject_template_name": self.subject_template_name,
|
||||
}
|
||||
@@ -177,6 +176,14 @@ class ResetPasswordView(TemplateView):
|
||||
class ResetPasswordEmailSent(TemplateView):
|
||||
template_name = "users/reset_password_email_sent.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
settings = WebSettings.load()
|
||||
|
||||
return {
|
||||
"title": settings.web_title,
|
||||
"description": settings.web_description,
|
||||
}
|
||||
|
||||
|
||||
class ResetPasswordConfirmView(TemplateView):
|
||||
template_name = "users/reset_password_confirm.html"
|
||||
@@ -237,7 +244,6 @@ class MyAccountView(TemplateView):
|
||||
addresses = CustomerAddress.objects.filter(user=self.request.user)
|
||||
settings = WebSettings.load()
|
||||
return {
|
||||
"web_title": settings.web_title,
|
||||
"customer_addresses": addresses,
|
||||
}
|
||||
|
||||
|
||||
+2
-9
@@ -32,7 +32,6 @@ class IndexView(TemplateView):
|
||||
settings = WebSettings.load()
|
||||
return {
|
||||
"title": settings.web_title,
|
||||
"web_title": settings.web_title,
|
||||
"description": settings.web_description,
|
||||
}
|
||||
|
||||
@@ -46,8 +45,7 @@ class CategoryView(TemplateView):
|
||||
category = ProductCategory.objects.get(slug=slug)
|
||||
|
||||
return {
|
||||
"title": settings.web_title,
|
||||
"web_title": settings.web_title,
|
||||
"title": _(f'{settings.web_title} - {category.name}'),
|
||||
"description": settings.web_description,
|
||||
"category": category,
|
||||
"filter_by_category": True,
|
||||
@@ -63,8 +61,7 @@ class ProductDetail(TemplateView):
|
||||
|
||||
return {
|
||||
"product": product,
|
||||
"title": product.name,
|
||||
"web_title": settings.web_title,
|
||||
"title": f'{settings.web_title} - {product.name}',
|
||||
"description": product.description,
|
||||
"image": product.images.first(),
|
||||
}
|
||||
@@ -82,7 +79,6 @@ class CartDetail(TemplateView, CreateView):
|
||||
return {
|
||||
"cart": cart,
|
||||
"items": cart_items,
|
||||
"web_title": web_settings.web_title,
|
||||
"description": _("resumen del carrito"),
|
||||
}
|
||||
|
||||
@@ -169,7 +165,6 @@ class OrderDetail(TemplateView):
|
||||
settings = WebSettings.load()
|
||||
|
||||
return {
|
||||
"web_title": settings.web_title,
|
||||
"order": order,
|
||||
"items": items,
|
||||
"signature_version": parameters.get("Ds_SignatureVersion"),
|
||||
@@ -190,7 +185,6 @@ class WishlistView(TemplateView):
|
||||
settings = WebSettings.load()
|
||||
return {
|
||||
"title": settings.web_title,
|
||||
"web_title": settings.web_title,
|
||||
"description": settings.web_description,
|
||||
}
|
||||
|
||||
@@ -210,7 +204,6 @@ class OrdersView(TemplateView, FilteredQuerysetMixin, PaginatedQuerysetMixin):
|
||||
|
||||
return {
|
||||
"title": settings.web_title,
|
||||
"web_title": settings.web_title,
|
||||
"page": page,
|
||||
"has_next_page": page.has_next(),
|
||||
"has_previous_page": page.has_previous(),
|
||||
|
||||
Reference in New Issue
Block a user