diff --git a/.dockerignore b/.dockerignore index fa8fa40..bb246a0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ +.idea/ # Django project /media/ /static/ diff --git a/.idea/iamkonstantin-web.iml b/.idea/iamkonstantin-web.iml index 4a1b312..79d7ae9 100644 --- a/.idea/iamkonstantin-web.iml +++ b/.idea/iamkonstantin-web.iml @@ -15,8 +15,9 @@ + - + diff --git a/.idea/misc.xml b/.idea/misc.xml index d0b0933..6de942c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 92c6246..1b241e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use an official Python runtime based on Debian 10 "buster" as a parent image. -FROM python:3.11-slim-buster +FROM python:3.13-slim # Add user that will be used in the container. # RUN useradd wagtail @@ -15,10 +15,10 @@ ENV PYTHONUNBUFFERED=1 \ PORT=8000 # Install system packages required by Wagtail and Django. -RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ - build-essential \ - libpq-dev \ - libmariadbclient-dev \ +RUN apt-get update --yes --quiet && apt-get install --yes --no-install-recommends \ +# build-essential \ +# libpq-dev \ +# libmariadbclient-dev \ libjpeg62-turbo-dev \ zlib1g-dev \ libwebp-dev \ diff --git a/Makefile b/Makefile index e2885df..9fc9251 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY: help build publish -VERSION = 1.2.2 +VERSION = 1.5.0 help: @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @@ -8,7 +8,8 @@ build: @docker build -t code.headbright.be/konstantin/iamkonstantin:$(VERSION) . publish: - @docker push code.headbright.be/konstantin/iamkonstantin:$(VERSION) + # something to try: --provenance=false + @docker buildx build -t code.headbright.be/konstantin/iamkonstantin:$(VERSION) --platform linux/arm64 --push . bump: @bash ./bump_version.sh upgrade: build publish \ No newline at end of file diff --git a/base/migrations/0007_remove_formpage_page_ptr_delete_formfield_and_more.py b/base/migrations/0007_remove_formpage_page_ptr_delete_formfield_and_more.py new file mode 100644 index 0000000..637011d --- /dev/null +++ b/base/migrations/0007_remove_formpage_page_ptr_delete_formfield_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 5.0.2 on 2024-10-06 15:19 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0006_navigationsettings_bluesky_url_and_more'), + ] + + operations = [ + migrations.RemoveField( + model_name='formpage', + name='page_ptr', + ), + migrations.DeleteModel( + name='FormField', + ), + migrations.DeleteModel( + name='FormPage', + ), + ] diff --git a/base/models.py b/base/models.py index a590d8c..748e1f0 100644 --- a/base/models.py +++ b/base/models.py @@ -76,25 +76,25 @@ class FooterText( class Meta(TranslatableMixin.Meta): verbose_name_plural = "Footer Text" - -class FormField(AbstractFormField): - page = ParentalKey('FormPage', on_delete=models.CASCADE, related_name='form_fields') - - -class FormPage(AbstractEmailForm): - intro = RichTextField(blank=True) - thank_you_text = RichTextField(blank=True) - - content_panels = AbstractEmailForm.content_panels + [ - FormSubmissionsPanel(), - FieldPanel('intro'), - InlinePanel('form_fields', label="Form fields"), - FieldPanel('thank_you_text'), - MultiFieldPanel([ - FieldRowPanel([ - FieldPanel('from_address'), - FieldPanel('to_address'), - ]), - FieldPanel('subject'), - ], "Email"), - ] +# +# class FormField(AbstractFormField): +# page = ParentalKey('FormPage', on_delete=models.CASCADE, related_name='form_fields') +# +# +# class FormPage(AbstractEmailForm): +# intro = RichTextField(blank=True) +# thank_you_text = RichTextField(blank=True) +# +# content_panels = AbstractEmailForm.content_panels + [ +# FormSubmissionsPanel(), +# FieldPanel('intro'), +# InlinePanel('form_fields', label="Form fields"), +# FieldPanel('thank_you_text'), +# MultiFieldPanel([ +# FieldRowPanel([ +# FieldPanel('from_address'), +# FieldPanel('to_address'), +# ]), +# FieldPanel('subject'), +# ], "Email"), +# ] diff --git a/blog/templates/blog/blog_index_page.html b/blog/templates/blog/blog_index_page.html index fd44827..da226bd 100644 --- a/blog/templates/blog/blog_index_page.html +++ b/blog/templates/blog/blog_index_page.html @@ -15,55 +15,54 @@
{% for post in blogpages %} {% with post=post.specific %} -
-
-

- - - {{ post.title }} - -

-

{{ post.intro }}

-
- {% if post.main_image %} -
- {% with post.main_image as main_image %} - {% if main_image %} - {% image main_image width-1600 class="blog" %}{% endif %} +
+
+

+ + + {{ post.title }} + +

+

{{ post.intro }}

+
+ {% if post.main_image %} +
+ {% with post.main_image as main_image %} + {% if main_image %} + {% image main_image width-1600 class="blog" %}{% endif %} + {% endwith %} +
+
+ {% endif %} +
+
+ +
+ + {% with tags=post.tags.all %} + {% if tags %} +
+

Tags

+
    + {% for tag in tags %} +
  • 🏷️ + {{ tag }} +
  • + {% endfor %} +
+
+ {% endif %} {% endwith %} -
- {% endif %} -
-
- -
- - {% with tags=post.tags.all %} - {% if tags %} -
-

Tags

-
    - {% for tag in tags %} -
  • 🏷️ - {{ tag }} -
  • - {% endfor %} -
-
- {% endif %} - {% endwith %} -
-
{% endwith %} {% endfor %} -
-
+
+ {% endblock %} \ No newline at end of file diff --git a/blog/templates/blog/blog_page.html b/blog/templates/blog/blog_page.html index 5e85027..c790824 100644 --- a/blog/templates/blog/blog_page.html +++ b/blog/templates/blog/blog_page.html @@ -80,4 +80,7 @@ +
+ {% include 'newsletter/snippets/signup_form.html' %} +
{% endblock %} \ No newline at end of file diff --git a/home/models.py b/home/models.py index 34d4bb1..140aece 100644 --- a/home/models.py +++ b/home/models.py @@ -4,6 +4,8 @@ from wagtail.models import Page from wagtail.fields import RichTextField, StreamField from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtailseo.models import SeoMixin, SeoType + +from blog.models import BlogPage from .blocks import HomeContentBlock @@ -57,3 +59,10 @@ class HomePage(SeoMixin, Page): promote_panels = SeoMixin.seo_panels seo_content_type = SeoType.WEBSITE + + def get_context(self, request, *args, **kwargs): + context = super().get_context(request) + # retrieve the last 3 blogposts + recent_blog_items = BlogPage.objects.live().order_by('-first_published_at')[:3] + context['recent_blog_items'] = recent_blog_items + return context \ No newline at end of file diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html index e54aff8..161686a 100644 --- a/home/templates/home/home_page.html +++ b/home/templates/home/home_page.html @@ -5,749 +5,19 @@ {% block content %}
- Drawing of my computer desk where we see an iMac with an open Terminal - with Swift code snippets. On the shelf behind we can see programming - books for Rust, Swift and JavaScript. The books are arranges vertically - next to a small flower pot. The flower has big green leafes. A cup of - steaming coffee sits on the desk, to the left of the iMac. + Drawing of my computer desk where we see a computer with an open Terminal + with Elixir code snippets. On the shelf behind we can see programming + books for Rust, Elixir and JavaScript. The books are arranges vertically + next to a small flower pot. The flower has big green leaves. A cup of + steaming coffee sits on the desk, to the left of the computer. The cup has a Python logo on it.
- +
-
+

@@ -775,10 +45,43 @@

+
+

From the blog

+
    + {% for post in recent_blog_items %} + {% with post=post.specific %} +
    +
    +

    + + + {{ post.title }} + +

    +

    {{ post.intro }}

    +
    + {% if post.main_image %} +
    + {% with post.main_image as main_image %} + {% if main_image %} + {% image main_image width-1600 class="blog" %}{% endif %} + {% endwith %} +
    +
    + {% endif %} +
    + {% endwith %} + {% endfor %} +
+
+
{{ page.body }}
+
+ {% include 'newsletter/snippets/signup_form.html' %} +
{% endblock content %} \ No newline at end of file diff --git a/iamkonstantin_web/settings/base.py b/iamkonstantin_web/settings/base.py index be1a823..44ac0f7 100644 --- a/iamkonstantin_web/settings/base.py +++ b/iamkonstantin_web/settings/base.py @@ -29,6 +29,7 @@ INSTALLED_APPS = [ "blog", "home", "search", + "newsletter", "wagtailcodeblock", "wagtailseo", "wagtail.contrib.settings", diff --git a/iamkonstantin_web/templates/base.html b/iamkonstantin_web/templates/base.html index 48dd9f2..90c1c93 100644 --- a/iamkonstantin_web/templates/base.html +++ b/iamkonstantin_web/templates/base.html @@ -4,7 +4,7 @@ - + {% include "wagtailseo/meta.html" %} {% block title %} @@ -64,7 +64,7 @@ <div class="relative w-full sm:px-8"> {% include "includes/header.html" %} - <main id="main" class="mx-auto max-w-7xl px-0 md:px-4 lg:px-8"> + <main id="main" class="mx-auto max-w-5xl px-0 md:px-4 lg:px-8"> {% block content %}{% endblock %} </main> diff --git a/iamkonstantin_web/urls.py b/iamkonstantin_web/urls.py index 1a7982a..d53a50e 100644 --- a/iamkonstantin_web/urls.py +++ b/iamkonstantin_web/urls.py @@ -8,6 +8,7 @@ from wagtail import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls from blog.feeds import RssBlogFeed +from newsletter import views as newsletter_views from search import views as search_views from wagtail.contrib.sitemaps.views import sitemap from base.views import KeyView @@ -20,7 +21,8 @@ urlpatterns = [ path("blog/feed/", RssBlogFeed(), name="blog_feed"), path('sitemap.xml', sitemap), path('robots.txt', TemplateView.as_view(template_name="robots.txt", content_type="text/plain")), - path('<str:key>.txt', KeyView.as_view()) + path('<str:key>.txt', KeyView.as_view()), + path('newsletter/thanks', newsletter_views.thanks, name='thanks') ] if settings.DEBUG: diff --git a/newsletter/__init__.py b/newsletter/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/newsletter/admin.py b/newsletter/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/newsletter/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/newsletter/apps.py b/newsletter/apps.py new file mode 100644 index 0000000..76e54c1 --- /dev/null +++ b/newsletter/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class NewsletterConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'newsletter' diff --git a/newsletter/migrations/__init__.py b/newsletter/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/newsletter/models.py b/newsletter/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/newsletter/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/newsletter/templates/newsletter/snippets/signup_form.html b/newsletter/templates/newsletter/snippets/signup_form.html new file mode 100644 index 0000000..500fc82 --- /dev/null +++ b/newsletter/templates/newsletter/snippets/signup_form.html @@ -0,0 +1,4 @@ +<div class="py-16 sm:py-24 lg:py-32"> + <iframe data-w-type="embedded" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://sgx7y.mjt.lu/wgt/sgx7y/xtn1/form?c=c9b8015e" width="100%" style="height: 0;"></iframe> +<script type="text/javascript" src="https://app.mailjet.com/pas-nc-embedded-v1.js"></script> +</div> \ No newline at end of file diff --git a/newsletter/templates/newsletter/thanks.html b/newsletter/templates/newsletter/thanks.html new file mode 100644 index 0000000..cf6b061 --- /dev/null +++ b/newsletter/templates/newsletter/thanks.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% load static wagtailcore_tags %} + +{% block title %}Newsletter{% endblock %} + +{% block content %} + <div class="min-h-96 flex flex-col"> + <section class="flex-grow h-full px-0 md:px-4 lg:px-8"> + <div class="px-0 md:px-4 lg:px-8"> + <h1>Thank you</h1> + Your newsletter subscription is confirmed. + </div> + </section> + </div> +{% endblock %} \ No newline at end of file diff --git a/newsletter/tests.py b/newsletter/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/newsletter/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/newsletter/views.py b/newsletter/views.py new file mode 100644 index 0000000..d15538c --- /dev/null +++ b/newsletter/views.py @@ -0,0 +1,8 @@ +from django.template.response import TemplateResponse + + +def thanks(request): + return TemplateResponse( + request, + "newsletter/thanks.html", + ) diff --git a/requirements.txt b/requirements.txt index a373c2a..69558ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -Django>=4.2,<5.1 -wagtail>=6.2.2,<6.3 +Django>=4.2,<5.2 +wagtail>=6.3,<6.4 whitenoise>=6.6,<7.0 wagtailcodeblock>=1.29.0.2,<2.0 django-tailwind>=3.6.0 diff --git a/theme/static/images/my-office.png b/theme/static/images/my-office.png new file mode 100644 index 0000000..a83e1ba Binary files /dev/null and b/theme/static/images/my-office.png differ