-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add carousel plugin to landpage
- Loading branch information
1 parent
0f3ec25
commit 9cebc0d
Showing
5 changed files
with
185 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
app/contrib/frontend/landpage/migrations/0008_auto_20231019_2300.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Generated by Django 3.2 on 2023-10-19 23:00 | ||
|
||
import colorfield.fields | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import filer.fields.image | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.FILER_IMAGE_MODEL), | ||
('cms', '0022_auto_20180620_1551'), | ||
('landpage', '0007_merge_0006_auto_20230821_2039_0006_auto_20230822_1436'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CarouselBlock', | ||
fields=[ | ||
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='landpage_carouselblock', serialize=False, to='cms.cmsplugin')), | ||
('title', models.CharField(max_length=120, verbose_name='Título')), | ||
('description', models.CharField(blank=True, max_length=120, null=True, verbose_name='Descrição')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('cms.cmsplugin',), | ||
), | ||
migrations.AlterField( | ||
model_name='block', | ||
name='background_color', | ||
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=[('#FFFFFF', 'white'), ('#000000', 'black')]), | ||
), | ||
migrations.AlterField( | ||
model_name='footer', | ||
name='background_color', | ||
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=[('#FFFFFF', 'white'), ('#000000', 'black')], verbose_name='Cor de fundo'), | ||
), | ||
migrations.AlterField( | ||
model_name='footer', | ||
name='color', | ||
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=[('#FFFFFF', 'white'), ('#000000', 'black')], verbose_name='Cor da fonte'), | ||
), | ||
migrations.AlterField( | ||
model_name='navbar', | ||
name='background_color', | ||
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=[('#FFFFFF', 'white'), ('#000000', 'black')], verbose_name='Cor de fundo'), | ||
), | ||
migrations.AlterField( | ||
model_name='navbar', | ||
name='color', | ||
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=[('#FFFFFF', 'white'), ('#000000', 'black')], verbose_name='Cor da fonte'), | ||
), | ||
migrations.CreateModel( | ||
name='CarouselItem', | ||
fields=[ | ||
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='landpage_carouselitem', serialize=False, to='cms.cmsplugin')), | ||
('text', models.TextField(verbose_name='Texto do item')), | ||
('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='carousel_items', to='landpage.carouselblock')), | ||
('image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.FILER_IMAGE_MODEL, verbose_name='Imagem do item')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('cms.cmsplugin',), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
app/contrib/frontend/landpage/templates/frontend/landpage/plugins/carousel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{% load cms_tags sekizai_tags static %} | ||
|
||
{% addtoblock "css" %} | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css" /> | ||
{% endaddtoblock %} | ||
|
||
<section class="bg-[#024C2B] relative"> | ||
<div class="container px-5 py-28 mx-auto md:px-4"> | ||
{% if title or description %} | ||
<div class="mb-6"> | ||
{% if title %} | ||
<h2 class="text-4xl text-white text-center max-w-[620px] mx-auto mb-4">{{ title }}</h2> | ||
{% endif %} | ||
{% if description %} | ||
<p class="text-white text-center max-w-[815px] mx-auto">{{ description }}</p> | ||
{% endif %} | ||
</div> | ||
{% endif %} | ||
|
||
<div class="swiper mySwiper md:min-h-[300px]"> | ||
<div class="swiper-wrapper"> | ||
<!-- Slides --> | ||
{% for item in items %} | ||
<div class="swiper-slide"> | ||
<img src="{{ item.image.url }}" alt="{{ item.text }}"> | ||
<p>{{ item.text }}</p> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
<div class="swiper-pagination"></div> | ||
<div class="swiper-button-prev mt-14 md:mx-5 md:mt-10"></div> | ||
<div class="swiper-button-next mt-14 md:mx-5 md:mt-10"></div> | ||
</div> | ||
</section> | ||
|
||
{% addtoblock "js" %} | ||
<script src="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.js"></script> | ||
<script> | ||
var swiper = new Swiper(".mySwiper", { | ||
slidesPerView: 1, | ||
spaceBetween: 10, | ||
pagination: { | ||
el: ".swiper-pagination", | ||
clickable: true, | ||
}, | ||
navigation: { | ||
nextEl: ".swiper-button-next", | ||
prevEl: ".swiper-button-prev", | ||
}, | ||
breakpoints: { | ||
640: { | ||
slidesPerView: 2, | ||
spaceBetween: 20, | ||
}, | ||
768: { | ||
slidesPerView: 4, | ||
spaceBetween: 40, | ||
}, | ||
1024: { | ||
slidesPerView: 5, | ||
spaceBetween: 50, | ||
}, | ||
}, | ||
}); | ||
</script> | ||
{% endaddtoblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters