Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(votepeloclima): Added thumbnail on card profile template #281

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "votepeloclima/base.html" %}
{% load static crispy_forms_filters social_media_tags %}
{% load static crispy_forms_filters social_media_tags thumbnail %}

{% block head_css %}
{{ block.super }}
Expand All @@ -13,7 +13,7 @@
<div class="g-col-12 g-col-md-4">
{% if candidature.photo %}
<div class="candidature-profile-photo">
<img src="{{ candidature.photo.url }}" alt="Foto de {{ candidature.ballot_name }}" class="img-fluid rounded-2"/>
<img src="{{ candidature.photo|thumbnail_url:'profile-photo' }}" alt="Foto de {{ candidature.ballot_name }}" class="img-fluid rounded-2"/>
</div>
{% endif %}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "votepeloclima/base.html" %}
{% load static crispy_forms_filters compress %}
{% load static crispy_forms_filters compress thumbnail %}

{% block head_css %}
{{ block.super }}
Expand Down Expand Up @@ -43,7 +43,7 @@ <h6 class="text-uppercase fw-bold"><i class="ds-sidebar-bars"></i> Filtrar resul
{% for candidature in candidatures %}
<div class="g-col-12 g-col-md-6 g-col-lg-4">
<a class="card" href="{% url 'candidate_profile' candidature.slug %}">
<img src="{{ candidature.photo.url }}" class="card-img-top" alt="Foto de {{ candidature.legal_name }}">
<img src="{{ candidature.photo|thumbnail_url:'profile-photo' }}" class="card-img-top" alt="Foto de {{ candidature.legal_name }}">
<div class="card-body px-2 py-1">
<p class="state-city mb-1 text-black-50">{{ candidature.get_state_display }} - {{ candidature.get_city_display }}</p>
<div class="card-title">
Expand Down
6 changes: 6 additions & 0 deletions app/org_eleicoes/votepeloclima/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,9 @@
REDIRECT_MIDDLEWARE_ROOT_DOMAIN = env("REDIRECT_MIDDLEWARE_ROOT_DOMAIN", default="localhost")

REDIRECT_MIDDLEWARE_LIST_DOMAIN = env.list("REDIRECT_MIDDLEWARE_LIST_DOMAIN", default=["localhost.dev","localhost.devel"])

THUMBNAIL_ALIASES = {
'': {
"profile-photo": {"size": (1080, 1350), "crop": True},
},
}
2 changes: 2 additions & 0 deletions app/org_eleicoes/votepeloclima/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

DEFAULT_FILE_STORAGE = "project.storages.PublicMediaStorage"

THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE

if not DEBUG:

PUBLIC_STATIC_LOCATION = "static"
Expand Down
Loading