Skip to content
Snippets Groups Projects
Commit 264ca23a authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

add videos, mobile menu, finish article images, add social media links, UI improvements

parent 6a5755fd
No related branches found
No related tags found
No related merge requests found
Showing
with 905 additions and 9 deletions
# Generated by Django 4.2.4 on 2023-08-19 22:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("home", "0023_homepage_academic_council"),
]
operations = [
migrations.AddField(
model_name="homepersonpage",
name="name_titles",
field=models.CharField(
blank=True, max_length=32, null=True, verbose_name="Tituly"
),
),
]
# Generated by Django 4.2.4 on 2023-08-19 23:08
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("home", "0024_homepersonpage_name_titles"),
]
operations = [
migrations.AddField(
model_name="homearticlepage",
name="image",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
verbose_name="Obrázek",
),
),
migrations.AddField(
model_name="homearticlepage",
name="show_image_on_homepage",
field=models.BooleanField(
default=False, verbose_name="Zobrazovat obrázek na homepage"
),
),
]
# Generated by Django 4.2.4 on 2023-08-20 14:17
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0083_workflowcontenttype"),
("home", "0025_homearticlepage_image_and_more"),
]
operations = [
migrations.CreateModel(
name="SocialMediaSettings",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"mastodon",
models.URLField(blank=True, help_text="Mastodon URL", null=True),
),
(
"twitter",
models.URLField(blank=True, help_text="Twitter URL", null=True),
),
(
"linkedin",
models.URLField(blank=True, help_text="LinkedIn URL", null=True),
),
(
"facebook",
models.URLField(blank=True, help_text="Facebook URL", null=True),
),
(
"site",
models.OneToOneField(
editable=False,
on_delete=django.db.models.deletion.CASCADE,
to="wagtailcore.site",
),
),
],
options={
"verbose_name": "Sociální sítě",
},
),
]
# Generated by Django 4.2.4 on 2023-08-20 15:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0026_socialmediasettings"),
]
operations = [
migrations.RemoveField(
model_name="homedocumentpage",
name="tags",
),
migrations.RemoveField(
model_name="homeeventpage",
name="tags",
),
]
# Generated by Django 4.2.4 on 2023-08-20 16:06
import django.db.models.deletion
import modelcluster.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("taggit", "0005_auto_20220424_2025"),
("home", "0027_remove_homedocumentpage_tags_and_more"),
]
operations = [
migrations.CreateModel(
name="ArticleTag",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
],
options={
"abstract": False,
},
),
migrations.RemoveField(
model_name="homearticlepage",
name="tags",
),
migrations.DeleteModel(
name="Tag",
),
migrations.AddField(
model_name="articletag",
name="content_object",
field=modelcluster.fields.ParentalKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="tagged_items",
to="home.homearticlepage",
),
),
migrations.AddField(
model_name="articletag",
name="tag",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="%(app_label)s_%(class)s_items",
to="taggit.tag",
),
),
]
# Generated by Django 4.2.4 on 2023-08-20 16:06
import modelcluster.contrib.taggit
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("taggit", "0005_auto_20220424_2025"),
("home", "0028_articletag_remove_homearticlepage_tags_delete_tag_and_more"),
]
operations = [
migrations.AddField(
model_name="homearticlepage",
name="tags",
field=modelcluster.contrib.taggit.ClusterTaggableManager(
blank=True,
help_text="A comma-separated list of tags.",
through="home.ArticleTag",
to="taggit.Tag",
verbose_name="Štítky",
),
),
]
# Generated by Django 4.2.4 on 2023-08-20 16:50
import django.db.models.deletion
import django.utils.timezone
import wagtail.contrib.routable_page.models
import wagtail.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("wagtailcore", "0083_workflowcontenttype"),
("home", "0029_homearticlepage_tags"),
]
operations = [
migrations.CreateModel(
name="HomeVideosPage",
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",
),
),
(
"content",
wagtail.fields.RichTextField(
blank=True, null=True, verbose_name="Obsah"
),
),
],
options={
"verbose_name": "Rozcestník videí",
},
bases=(
wagtail.contrib.routable_page.models.RoutablePageMixin,
"wagtailcore.page",
),
),
migrations.CreateModel(
name="HomeVideoPage",
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",
),
),
(
"author",
models.CharField(
blank=True,
max_length=128,
null=True,
verbose_name="Jméno autora",
),
),
(
"date",
models.DateField(
default=django.utils.timezone.now,
verbose_name="Datum vytvoření",
),
),
("content", wagtail.fields.RichTextField(verbose_name="Obsah")),
(
"embed_url",
models.URLField(
help_text="Pro získání adresy zmáčkni tlačítko Sdílet, vyber záložku Embed a zaškrtní zobrazování pouze URL.",
verbose_name="URL Embedu",
),
),
(
"author_page",
models.ForeignKey(
blank=True,
help_text="Pokud je vybrána stránka, není nutno vyplňovat jméno autora níže.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="home.homepersonpage",
verbose_name="Stránka autora",
),
),
(
"thumbnail",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
verbose_name="Náhledový obrázek",
),
),
],
options={
"abstract": False,
},
bases=(
wagtail.contrib.routable_page.models.RoutablePageMixin,
"wagtailcore.page",
),
),
]
# Generated by Django 4.2.4 on 2023-08-20 16:53
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0030_homevideospage_homevideopage"),
]
operations = [
migrations.AlterModelOptions(
name="homevideopage",
options={"verbose_name": "Video"},
),
]
# Generated by Django 4.2.4 on 2023-08-20 16:54
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0031_alter_homevideopage_options"),
]
operations = [
migrations.AlterField(
model_name="homevideopage",
name="content",
field=wagtail.fields.RichTextField(
blank=True, null=True, verbose_name="Obsah"
),
),
]
from django.db import models
from django.utils import timezone
from modelcluster.contrib.taggit import ClusterTaggableManager
from modelcluster.fields import ParentalKey
from taggit.models import TaggedItemBase
from wagtail.admin.panels import (
FieldPanel,
MultiFieldPanel,
......@@ -8,12 +11,24 @@ from wagtail.admin.panels import (
)
from wagtail.blocks import PageChooserBlock
from wagtail.contrib.routable_page.models import RoutablePageMixin, path
from wagtail.contrib.settings.models import BaseSiteSetting, register_setting
from wagtail.documents import get_document_model
from wagtail.fields import RichTextField, StreamField
from wagtail.models import Page
from .blocks import PersonBlock
# --- BEGIN Tags ---
class ArticleTag(TaggedItemBase):
content_object = ParentalKey(
"home.HomeArticlePage", on_delete=models.CASCADE, related_name="tagged_items"
)
# --- END Tags ---
class HomePage(RoutablePageMixin, Page):
heading_text = RichTextField(verbose_name="Hlavní text stránky")
......@@ -137,6 +152,7 @@ class HomePage(RoutablePageMixin, Page):
"home.HomeArticlesPage",
"home.HomeEventsPage",
"home.HomeDocumentsPage",
"home.HomeVideosPage",
"home.HomePeoplePage",
]
......@@ -242,7 +258,7 @@ class HomePage(RoutablePageMixin, Page):
verbose_name = "Domovská stránka"
# --- BEGIN Articles, events and documents ---
# --- BEGIN Articles, events, videos and documents ---
class HomeArticlesPage(RoutablePageMixin, Page):
......@@ -257,7 +273,21 @@ class HomeArticlesPage(RoutablePageMixin, Page):
@property
def articles(self):
return HomeArticlePage.objects.live().order_by("-date").all()
return HomeArticlePage.objects.live().order_by("-date")
def get_context(self, request):
context = super().get_context(request)
articles = self.articles
# Filter by tag
tag = request.GET.get("tag")
if tag:
articles = articles.filter(tags__name=tag)
context["filtered_tag"] = tag
context["articles"] = articles
return context
class Meta:
verbose_name = "Rozcestník článků"
......@@ -299,9 +329,25 @@ class HomeDocumentsPage(RoutablePageMixin, Page):
verbose_name = "Rozcestník dokumentů"
class HomeContentPageMixin(RoutablePageMixin, Page):
tags = models.ManyToManyField("Tag", verbose_name="Štítky")
class HomeVideosPage(RoutablePageMixin, Page):
content = RichTextField(verbose_name="Obsah", blank=True, null=True)
parent_page_type = ["home.HomePage"]
subpage_types = ["home.HomeVideoPage"]
content_panels = Page.content_panels + [
FieldPanel("content", icon="pilcrow"),
]
@property
def videos(self):
return HomeVideoPage.objects.live().order_by("-date").all()
class Meta:
verbose_name = "Rozcestník videí"
class HomeContentPageMixin(RoutablePageMixin, Page):
author_page = models.ForeignKey(
"home.HomePersonPage",
on_delete=models.SET_NULL,
......@@ -348,6 +394,22 @@ class HomeContentPageMixin(RoutablePageMixin, Page):
class HomeArticlePage(HomeContentPageMixin):
image = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
verbose_name="Obrázek",
)
show_image_on_homepage = models.BooleanField(
verbose_name="Zobrazovat obrázek na homepage",
default=False,
)
tags = ClusterTaggableManager(through=ArticleTag, blank=True, verbose_name="Štítky")
perex = models.TextField(verbose_name="Perex")
content_panels = Page.content_panels + [
......@@ -358,8 +420,16 @@ class HomeArticlePage(HomeContentPageMixin):
],
heading="Autor",
),
MultiFieldPanel(
[
FieldPanel("image", icon="image", heading=" "),
FieldPanel("show_image_on_homepage"),
],
heading="Obrázek",
),
FieldPanel("date", icon="calendar"),
FieldPanel("perex", icon="pilcrow"),
FieldPanel("tags", icon="tag"),
FieldPanel("content", icon="pilcrow"),
]
......@@ -418,7 +488,42 @@ class HomeDocumentPage(HomeContentPageMixin):
verbose_name = "Dokument"
# --- END Articles, events and documents ---
class HomeVideoPage(HomeContentPageMixin):
embed_url = models.URLField(
verbose_name="URL Embedu",
help_text="Pro získání adresy zmáčkni tlačítko Sdílet, vyber záložku Embed a zaškrtní zobrazování pouze URL.",
)
thumbnail = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
verbose_name="Náhledový obrázek",
)
content = RichTextField(verbose_name="Obsah", blank=True, null=True)
content_panels = Page.content_panels + [
FieldPanel("embed_url", icon="link"),
FieldPanel("thumbnail", icon="image"),
MultiFieldPanel(
[
FieldPanel("author_page", icon="user"),
FieldPanel("author", icon="user"),
],
heading="Autor",
),
FieldPanel("date", icon="calendar"),
FieldPanel("content", icon="pilcrow"),
]
class Meta:
verbose_name = "Video"
# --- END Articles, events, videos and documents ---
# --- BEGIN People ---
......@@ -450,6 +555,13 @@ class HomePersonPage(RoutablePageMixin, Page):
verbose_name="Profilový obrázek",
)
name_titles = models.CharField(
max_length=32,
blank=True,
null=True,
verbose_name="Tituly",
)
position = models.TextField(verbose_name="Pracovní pozice", blank=True, null=True)
email = models.EmailField(verbose_name="Emailová adresa", blank=True, null=True)
......@@ -457,22 +569,63 @@ class HomePersonPage(RoutablePageMixin, Page):
description = RichTextField(verbose_name="Popis", blank=True, null=True)
content_panels = Page.content_panels + [
FieldPanel("name_titles", icon="pilcrow"),
FieldPanel("image", icon="image"),
FieldPanel("position", icon="pilcrow"),
FieldPanel("email", icon="mail"),
FieldPanel("description", icon="pilcrow"),
]
@property
def full_name(self) -> str:
name = self.title
if self.name_titles is not None:
name = f"{self.name_titles} {name}"
return name
@property
def inline_position(self) -> str:
"""Returns this person's position formatted to fit on a single line."""
if self.position is None:
return None
split_positions = self.position.split("\n")
split_positions = [position.strip() for position in split_positions]
return ", ".join(split_positions)
class Meta:
verbose_name = "Osoba"
# --- END People ---
# --- BEGIN Settings ---
@register_setting
class SocialMediaSettings(BaseSiteSetting):
mastodon = models.URLField(blank=True, null=True, help_text="Mastodon URL")
twitter = models.URLField(blank=True, null=True, help_text="Twitter URL")
linkedin = models.URLField(blank=True, null=True, help_text="LinkedIn URL")
facebook = models.URLField(blank=True, null=True, help_text="Facebook URL")
class Tag(models.Model):
name = models.CharField(verbose_name="Jméno", max_length=32)
panels = [
MultiFieldPanel(
[
FieldPanel("mastodon"),
FieldPanel("twitter"),
FieldPanel("linkedin"),
FieldPanel("facebook"),
],
heading="Nastavení sociálních sítí",
)
]
class Meta:
verbose_name = "Štítek"
verbose_name_plural = "Štítky"
verbose_name = "Sociální sítě"
# --- END Settings ---
No preview for this file type
No preview for this file type
No preview for this file type
@font-face {
font-family: "pirati-ui";
src:
url("./pirati-ui.eot") format("embedded-opentype"),
url("./pirati-ui.ttf") format("truetype"),
url("./pirati-ui.woff") format("woff"),
url("./pirati-ui.svg") format("svg");
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^="ico--"], [class*=" ico--"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'pirati-ui' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.ico--mastodon:before {
content: "\e973";
}
.ico--helios:before {
content: "\e96e";
}
.ico--redmine:before {
content: "\e96f";
}
.ico--zulip:before {
content: "\e970";
}
.ico--forum:before {
content: "\e971";
}
.ico--pirati:before {
content: "\e90d";
}
.ico--jitsi:before {
content: "\e90f";
}
.ico--open-source:before {
content: "\e90e";
}
.ico--donation-full:before {
content: "\e96c";
}
.ico--donation-outline:before {
content: "\e96d";
}
.ico--strategy:before {
content: "\e932";
}
.ico--pig:before {
content: "\e928";
}
.ico--thermometer:before {
content: "\e90a";
}
.ico--menu:before {
content: "\e933";
}
.ico--chevron-right:before {
content: "\e923";
}
.ico--chevron-left:before {
content: "\e924";
}
.ico--chevron-down:before {
content: "\e925";
}
.ico--chevron-up:before {
content: "\e926";
}
.ico--link-horizontal:before {
content: "\e910";
}
.ico--beer:before {
content: "\e909";
}
.ico--food:before {
content: "\e968";
}
.ico--dots-three-vertical:before {
content: "\e940";
}
.ico--dots-three-horizontal:before {
content: "\e941";
}
.ico--log-out:before {
content: "\e942";
}
.ico--envelope:before {
content: "\e908";
}
.ico--pin:before {
content: "\e943";
}
.ico--at:before {
content: "\e905";
}
.ico--glass:before {
content: "\e967";
}
.ico--checkmark:before {
content: "\e965";
}
.ico--info:before {
content: "\e901";
}
.ico--question:before {
content: "\e904";
}
.ico--warning:before {
content: "\e93f";
}
.ico--code:before {
content: "\e94a";
}
.ico--checkbox-unchecked:before {
content: "\e94e";
}
.ico--star-full:before {
content: "\e94f";
}
.ico--star-empty:before {
content: "\e950";
}
.ico--bookmark:before {
content: "\e951";
}
.ico--cog:before {
content: "\e952";
}
.ico--key:before {
content: "\e953";
}
.ico--zoom-in:before {
content: "\e954";
}
.ico--zoom-out:before {
content: "\e955";
}
.ico--shrink:before {
content: "\e956";
}
.ico--printer:before {
content: "\e957";
}
.ico--file-openoffice:before {
content: "\e958";
}
.ico--user:before {
content: "\e959";
}
.ico--file-excel:before {
content: "\e95a";
}
.ico--file-word:before {
content: "\e95b";
}
.ico--file-pdf:before {
content: "\e95c";
}
.ico--file-picture:before {
content: "\e95d";
}
.ico--file-blank:before {
content: "\e95e";
}
.ico--folder-upload:before {
content: "\e95f";
}
.ico--upload:before {
content: "\e960";
}
.ico--cloud-upload:before {
content: "\e961";
}
.ico--folder-download:before {
content: "\e962";
}
.ico--download:before {
content: "\e963";
}
.ico--cloud-download:before {
content: "\e964";
}
.ico--alarm:before {
content: "\e900";
}
.ico--calculator:before {
content: "\e911";
}
.ico--facebook-full:before {
content: "\e913";
}
.ico--feed:before {
content: "\e927";
}
.ico--library:before {
content: "\e929";
}
.ico--office:before {
content: "\e92a";
}
.ico--attachment:before {
content: "\e92b";
}
.ico--enlarge:before {
content: "\e92c";
}
.ico--eye-off:before {
content: "\e92e";
}
.ico--eye:before {
content: "\e92f";
}
.ico--share:before {
content: "\e931";
}
.ico--search:before {
content: "\e939";
}
.ico--pencil:before {
content: "\e93c";
}
.ico--lock-open:before {
content: "\e947";
}
.ico--lock:before {
content: "\e948";
}
.ico--equalizer:before {
content: "\e949";
}
.ico--switch:before {
content: "\e94b";
}
.ico--loop:before {
content: "\e94c";
}
.ico--refresh:before {
content: "\e94d";
}
.ico--bullhorn:before {
content: "\e944";
}
.ico--bin:before {
content: "\e945";
}
.ico--cross:before {
content: "\e937";
}
.ico--checkbox-checked:before {
content: "\e938";
}
.ico--globe:before {
content: "\e93a";
}
.ico--wikipedia:before {
content: "\e93b";
}
.ico--youtube:before {
content: "\e936";
}
.ico--users:before {
content: "\e934";
}
.ico--book:before {
content: "\e935";
}
.ico--bubbles:before {
content: "\e930";
}
.ico--map:before {
content: "\e914";
}
.ico--compass:before {
content: "\e915";
}
.ico--folder-open:before {
content: "\e916";
}
.ico--folder:before {
content: "\e917";
}
.ico--drawer:before {
content: "\e918";
}
.ico--stop:before {
content: "\e919";
}
.ico--github:before {
content: "\e91a";
}
.ico--clock:before {
content: "\e91b";
}
.ico--calendar:before {
content: "\e91c";
}
.ico--flickr:before {
content: "\e91d";
}
.ico--instagram:before {
content: "\e91e";
}
.ico--twitter:before {
content: "\e91f";
}
.ico--newspaper:before {
content: "\e920";
}
.ico--cart:before {
content: "\e921";
}
.ico--home:before {
content: "\e922";
}
.ico--link:before {
content: "\e912";
}
.ico--power:before {
content: "\e90c";
}
.ico--rocket:before {
content: "\e946";
}
.ico--location:before {
content: "\e906";
}
.ico--phone:before {
content: "\e907";
}
.ico--linkedin:before {
content: "\e903";
}
.ico--facebook:before {
content: "\e902";
}
.ico--envelop:before {
content: "\e972";
}
.ico--bed:before {
content: "\e969";
}
.ico--train:before {
content: "\e96a";
}
.ico--bus:before {
content: "\e96b";
}
.ico--wheelchair:before {
content: "\e966";
}
.ico--thumbs-down:before {
content: "\e93d";
}
.ico--thumbs-up:before {
content: "\e93e";
}
.ico--anchor:before {
content: "\e92d";
}
.ico--paw:before {
content: "\e90b";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment