Skip to content
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
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@
# COLLECTION TEAM AND JOURNAL TEAM
COLLECTION_TEAM = "Collection Team"
JOURNAL_TEAM = "Journal Team"
FREE_PAGE_TEAM = "FreePage"

MONGODB_URI = env.str("MONGODB_URI", default="mongodb://localhost:27017")
MONGODB_DATABASE = env.str("MONGODB_DATABASE", default="articlemeta")
Expand Down
52 changes: 52 additions & 0 deletions core/home/migrations/0016_freepage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Generated by Django 5.2.7 on 2026-05-22 15:19

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("home", "0015_alter_formpage_thank_you_text"),
("wagtailcore", "0095_groupsitepermission"),
]

operations = [
migrations.CreateModel(
name="FreePage",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
(
"embed",
models.TextField(
blank=True,
help_text="Embed content for the page, such as an iframe or other embed code.",
null=True,
verbose_name="Embed",
),
),
(
"use_only_embed",
models.BooleanField(
default=False,
help_text="If checked, the page will only display the embed content without the body text.",
verbose_name="Set only embed",
),
),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
]
55 changes: 48 additions & 7 deletions core/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from collection.models import Collection
from core.home.utils.get_social_networks import get_social_networks
from journal.choices import STUDY_AREA
from journal.models import OwnerHistory, SciELOJournal

SCIELO_STATUS_CHOICES = ["C", "D", "S"]
Expand Down Expand Up @@ -109,6 +108,7 @@ class HomePageSponsor(Orderable):
Modelo para armazenar patrocinadores (logos) do footer da HomePage.
Permite adicionar múltiplos patrocinadores com ordem personalizada.
"""

page = ParentalKey(
"HomePage",
on_delete=models.CASCADE,
Expand Down Expand Up @@ -171,7 +171,11 @@ class HomePage(Page):
]

content_panels = Page.content_panels + [
InlinePanel("sponsors", label=_("Footer Sponsors"), heading=_("Patrocinadores do Footer")),
InlinePanel(
"sponsors",
label=_("Footer Sponsors"),
heading=_("Patrocinadores do Footer"),
),
]

def get_context(self, request, *args, **kwargs):
Expand Down Expand Up @@ -335,22 +339,22 @@ class BibliographicReferenceBlock(blocks.StructBlock):
reference = blocks.RichTextBlock(
required=True,
label=_("Referência Bibliográfica"),
help_text=_("Digite a referência bibliográfica completa")
help_text=_("Digite a referência bibliográfica completa"),
)
icon = ImageBlock(
required=False,
label=_("Ícone"),
help_text=_("Selecione um ícone para exibir ao lado da referência")
help_text=_("Selecione um ícone para exibir ao lado da referência"),
)

class Meta:
icon = "doc-full"
label = _("Referência Bibliográfica")
template = "home/blocks/bibliographic_reference_block.html"


class AboutScieloOrgPage(Page):
subpage_types = ["home.AboutScieloOrgPage"]
subpage_types = ["home.AboutScieloOrgPage", "home.FreePage"]

body = RichTextField(_("Body"), blank=True)
external_link = models.URLField(
Expand Down Expand Up @@ -445,7 +449,9 @@ def serve(self, request, *args, **kwargs):
return JsonResponse(
{
"alert": "error",
"message": _("Erro ao tentar enviar o <strong>formulário!</strong> Verifique os campos obrigatórios. Errors: %s")
"message": _(
"Erro ao tentar enviar o <strong>formulário!</strong> Verifique os campos obrigatórios. Errors: %s"
)
% form.errors,
}
)
Expand Down Expand Up @@ -484,3 +490,38 @@ class Meta:
"Email",
),
]


class FreePage(Page):
embed = models.TextField(
_("Embed"),
null=True,
blank=True,
help_text=_(
"Embed content for the page, such as an iframe or other embed code."
),
)
use_only_embed = models.BooleanField(
default=False,
verbose_name=_("Set only embed"),
help_text=_(
"If checked, the page will only display the embed content without the body text."
),
)

content_panels = Page.content_panels + [
FieldPanel("embed", classname="full"),
FieldPanel("use_only_embed", classname="full"),
]

@classmethod
def can_create_at(cls, parent):
from core.utils.thread_context import get_current_user
if not super().can_create_at(parent):
return False
user = get_current_user()
if not user or not user.is_authenticated:
return False
if user.is_superuser:
return True
return user.groups.filter(name=settings.FREE_PAGE_TEAM).exists()
19 changes: 19 additions & 0 deletions core/templates/home/free_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends "base.html" %}
{% load i18n %}

{% block title %}{{ page.title }}{% endblock title %}

{% block content %}
<div class="container py-4">
{% if page.use_only_embed and page.embed %}
{{ page.embed|safe }}
{% else %}
<h1>{{ page.title }}</h1>
{% if page.embed %}
<div class="mt-4">
{{ page.embed|safe }}
</div>
{% endif %}
{% endif %}
</div>
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.7 on 2026-05-22 14:44

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("core", "0009_alter_licensestatement_options_and_more"),
("journal", "0059_alter_digitalpreservationagency_options"),
]

operations = [
migrations.AlterUniqueTogether(
name="journalparalleltitle",
unique_together={("official_journal", "text", "language")},
),
]
Loading