Skip to content

Commit

Permalink
Merge pull request #309 from danesjenovdan/v3-dev
Browse files Browse the repository at this point in the history
Pulling refs/heads/v3-dev into v3-k8s
  • Loading branch information
LepkoQQ authored Jul 5, 2024
2 parents 387f9a2 + cfc8340 commit fbae17b
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 67 deletions.
6 changes: 6 additions & 0 deletions djnd/home/image_formats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from wagtail.images.formats import get_image_format, unregister_image_format

unregister_image_format("left")
unregister_image_format("right")

get_image_format("fullwidth").filter_spec = "width-1600"
20 changes: 20 additions & 0 deletions djnd/home/migrations/0071_alter_navigationsettings_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.10 on 2024-07-05 10:51

from django.db import migrations
import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('home', '0070_alter_homepage_focus_areas'),
]

operations = [
migrations.AlterField(
model_name='navigationsettings',
name='pages',
field=wagtail.fields.StreamField([('page', wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock()), ('subpages', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(), default=[]))]))], null=True, use_json_field=True, verbose_name='Strani'),
),
]
2 changes: 1 addition & 1 deletion djnd/home/models/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class NavigationSettings(BaseGenericSetting):
[
("page", blocks.StructBlock([
("page", blocks.PageChooserBlock()),
("subpages", blocks.ListBlock(blocks.PageChooserBlock())),
("subpages", blocks.ListBlock(blocks.PageChooserBlock(), default=[])),
])),
],
verbose_name="Strani",
Expand Down
12 changes: 2 additions & 10 deletions djnd/home/templates/home/blog_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% endfor %}
</div>
{% endif %}

<h1 class="text-5xl font-semibold xl-max:text-2xl">{{ page.title }}</h1>
<!-- <div class="rich-text">
{{ value.text|richtext }}
Expand Down Expand Up @@ -50,15 +50,7 @@ <h2 class="text-2xl font-semibold mb-3 xl-max:text-lg">{% translate "Povezani za
<div class="flex gap-10 max-w-[1280px] mx-auto px-14 pb-10 sm-max:px-6 sm-max:pb-5">
<div class="grid grid-cols-3 gap-4 sm-max:grid-cols-1">
{% for blog in page.more_blogs %}
<div class="border border-dark">
<a href="{{ blog.value.link }}" target="_blank">
{% image blog.value.thumbnail width-300 class="w-full h-[180px] object-cover" %}
</a>
<div class="border-t border-dark p-5 pb-2">
<a href="{{ blog.value.link }}" target="_blank" class="block text-2xl font-semibold mb-3 bg-left-bottom bg-[length:0%_0.5em] bg-no-repeat bg-gradient-to-r from-th-primary to-th-primary group-hover:bg-[length:100%_0.5em] transition-all duration-500 ease-out">{{ blog.value.title }}</a>
<p class="mb-6">{{ blog.value.short_description }}</p>
</div>
</div>
{% include "home/partials/blog_activity.html" with activity=blog.value %}
{% endfor %}
</div>
</div>
Expand Down
25 changes: 9 additions & 16 deletions djnd/home/templates/home/newsletter_list_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,15 @@ <h1 class="mb-6 last:mb-0 text-5xl font-semibold uppercase xl-max:text-2xl">{{ p
</div>
</div>

<div class="max-w-[1280px] mx-auto px-14 py-16 border-b border-dark sm-max:px-6 sm-max:py-8">
<h2 class="text-2xl font-semibold mb-8 xl-max:text-lg sm-max:mb-4">{% translate "Preberi pretekle občasnike!" %}</h2>
<div class="grid grid-cols-3 gap-4 sm-max:grid-cols-1">
{% for newsletter in newsletters|slice:":3" %}
<div class="border border-dark">
<a href="{% pageurl newsletter %}" target="_blank">
{% image newsletter.thumbnail width-300 class="w-full h-[180px] object-cover" %}
</a>
<div class="border-t border-dark p-5">
<span class="text-dark text-sm font-mono rounded-full border border-dark px-3 py-1 inline-block mr-1 mb-3">{% translate "Občasnik" %}</span>
<a href="{% pageurl newsletter %}" target="_blank" class="block text-2xl/none font-semibold mb-3 bg-left-bottom bg-[length:0%_0.5em] bg-no-repeat bg-gradient-to-r from-th-primary to-th-primary group-hover:bg-[length:100%_0.5em] transition-all duration-500 ease-out">{{ newsletter.title }}</a>
<p class="font-mono">{{ newsletter.published_at|date:"F Y" }}</p>
</div>
</div>
{% endfor %}
</div>
<div class="border-b border-dark">
<div class="max-w-[1280px] mx-auto px-14 py-16 sm-max:px-6 sm-max:py-8">
<h2 class="text-2xl font-semibold mb-8 xl-max:text-lg sm-max:mb-4">{% translate "Preberi pretekle občasnike!" %}</h2>
<div class="grid grid-cols-3 gap-4 sm-max:grid-cols-1">
{% for newsletter in newsletters|slice:":3" %}
{% include "home/partials/newsletter_activity.html" with activity=newsletter %}
{% endfor %}
</div>
</div>
</div>

{% include 'home/blocks/newsletter_block.html' with id=0 color_scheme='red' %}
Expand Down
50 changes: 16 additions & 34 deletions djnd/home/templates/home/newsletter_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,26 @@
<div class="border-b border-dark bg-th-primary-light">
<div class="flex gap-10 max-w-[1280px] mx-auto px-14 pt-20 pb-10 sm-max:block sm-max:px-6 sm-max:pt-10 sm-max:pb-5">
<div class="basis-8/12">
{% for pillar in page.pillar_page.all %}
<span class="bg-th-primary-light text-sm rounded-full px-3 me py-1 mb-4 inline-flex items-center font-mono border border-dark">
{% if pillar.icon %}
{% image pillar.icon fill-32x32 class="w-4 me-2" %}
{% endif %}
{{ pillar.title }}
</span>
{% endfor %}
{% for category in page.category.all %}
<span class="bg-th-primary-light text-sm rounded-full px-3 py-1 mb-4 inline-flex items-center font-mono border border-dark">
{% if category.icon %}
{% image category.icon fill-32x32 class="w-4 me-2" %}
{% endif %}
{{ category.name }}
</span>
{% endfor %}
{% for project in page.project.all %}
<span class="bg-th-primary-light text-sm rounded-full px-3 py-1 mb-4 inline-flex items-center font-mono border border-dark">
{% if project.icon %}
{% image project.icon fill-32x32 class="w-4 me-2" %}
{% endif %}
{{ project.name }}
</span>
{% endfor %}
{% if settings.home.GeneralSettings.our_work_page %}
<div class="flex flex-wrap">
{% for tag in page.pillar_page.all %}
{% include "home/partials/activity_tag.html" with tag=tag filter_name="pillars" %}
{% endfor %}
{% for tag in page.category.all %}
{% include "home/partials/activity_tag.html" with tag=tag filter_name="categories" %}
{% endfor %}
{% for tag in page.project.all %}
{% include "home/partials/activity_tag.html" with tag=tag filter_name="projects" %}
{% endfor %}
</div>
{% endif %}

<h1 class="mb-6 last:mb-0 text-5xl font-semibold xl-max:text-2xl">{{ page.title }}</h1>
<div class="rich-text">
{{ page.introduction|richtext }}
</div>
</div>
<div class="basis-4/12 sm-max:hidden"></div>
<div class="basis-4/12 sm-max:hidden">&nbsp;</div>
</div>
</div>

Expand Down Expand Up @@ -75,15 +65,7 @@ <h2 class="text-2xl font-semibold xl-max:text-lg">{% translate "Izpostavljeno" %
<p class="text-md mb-8">{% translate "Priporočamo, svetujemo, vabimo, opozarjamo in še kaj drugega" %}</p>
<div class="grid grid-cols-3 gap-4 sm-max:grid-cols-1">
{% for article in page.promoted %}
<div class="border border-dark">
<a href="{{ article.value.link }}" target="_blank">
{% image article.value.image width-300 class="w-full h-[180px] object-cover" %}
</a>
<div class="border-t border-dark p-5 pb-2">
<a href="{{ article.value.link }}" target="_blank" class="block text-lg font-semibold mb-2 bg-left-bottom bg-[length:0%_0.5em] bg-no-repeat bg-gradient-to-r from-th-primary to-th-primary group-hover:bg-[length:100%_0.5em] transition-all duration-500 ease-out">{{ article.value.name }}</a>
<p class="text-sm mb-6">{{ article.value.description }}</p>
</div>
</div>
{% include "home/partials/blog_activity.html" with activity=article.value %}
{% endfor %}
</div>
</div>
Expand Down
24 changes: 24 additions & 0 deletions djnd/home/templates/home/partials/blog_activity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% load i18n static wagtailcore_tags wagtailimages_tags djnd_extras %}

<div class="border border-dark flex flex-col relative">
<a href="{% if activity|is_page %}{% pageurl activity %}{% else %}{{ activity.link }}{% endif %}" target="_blank" class="peer">
{% if activity.thumbnail %}
{% image activity.thumbnail fill-1200x630 class="w-full h-auto object-cover" %}
{% elif activity.image %}
{% image activity.image fill-1200x630 class="w-full h-auto object-cover" %}
{% endif %}
</a>
<div class="border-t border-dark p-5 flex-grow peer-hover:bg-th-primary-light">
<div class="mb-4">
{% firstof activity.name activity.title as blog_title %}
<a href="{% if activity|is_page %}{% pageurl activity %}{% else %}{{ activity.link }}{% endif %}" target="_blank"
class="
text-lg/[1.15] font-semibold
bg-right-bottom bg-[length:0%_0.5em] bg-no-repeat bg-gradient-to-r from-th-primary to-th-primary hover:bg-left-bottom hover:bg-[length:100%_0.5em] transition-[background-size] duration-700 ease-out
"
>{{ blog_title }}</a>
</div>
{% firstof activity.short_description activity.description as blog_description %}
<p class="text-sm/[22px]">{{ blog_description }}</p>
</div>
</div>
33 changes: 33 additions & 0 deletions djnd/home/templates/home/partials/newsletter_activity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% load i18n static wagtailcore_tags wagtailimages_tags %}

<div class="border border-dark flex flex-col relative">
<a href="{% pageurl activity %}" target="_blank" class="peer">
{% image activity.thumbnail fill-1200x630 class="w-full h-auto object-cover" %}
</a>
<div class="border-t border-dark p-5 flex-grow peer-hover:bg-th-primary-light">
{% if settings.home.GeneralSettings.our_work_page %}
<div class="flex flex-wrap">
{% for tag in activity.pillar_page.all %}
{% include "home/partials/activity_tag.html" with tag=tag filter_name="pillars" %}
{% endfor %}
{% for tag in activity.category.all %}
{% include "home/partials/activity_tag.html" with tag=tag filter_name="categories" %}
{% endfor %}
{% for tag in activity.project.all %}
{% include "home/partials/activity_tag.html" with tag=tag filter_name="projects" %}
{% endfor %}
</div>
{% endif %}
<div class="mt-5 mb-4">
<a href="{% pageurl activity %}" target="_blank"
class="
text-3lg font-semibold xl-max:text-lg/[1.15]
bg-right-bottom bg-[length:0%_0.5em] bg-no-repeat bg-gradient-to-r from-th-primary to-th-primary hover:bg-left-bottom hover:bg-[length:100%_0.5em] transition-[background-size] duration-700 ease-out
"
>{{ activity.title }}</a>
</div>
{% if activity.published_at %}
<p class="font-mono mt-4">{{ activity.published_at|date:"F Y" }}</p>
{% endif %}
</div>
</div>
6 changes: 3 additions & 3 deletions djnd/home/templates/home/support_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h2 class="mb-2 text-2xl font-semibold">{% translate "Enkrat" %}</h2>
</a>
</div>
</div>
<div class="basis-4/12 sm-max:hidden"></div>
<div class="basis-4/12 sm-max:hidden">&nbsp;</div>
</div>
<div class="flex gap-10 max-w-[1280px] mx-auto px-14 py-16 border-b border-dark sm-max:block sm-max:px-6 sm-max:py-8">
<div class="basis-8/12">
Expand All @@ -74,13 +74,13 @@ <h2 class="mb-2 text-2xl/none font-semibold xl-max:text-lg">{% translate "Nameni
{% include 'home/partials/button.html' with button_text=button_text button_color=page.color button_link="#" %}
</div>
</div>
<div class="basis-4/12 sm-max:hidden"></div>
<div class="basis-4/12 sm-max:hidden">&nbsp;</div>
</div>
<div class="flex gap-10 max-w-[1280px] mx-auto px-14 py-16 sm-max:block sm-max:px-6 sm-max:py-8">
<div class="basis-8/12">
<p class="text-md/8">{% translate 'Če si brez denarja, še ne pomeni, da nam ne moreš pomagati. Zavihaj rokave, nagubaj čelo in napni mišice ter se nam javi na ' %}<a href="mailto:vsi@danesjenovdan.si" class="animated-hover-bg">vsi@danesjenovdan.si</a>.</p>
</div>
<div class="basis-4/12 sm-max:hidden"></div>
<div class="basis-4/12 sm-max:hidden">&nbsp;</div>
</div>
</div>

Expand Down
10 changes: 8 additions & 2 deletions djnd/home/templatetags/djnd_extras.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django import template
from wagtail.models import Locale
from wagtail.models import Locale, Page

register = template.Library()

Expand Down Expand Up @@ -32,6 +32,7 @@ def get_translated_m2m_ids(value, field_name):

return [obj.id for obj in getattr(value, field_name).all()]


@register.filter
def has_english_translation(value, field_name):
if field_name == "en":
Expand All @@ -41,9 +42,14 @@ def has_english_translation(value, field_name):
return True


@register.filter
def is_page(value):
return isinstance(value, Page)


@register.filter
def debug_print(value):
print(value)
print(f"~~{value}~~")
print(type(value))
# print(vars(value))
return value
2 changes: 1 addition & 1 deletion djnd/shop/templates/shop/shop.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="mb-6 last:mb-0 text-5xl font-semibold">{% translate "Trgovina" %}</h1
...
</div>
</div>
<div class="basis-4/12"></div>
<div class="basis-4/12">&nbsp;</div>
</div>
</div>

Expand Down

0 comments on commit fbae17b

Please sign in to comment.