Use HF detail image from backend

This commit is contained in:
Christian Cueni 2022-11-07 11:39:25 +01:00
parent f6d46d077d
commit 9a2675cd16
9 changed files with 25 additions and 20 deletions

View File

@ -82,8 +82,8 @@ function hasMoreItemsForType<T>(itemType: MediaBlockType, items: T[]) {
</div> </div>
<div> <div>
<img <img
class="hidden md:block float-left lg:float-right md:mt-8 lg:mt-0" class="hidden md:block float-left lg:float-right md:mt-8 lg:mt-0 lg:max-w-[505px]"
:src="'/static/icons/demo/category-large.png'" :src="`/static/icons/demo/${mediaCategory.detail_image}.png`"
alt="" alt=""
/> />
</div> </div>

View File

@ -255,6 +255,7 @@ export interface MediaContentCollection {
export interface MediaCategoryPage extends BaseCourseWagtailPage { export interface MediaCategoryPage extends BaseCourseWagtailPage {
type: "media_library.MediaCategoryPage"; type: "media_library.MediaCategoryPage";
overview_icon: string; overview_icon: string;
detail_image: string;
introduction_text: string; introduction_text: string;
description_title: string; description_title: string;
description_text: string; description_text: string;

View File

@ -42,10 +42,12 @@ def create_default_media_library():
] ]
for idx, cat in enumerate(course.coursecategory_set.all()): for idx, cat in enumerate(course.coursecategory_set.all()):
overview_icon = icons[(idx + len(icons) - 1) % len(icons)] overview_icon = icons[(idx + len(icons) - 1) % len(icons)]
detail_image = overview_icon.replace("icon", "image")
if cat.title == "Fahrzeug": if cat.title == "Fahrzeug":
media_category = MediaCategoryPageFactory( media_category = MediaCategoryPageFactory(
overview_icon=overview_icon, overview_icon=overview_icon,
detail_image=detail_image,
title=cat.title, title=cat.title,
course_category=cat, course_category=cat,
parent=media_lib_page, parent=media_lib_page,
@ -177,6 +179,7 @@ die der Fahrzeugbesitzer und die Fahrzeugbesitzerin in einem grösseren Schadenf
elif cat.title == "Reisen": elif cat.title == "Reisen":
media_category = MediaCategoryPageFactory( media_category = MediaCategoryPageFactory(
overview_icon=overview_icon, overview_icon=overview_icon,
detail_image=detail_image,
title=cat.title, title=cat.title,
course_category=cat, course_category=cat,
parent=media_lib_page, parent=media_lib_page,

View File

@ -0,0 +1,17 @@
# Generated by Django 4.0.8 on 2022-11-07 09:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("media_library", "0002_alter_mediacategorypage_body"),
]
operations = [
migrations.AddField(
model_name="mediacategorypage",
name="detail_image",
field=models.CharField(default="image-hf-fahrzeug", max_length=255),
),
]

View File

@ -61,6 +61,7 @@ class MediaCategoryPage(Page):
) )
overview_icon = models.CharField(max_length=255, default="icon-hf-fahrzeug") overview_icon = models.CharField(max_length=255, default="icon-hf-fahrzeug")
detail_image = models.CharField(max_length=255, default="image-hf-fahrzeug")
body = fields.StreamField( body = fields.StreamField(
[("content_collection", MediaContentCollection())], [("content_collection", MediaContentCollection())],
@ -96,6 +97,7 @@ class MediaCategoryPage(Page):
"course_category", "course_category",
"introduction_text", "introduction_text",
"overview_icon", "overview_icon",
"detail_image",
"description_title", "description_title",
"description_text", "description_text",
"items", "items",

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 54 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 KiB