wagtail-enap-designsystem 1.2.1.174__py3-none-any.whl → 1.2.1.176__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of wagtail-enap-designsystem might be problematic. Click here for more details.
- enap_designsystem/blocks/html_blocks.py +142 -27
- enap_designsystem/migrations/0445_alter_areaaluno_body_alter_cursoeadpage_curso_and_more.py +70889 -0
- enap_designsystem/migrations/0446_alter_areaaluno_body_alter_enapcomponentes_body_and_more.py +55314 -0
- enap_designsystem/migrations/0447_alter_areaaluno_body_alter_enapcomponentes_body_and_more.py +55294 -0
- enap_designsystem/models.py +1 -0
- enap_designsystem/static/enap_designsystem/blocks/banner.css +1 -1
- enap_designsystem/static/enap_designsystem/blocks/btn.css +11 -5
- enap_designsystem/static/enap_designsystem/blocks/capsulas.css +662 -690
- enap_designsystem/static/enap_designsystem/blocks/carousel_images.css +0 -2
- enap_designsystem/static/enap_designsystem/blocks/suap/suap_courses_block.css +1 -0
- enap_designsystem/templates/enap_designsystem/blocks/card_block.html +4 -2
- enap_designsystem/templates/enap_designsystem/blocks/suap/apisuap_courses_block.html +224 -208
- enap_designsystem/templates/enap_designsystem/blocks/texto_imagem.html +1 -1
- enap_designsystem/templates/enap_designsystem/pages/capsula_index_page.html +67 -755
- enap_designsystem/templates/enap_designsystem/pages/quiz_rota_page.html +425 -389
- {wagtail_enap_designsystem-1.2.1.174.dist-info → wagtail_enap_designsystem-1.2.1.176.dist-info}/METADATA +1 -1
- {wagtail_enap_designsystem-1.2.1.174.dist-info → wagtail_enap_designsystem-1.2.1.176.dist-info}/RECORD +20 -17
- {wagtail_enap_designsystem-1.2.1.174.dist-info → wagtail_enap_designsystem-1.2.1.176.dist-info}/WHEEL +0 -0
- {wagtail_enap_designsystem-1.2.1.174.dist-info → wagtail_enap_designsystem-1.2.1.176.dist-info}/licenses/LICENSE +0 -0
- {wagtail_enap_designsystem-1.2.1.174.dist-info → wagtail_enap_designsystem-1.2.1.176.dist-info}/top_level.txt +0 -0
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: var(--altura-desktop);
|
|
5
5
|
overflow: hidden;
|
|
6
|
-
margin-bottom: 60px;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
.carousel-container {
|
|
@@ -164,7 +163,6 @@
|
|
|
164
163
|
transition: all 0.3s ease;
|
|
165
164
|
cursor: pointer;
|
|
166
165
|
font-size: 1rem;
|
|
167
|
-
text-transform: uppercase;
|
|
168
166
|
letter-spacing: 0.5px;
|
|
169
167
|
}
|
|
170
168
|
|
|
@@ -281,13 +281,15 @@
|
|
|
281
281
|
</div>
|
|
282
282
|
|
|
283
283
|
<style>
|
|
284
|
+
.card-info-white {
|
|
285
|
+
border-left: 2px solid #024248;
|
|
286
|
+
}
|
|
284
287
|
/* Cards Informativos */
|
|
285
288
|
.card-info-white .card-info-container {
|
|
286
289
|
display: flex;
|
|
287
290
|
align-items: flex-start;
|
|
288
291
|
gap: 20px;
|
|
289
|
-
padding: 24px;
|
|
290
|
-
border-left: 4px solid #024248;
|
|
292
|
+
padding: 0 24px;
|
|
291
293
|
background-color: #FFFFFF;
|
|
292
294
|
position: relative;
|
|
293
295
|
flex-direction: column;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!-- enap_designsystem/blocks/suap/suap_courses_block.html -->
|
|
2
2
|
{% load wagtailcore_tags wagtailimages_tags %}
|
|
3
3
|
{% load static %}
|
|
4
|
-
|
|
5
|
-
<section class="
|
|
4
|
+
<div style="width:100%;display: flex;justify-content: center;">
|
|
5
|
+
<section class="section-curso-cards-suap">
|
|
6
6
|
<div class="suap-wrapper-texts">
|
|
7
7
|
{% if bloco_suap.title %}
|
|
8
8
|
<h2 style="color: {{value.cor_title}}" class="suap-h2-title">{{ bloco_suap.title }}</h2>
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
{% if cursos_suap %}
|
|
17
|
-
|
|
17
|
+
{% if value.estilo_cards == "eventos" %}
|
|
18
|
+
<div class="container suap-courses-section">
|
|
18
19
|
<div class="suap-courses-carousel-container" id="suap-courses-carousel-container">
|
|
19
20
|
<div class="suap-courses-carousel-items" id="suap-courses-carousel-items">
|
|
20
21
|
{% for curso in cursos_suap %}
|
|
@@ -77,14 +78,18 @@
|
|
|
77
78
|
{% endif %}
|
|
78
79
|
</div>
|
|
79
80
|
<div class="suap-courses-carousel-content">
|
|
80
|
-
<div class="suap-course-tag">
|
|
81
|
-
|
|
81
|
+
<div class="suap-course-tag suap-course-tag-{{ curso.tipo_conteudo }}">
|
|
82
|
+
{% if curso.tipo_conteudo == 'evento' %}
|
|
83
|
+
Evento
|
|
84
|
+
{% else %}
|
|
85
|
+
Curso
|
|
86
|
+
{% endif %}
|
|
82
87
|
</div>
|
|
83
88
|
{% if curso.descricao %}
|
|
84
89
|
<h3 class="suap-courses-title">{{ curso.descricao }}</h3>
|
|
85
90
|
{% endif %}
|
|
86
91
|
{% if curso.breve_descricao %}
|
|
87
|
-
<p class="card-text">{{ curso.breve_descricao|truncatewords:10 }}</p>
|
|
92
|
+
<p class="suap-card-text">{{ curso.breve_descricao|truncatewords:10 }}</p>
|
|
88
93
|
{% endif %}
|
|
89
94
|
|
|
90
95
|
<!-- Status de inscrições -->
|
|
@@ -113,14 +118,60 @@
|
|
|
113
118
|
</div>
|
|
114
119
|
{% endfor %}
|
|
115
120
|
</div>
|
|
116
|
-
<button class="
|
|
117
|
-
<
|
|
121
|
+
<button class="carousel-control-curso-suap carousel-control-curso-suap-prev" style="left: 0px;">
|
|
122
|
+
<span class="visually-hidden">Rolar para esquerda</span>
|
|
123
|
+
<span class="material-symbols-outlined setas seta-esquerda">chevron_left</span>
|
|
124
|
+
</button>
|
|
125
|
+
<button class="carousel-control-curso-suap carousel-control-curso-suap-next" style="right: 0px;">
|
|
126
|
+
<span class="visually-hidden">Rolar para direita</span>
|
|
127
|
+
<span class="material-symbols-outlined setas seta-direita">chevron_right</span>
|
|
128
|
+
</button>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
{% elif value.estilo_cards == "cursos" %}
|
|
132
|
+
<div class="wrapper-carousel-container01">
|
|
133
|
+
<div class="carousel-container01">
|
|
134
|
+
<div class="carousel-items01" id="cursos-suap-carousel">
|
|
135
|
+
{% for curso in cursos_suap %}
|
|
136
|
+
<a href="{{curso.url}}" class="btn1">
|
|
137
|
+
<div class="carousel-item-wrapper-suap">
|
|
138
|
+
<div class="carousel-item-curso-suap">
|
|
139
|
+
<div class="image-curso">
|
|
140
|
+
<h3 title="{{ curso.titulo }}">
|
|
141
|
+
<img class="img-fluid" src="{% static 'enap_designsystem/blocks/suap/default_2.png' %}" alt="Imagem padrão com logo da Enap e fundo verde" width="236" height="140" loading="lazy">
|
|
142
|
+
</h3>
|
|
143
|
+
</div>
|
|
144
|
+
<div class="content-curso">
|
|
145
|
+
<div class="card-body">
|
|
146
|
+
<div class="tag tag-{{ curso.tipo_conteudo }}">
|
|
147
|
+
{% if curso.tipo_conteudo == 'evento' %}
|
|
148
|
+
Evento
|
|
149
|
+
{% else %}
|
|
150
|
+
Curso
|
|
151
|
+
{% endif %}
|
|
152
|
+
</div>
|
|
153
|
+
<h3 class="h3-card" style=" display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; ">{{ curso.descricao }}</h3>
|
|
154
|
+
<p class="card-text-text" style=" display: -webkit-box; color: #434A54; font-size: 16px; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; ">{{ curso.breve_descricao }}</p>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</a>
|
|
160
|
+
{% endfor %}
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<button class="carousel-control-curso-suap carousel-control-curso-suap-prev">
|
|
164
|
+
<span class="visually-hidden">Rolar para esquerda</span>
|
|
165
|
+
<span class="material-symbols-outlined setas seta-esquerda">chevron_left</span>
|
|
118
166
|
</button>
|
|
119
|
-
<button class="
|
|
120
|
-
<
|
|
167
|
+
<button class="carousel-control-curso-suap carousel-control-curso-suap-next">
|
|
168
|
+
<span class="visually-hidden">Rolar para direita</span>
|
|
169
|
+
<span class="material-symbols-outlined setas seta-direita">chevron_right</span>
|
|
121
170
|
</button>
|
|
171
|
+
|
|
122
172
|
</div>
|
|
123
173
|
</div>
|
|
174
|
+
{% endif %}
|
|
124
175
|
{% if bloco_suap.url_button %}
|
|
125
176
|
<a class="suap-btn-todos" href="{{ bloco_suap.url_button }}">{{ bloco_suap.button }}</a>
|
|
126
177
|
{% endif %}
|
|
@@ -133,8 +184,12 @@
|
|
|
133
184
|
{% endif %}
|
|
134
185
|
{% endif %}
|
|
135
186
|
</section>
|
|
136
|
-
|
|
187
|
+
</div>
|
|
137
188
|
<style>
|
|
189
|
+
|
|
190
|
+
.carousel-item-curso-suap{
|
|
191
|
+
background-color: #FFFFFF;
|
|
192
|
+
}
|
|
138
193
|
.suap-course-inscricoes {
|
|
139
194
|
margin: 8px 0;
|
|
140
195
|
font-size: 14px;
|
|
@@ -178,7 +233,7 @@
|
|
|
178
233
|
flex-direction: column;
|
|
179
234
|
gap: 40px;
|
|
180
235
|
overflow: hidden;
|
|
181
|
-
padding:
|
|
236
|
+
padding: 0;
|
|
182
237
|
}
|
|
183
238
|
|
|
184
239
|
.suap-wrapper-texts {
|
|
@@ -212,6 +267,7 @@
|
|
|
212
267
|
position: relative;
|
|
213
268
|
max-width: 1142px;
|
|
214
269
|
margin: auto;
|
|
270
|
+
width: 100%;
|
|
215
271
|
}
|
|
216
272
|
|
|
217
273
|
.suap-courses-carousel-items {
|
|
@@ -378,6 +434,10 @@
|
|
|
378
434
|
font-style: italic;
|
|
379
435
|
}
|
|
380
436
|
|
|
437
|
+
.carousel-control-curso-suap {
|
|
438
|
+
display: block;
|
|
439
|
+
}
|
|
440
|
+
|
|
381
441
|
/* Estilos responsivos */
|
|
382
442
|
@media (max-width: 992px) {
|
|
383
443
|
.suap-courses-section {
|
|
@@ -468,215 +528,171 @@
|
|
|
468
528
|
|
|
469
529
|
<script>
|
|
470
530
|
document.addEventListener('DOMContentLoaded', function() {
|
|
471
|
-
//
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
return window.innerWidth <= 768;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// Determina quantos itens são visíveis na viewport atual
|
|
498
|
-
function getVisibleItems() {
|
|
499
|
-
const containerWidth = container.offsetWidth;
|
|
500
|
-
return Math.max(1, Math.floor(containerWidth / itemTotalWidth));
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// Calcula o índice máximo possível
|
|
504
|
-
function getMaxIndex() {
|
|
505
|
-
return Math.max(0, items.length - getVisibleItems());
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// Define quantos itens devem ser rolados de cada vez
|
|
509
|
-
function getScrollAmount() {
|
|
510
|
-
return isMobile() ? 1 : 3; // 1 no mobile, 3 no desktop
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
// Exibe o slide no índice especificado com alinhamento perfeito
|
|
514
|
-
function showSlide(index) {
|
|
515
|
-
// Garante que o índice esteja dentro dos limites válidos
|
|
516
|
-
const maxIndex = getMaxIndex();
|
|
517
|
-
currentIndex = Math.max(0, Math.min(index, maxIndex));
|
|
518
|
-
|
|
519
|
-
// Calcula o offset preciso baseado no índice atual
|
|
520
|
-
const offset = Math.round(currentIndex * itemTotalWidth);
|
|
521
|
-
|
|
522
|
-
// Aplica a transformação com valor inteiro para evitar problemas de subpixel
|
|
523
|
-
carouselItems.style.transform = `translateX(-${offset}px)`;
|
|
524
|
-
|
|
525
|
-
// Atualiza a visibilidade dos botões de navegação
|
|
526
|
-
updateButtons(maxIndex);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// Atualiza a visibilidade dos botões de navegação
|
|
530
|
-
function updateButtons(maxIndex) {
|
|
531
|
-
// Primeiro slide: esconde botão anterior
|
|
532
|
-
if (currentIndex <= 0) {
|
|
533
|
-
prevBtn.style.display = 'none';
|
|
534
|
-
nextBtn.style.display = items.length > getVisibleItems() ? 'block' : 'none';
|
|
535
|
-
}
|
|
536
|
-
// Último slide: esconde botão próximo
|
|
537
|
-
else if (currentIndex >= maxIndex) {
|
|
538
|
-
prevBtn.style.display = 'block';
|
|
539
|
-
nextBtn.style.display = 'none';
|
|
540
|
-
}
|
|
541
|
-
// Slides intermediários: mostra ambos os botões
|
|
542
|
-
else {
|
|
543
|
-
prevBtn.style.display = 'block';
|
|
544
|
-
nextBtn.style.display = 'block';
|
|
531
|
+
// Função genérica para inicializar um carrossel
|
|
532
|
+
function initCarousel({
|
|
533
|
+
containerSelector,
|
|
534
|
+
itemsSelector,
|
|
535
|
+
prevBtnSelector,
|
|
536
|
+
nextBtnSelector,
|
|
537
|
+
itemWidth,
|
|
538
|
+
itemGap,
|
|
539
|
+
useItemsAsContainer = false // NOVO: permite usar o próprio items como container
|
|
540
|
+
}) {
|
|
541
|
+
const container = document.querySelector(containerSelector);
|
|
542
|
+
const carouselItems = container ? container.querySelector(itemsSelector) : null;
|
|
543
|
+
const prevBtn = container ? container.querySelector(prevBtnSelector) : null;
|
|
544
|
+
const nextBtn = container ? container.querySelector(nextBtnSelector) : null;
|
|
545
|
+
if (!container || !carouselItems || !prevBtn || !nextBtn) return;
|
|
546
|
+
const items = carouselItems.querySelectorAll(':scope > *');
|
|
547
|
+
let currentIndex = 0;
|
|
548
|
+
let startX, moveX, initialPosition;
|
|
549
|
+
let isDragging = false;
|
|
550
|
+
const itemTotalWidth = itemWidth + itemGap;
|
|
551
|
+
|
|
552
|
+
function isMobile() {
|
|
553
|
+
return window.innerWidth <= 768;
|
|
545
554
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const amount = getScrollAmount();
|
|
552
|
-
const step = Math.min(amount, currentIndex);
|
|
553
|
-
showSlide(currentIndex - step);
|
|
554
|
-
});
|
|
555
|
-
|
|
556
|
-
nextBtn.addEventListener('click', () => {
|
|
557
|
-
// Número de itens a avançar depende do dispositivo
|
|
558
|
-
const amount = getScrollAmount();
|
|
559
|
-
const maxIndex = getMaxIndex();
|
|
560
|
-
const step = Math.min(amount, maxIndex - currentIndex);
|
|
561
|
-
showSlide(currentIndex + step);
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
// Eventos de toque para mobile
|
|
565
|
-
carouselItems.addEventListener('touchstart', handleStart, { passive: true });
|
|
566
|
-
carouselItems.addEventListener('touchmove', handleMove, { passive: false });
|
|
567
|
-
carouselItems.addEventListener('touchend', handleEnd, { passive: true });
|
|
568
|
-
|
|
569
|
-
// Eventos de mouse para desktop
|
|
570
|
-
carouselItems.addEventListener('mousedown', handleStart);
|
|
571
|
-
carouselItems.addEventListener('mousemove', handleMove);
|
|
572
|
-
carouselItems.addEventListener('mouseup', handleEnd);
|
|
573
|
-
carouselItems.addEventListener('mouseleave', handleEnd);
|
|
574
|
-
|
|
575
|
-
// Inicia o arrasto do carousel
|
|
576
|
-
function handleStart(e) {
|
|
577
|
-
isDragging = true;
|
|
578
|
-
startX = e.type === 'touchstart' ? e.touches[0].clientX : e.clientX;
|
|
579
|
-
initialPosition = currentIndex * itemTotalWidth;
|
|
580
|
-
|
|
581
|
-
// Remove transição para resposta imediata
|
|
582
|
-
carouselItems.style.transition = 'none';
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
// Processa o movimento durante o arrasto
|
|
586
|
-
function handleMove(e) {
|
|
587
|
-
if (!isDragging) return;
|
|
588
|
-
|
|
589
|
-
moveX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX;
|
|
590
|
-
const diff = moveX - startX;
|
|
591
|
-
|
|
592
|
-
// Aplica o movimento com efeito elástico nos limites
|
|
593
|
-
const maxIndex = getMaxIndex();
|
|
594
|
-
|
|
595
|
-
if (currentIndex === 0 && diff > 50) {
|
|
596
|
-
// Limite inicial com efeito elástico
|
|
597
|
-
carouselItems.style.transform = `translateX(${diff / 3 - initialPosition}px)`;
|
|
598
|
-
} else if (currentIndex >= maxIndex && diff < -50) {
|
|
599
|
-
// Limite final com efeito elástico
|
|
600
|
-
carouselItems.style.transform = `translateX(${diff / 3 - initialPosition}px)`;
|
|
601
|
-
} else {
|
|
602
|
-
// Movimento normal
|
|
603
|
-
carouselItems.style.transform = `translateX(${diff - initialPosition}px)`;
|
|
555
|
+
function getVisibleItems() {
|
|
556
|
+
// Use o próprio items como container se necessário
|
|
557
|
+
const base = useItemsAsContainer ? carouselItems : container;
|
|
558
|
+
const containerWidth = base.offsetWidth;
|
|
559
|
+
return Math.max(1, Math.floor(containerWidth / itemTotalWidth));
|
|
604
560
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
if (Math.abs(diff) > 10 && e.type === 'touchmove') {
|
|
608
|
-
e.preventDefault();
|
|
561
|
+
function getMaxIndex() {
|
|
562
|
+
return Math.max(0, items.length - getVisibleItems());
|
|
609
563
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
564
|
+
function getScrollAmount() {
|
|
565
|
+
return isMobile() ? 1 : 3;
|
|
566
|
+
}
|
|
567
|
+
function showSlide(index) {
|
|
568
|
+
const maxIndex = getMaxIndex();
|
|
569
|
+
currentIndex = Math.max(0, Math.min(index, maxIndex));
|
|
570
|
+
const offset = Math.round(currentIndex * itemTotalWidth);
|
|
571
|
+
carouselItems.style.transform = `translateX(-${offset}px)`;
|
|
572
|
+
updateButtons(maxIndex);
|
|
573
|
+
}
|
|
574
|
+
function updateButtons(maxIndex) {
|
|
575
|
+
if (currentIndex <= 0) {
|
|
576
|
+
prevBtn.style.display = 'none';
|
|
577
|
+
nextBtn.style.display = items.length > getVisibleItems() ? 'block' : 'none';
|
|
578
|
+
} else if (currentIndex >= maxIndex) {
|
|
579
|
+
prevBtn.style.display = 'block';
|
|
580
|
+
nextBtn.style.display = 'none';
|
|
581
|
+
} else {
|
|
582
|
+
prevBtn.style.display = 'block';
|
|
583
|
+
nextBtn.style.display = 'block';
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
prevBtn.addEventListener('click', () => {
|
|
626
587
|
const amount = getScrollAmount();
|
|
627
588
|
const step = Math.min(amount, currentIndex);
|
|
628
589
|
showSlide(currentIndex - step);
|
|
629
|
-
}
|
|
630
|
-
|
|
590
|
+
});
|
|
591
|
+
nextBtn.addEventListener('click', () => {
|
|
631
592
|
const amount = getScrollAmount();
|
|
632
593
|
const maxIndex = getMaxIndex();
|
|
633
594
|
const step = Math.min(amount, maxIndex - currentIndex);
|
|
634
595
|
showSlide(currentIndex + step);
|
|
635
|
-
} else {
|
|
636
|
-
// Movimento pequeno, volta à posição atual
|
|
637
|
-
showSlide(currentIndex);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// Previne cliques em links durante arrasto
|
|
642
|
-
const links = carouselItems.querySelectorAll('a');
|
|
643
|
-
links.forEach(link => {
|
|
644
|
-
link.addEventListener('click', function(e) {
|
|
645
|
-
if (isDragging || (moveX && Math.abs(moveX - startX) > 10)) {
|
|
646
|
-
e.preventDefault();
|
|
647
|
-
}
|
|
648
596
|
});
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
597
|
+
carouselItems.addEventListener('touchstart', handleStart, { passive: true });
|
|
598
|
+
carouselItems.addEventListener('touchmove', handleMove, { passive: false });
|
|
599
|
+
carouselItems.addEventListener('touchend', handleEnd, { passive: true });
|
|
600
|
+
carouselItems.addEventListener('mousedown', handleStart);
|
|
601
|
+
carouselItems.addEventListener('mousemove', handleMove);
|
|
602
|
+
carouselItems.addEventListener('mouseup', handleEnd);
|
|
603
|
+
carouselItems.addEventListener('mouseleave', handleEnd);
|
|
604
|
+
|
|
605
|
+
function handleStart(e) {
|
|
606
|
+
isDragging = true;
|
|
607
|
+
startX = e.type === 'touchstart' ? e.touches[0].clientX : e.clientX;
|
|
608
|
+
initialPosition = currentIndex * itemTotalWidth;
|
|
609
|
+
carouselItems.style.transition = 'none';
|
|
610
|
+
}
|
|
611
|
+
function handleMove(e) {
|
|
612
|
+
if (!isDragging) return;
|
|
613
|
+
moveX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX;
|
|
614
|
+
const diff = moveX - startX;
|
|
656
615
|
const maxIndex = getMaxIndex();
|
|
657
|
-
if (currentIndex >
|
|
658
|
-
|
|
616
|
+
if (currentIndex === 0 && diff > 50) {
|
|
617
|
+
carouselItems.style.transform = `translateX(${diff / 3 - initialPosition}px)`;
|
|
618
|
+
} else if (currentIndex >= maxIndex && diff < -50) {
|
|
619
|
+
carouselItems.style.transform = `translateX(${diff / 3 - initialPosition}px)`;
|
|
620
|
+
} else {
|
|
621
|
+
carouselItems.style.transform = `translateX(${diff - initialPosition}px)`;
|
|
659
622
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
});
|
|
668
|
-
|
|
669
|
-
// Aguardar que todas as imagens carreguem para inicializar corretamente
|
|
670
|
-
window.addEventListener('load', function() {
|
|
671
|
-
// Inicializa com um pequeno delay para garantir medidas corretas
|
|
672
|
-
setTimeout(function() {
|
|
673
|
-
// Certificar que os estilos estão aplicados antes de inicializar
|
|
623
|
+
if (Math.abs(diff) > 10 && e.type === 'touchmove') {
|
|
624
|
+
e.preventDefault();
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
function handleEnd() {
|
|
628
|
+
if (!isDragging) return;
|
|
629
|
+
isDragging = false;
|
|
674
630
|
carouselItems.style.transition = 'transform 0.3s ease-in-out';
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
631
|
+
const diff = moveX - startX;
|
|
632
|
+
const threshold = itemWidth / 4;
|
|
633
|
+
if (diff > threshold) {
|
|
634
|
+
const amount = getScrollAmount();
|
|
635
|
+
const step = Math.min(amount, currentIndex);
|
|
636
|
+
showSlide(currentIndex - step);
|
|
637
|
+
} else if (diff < -threshold) {
|
|
638
|
+
const amount = getScrollAmount();
|
|
639
|
+
const maxIndex = getMaxIndex();
|
|
640
|
+
const step = Math.min(amount, maxIndex - currentIndex);
|
|
641
|
+
showSlide(currentIndex + step);
|
|
642
|
+
} else {
|
|
643
|
+
showSlide(currentIndex);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
const links = carouselItems.querySelectorAll('a');
|
|
647
|
+
links.forEach(link => {
|
|
648
|
+
link.addEventListener('click', function(e) {
|
|
649
|
+
if (isDragging || (moveX && Math.abs(moveX - startX) > 10)) {
|
|
650
|
+
e.preventDefault();
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
window.addEventListener('resize', function() {
|
|
655
|
+
setTimeout(function() {
|
|
656
|
+
const maxIndex = getMaxIndex();
|
|
657
|
+
if (currentIndex > maxIndex) {
|
|
658
|
+
currentIndex = maxIndex;
|
|
659
|
+
}
|
|
660
|
+
carouselItems.style.transition = 'transform 0.3s ease-in-out';
|
|
661
|
+
showSlide(currentIndex);
|
|
662
|
+
}, 100);
|
|
663
|
+
});
|
|
664
|
+
window.addEventListener('load', function() {
|
|
665
|
+
setTimeout(function() {
|
|
666
|
+
carouselItems.style.transition = 'transform 0.3s ease-in-out';
|
|
667
|
+
showSlide(0);
|
|
668
|
+
}, 100);
|
|
669
|
+
});
|
|
670
|
+
showSlide(0);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Inicializa carrossel de eventos (cards grandes)
|
|
674
|
+
if (document.getElementById('suap-courses-carousel-container')) {
|
|
675
|
+
initCarousel({
|
|
676
|
+
containerSelector: '#suap-courses-carousel-container',
|
|
677
|
+
itemsSelector: '#suap-courses-carousel-items',
|
|
678
|
+
prevBtnSelector: '.carousel-control-curso-suap-prev',
|
|
679
|
+
nextBtnSelector: '.carousel-control-curso-suap-next',
|
|
680
|
+
itemWidth: 364,
|
|
681
|
+
itemGap: 25
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// Inicializa carrossel de cursos (cards pequenos) - usa items como container base
|
|
686
|
+
if (document.querySelector('.carousel-container01')) {
|
|
687
|
+
initCarousel({
|
|
688
|
+
containerSelector: '.carousel-container01',
|
|
689
|
+
itemsSelector: '.carousel-items01',
|
|
690
|
+
prevBtnSelector: '.carousel-control-curso-suap-prev',
|
|
691
|
+
nextBtnSelector: '.carousel-control-curso-suap-next',
|
|
692
|
+
itemWidth: 268,
|
|
693
|
+
itemGap: 25,
|
|
694
|
+
useItemsAsContainer: true // NOVO: corrige cálculo de largura
|
|
695
|
+
});
|
|
696
|
+
}
|
|
681
697
|
});
|
|
682
698
|
</script>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{% if value.incluir_botao and value.texto_botao %}
|
|
14
14
|
<div class="texto-imagem-block__botao-container">
|
|
15
15
|
<a href="{{ value.link_botao|default:'#' }}"
|
|
16
|
-
class="btn {
|
|
16
|
+
class="btn {{ value.estilo_botao }} {{ value.tamanho_botao }}"
|
|
17
17
|
{% if value.link_botao and value.link_botao|slice:':4' == 'http' %}
|
|
18
18
|
target="_blank" rel="noopener noreferrer"
|
|
19
19
|
{% endif %}>
|