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

[Feature] Adiciona "Partners" app e insere dentro do footer do Vote pelo Clima #280

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Empty file.
7 changes: 7 additions & 0 deletions app/contrib/partners/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin
from .models import Partner


@admin.register(Partner)
class PartnerAdmin(admin.ModelAdmin):
list_display = ("name", "link")
6 changes: 6 additions & 0 deletions app/contrib/partners/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class PartnersConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "contrib.partners"
29 changes: 29 additions & 0 deletions app/contrib/partners/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.2 on 2024-08-30 23:17

from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file


class Migration(migrations.Migration):

initial = True

dependencies = [
('filer', '0017_image__transparent'),
]

operations = [
migrations.CreateModel(
name='Partner',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, verbose_name='Nome da Parceria')),
('link', models.URLField(blank=True, null=True, verbose_name='Link da Parceria')),
('logo', filer.fields.file.FilerFileField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='filer.file', verbose_name='Imagem')),
],
options={
'verbose_name': 'Parceiro',
},
),
]
Empty file.
16 changes: 16 additions & 0 deletions app/contrib/partners/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.db import models
from django.utils.translation import gettext_lazy as _

from filer.fields.file import FilerFileField


class Partner(models.Model):
name = models.CharField(max_length=100, verbose_name="Nome da Parceria")
logo = FilerFileField(verbose_name=_("Imagem"), on_delete=models.SET_NULL, null=True, blank=True)
link = models.URLField(blank=True, null=True, verbose_name="Link da Parceria")

def __str__(self):
return self.name

class Meta:
verbose_name = "Parceiro"
9 changes: 9 additions & 0 deletions app/contrib/partners/templates/partners/partners_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="grid">
miguelzinh3 marked this conversation as resolved.
Show resolved Hide resolved
{% for partner in partners %}
<div class="g-col-4 g-col-md-1">
<a href="{{ partner.link }}" target="_blank" rel="noopener noreferrer">
<img src="{{ partner.logo.url }}" alt="{{ partner.name }}" class="partner-logo">
</a>
</div>
{% endfor %}
</div>
9 changes: 9 additions & 0 deletions app/contrib/partners/templatetags/partners_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django import template
from ..models import Partner

register = template.Library()

@register.inclusion_tag("partners/partners_list.html")
def show_partners():
partners = Partner.objects.all()
return {'partners': partners}
1 change: 1 addition & 0 deletions app/org_eleicoes/votepeloclima/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"contrib.ds.picture",
"contrib.ds.tooltip",
# Project Apps
"contrib.partners",
"contrib.oauth",
"org_eleicoes.votepeloclima",
"org_eleicoes.votepeloclima.candidature",
Expand Down
5 changes: 5 additions & 0 deletions app/org_eleicoes/votepeloclima/static/scss/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,8 @@ legend.form-label {
min-height: 230px;
}
}

// Partner Tag
.partner-logo {
miguelzinh3 marked this conversation as resolved.
Show resolved Hide resolved
max-width: 120px;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "ds/base.html" %}
{% load static cms_tags menu_tags compress %}
{% load static cms_tags menu_tags compress partners_tags %}

{% block head_css %}
{{block.super}}
Expand Down Expand Up @@ -83,6 +83,11 @@ <h5 class="fw-bold text-uppercase text-white">Realização</h5>
<div class="g-col-12">
<p>© 2024. Nossas e Clima de Eleição. Direitos reservados.</p>
</div>
<hr class="g-col-12" />
<div class="g-col-12">
<h5 class="text-uppercase text-white">Quem assina</h5>
{% show_partners %}
</div>
</div>
</div>
</footer>
Expand Down
1 change: 1 addition & 0 deletions app/project/settings/django_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"contrib.frontend.grid",
"contrib.frontend.maps",
"contrib.ga",
"contrib.partners",
#
# "contrib.domains.route53",
# "contrib.domains.traefik",
Expand Down
Loading