cards are pretty good now

This commit is contained in:
Christoph J. Scherr 2023-06-04 23:14:29 +02:00
parent 9e28fbad2b
commit 1ec6813323
Signed by: PlexSheep
GPG Key ID: 25B4ACF7D88186CC
5 changed files with 63 additions and 27 deletions

View File

@ -4,9 +4,10 @@
<h4 class="">{% trans "Featured" %}</h4> <h4 class="">{% trans "Featured" %}</h4>
<div class="row my-4"> <div class="row my-4">
{% for post in featured_posts %} {% for post in featured_posts %}
<div class="card mx-2 p-0" style="width: 18rem;"> <div class="card m-2 p-0" style="width: 18rem;">
<img src="{{ post.thumbnail.url }}" class="card-img-top img-fluid m-auto d-block mt-0" style="max-height: 45%;" alt="thumbnail"> <a class="text-reset link-offset-2 link-underline link-underline-opacity-0" href=" {% url 'blog:post' post.category.slug post.slug %}">
<div class="card-body"> <img src="{{ post.thumbnail.url }}" class="card-img-top img-fluid" style="max-height: 150px;" alt="thumbnail">
<div class="card-body" style="height: 100px;">
{% if LANGUAGE_CODE == "de" %} {% if LANGUAGE_CODE == "de" %}
<h5 class="card-title">{{ post.title_de }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5> <h5 class="card-title">{{ post.title_de }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5>
<p class="card-text">{{ post.desc_de }}</p> <p class="card-text">{{ post.desc_de }}</p>
@ -18,6 +19,7 @@
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
{% endif %} {% endif %}
</div> </div>
<div class="container pt-5">
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
<li class="list-group-item">{% translate "category" %}: <b>{{ post.category.name }}</b></li> <li class="list-group-item">{% translate "category" %}: <b>{{ post.category.name }}</b></li>
{% for keyword in post.keywords.all %} {% for keyword in post.keywords.all %}
@ -29,11 +31,10 @@
<li class="list-group-item">{{ keyword.text_en }}</li> <li class="list-group-item">{{ keyword.text_en }}</li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<li class="list-group-item">
<a class="" href=" {% url 'blog:post' post.category.slug post.slug %}">{% translate "go to blogpost" %}</a>
</li>
</ul> </ul>
</div> </div>
</a>
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 MiB

View File

@ -0,0 +1,35 @@
# Generated by Django 3.2.19 on 2023-06-04 21:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('start', '0003_searchable_public'),
]
operations = [
migrations.AlterModelOptions(
name='keyword',
options={'verbose_name': 'Keyword', 'verbose_name_plural': 'keywords'},
),
migrations.AlterModelOptions(
name='searchable',
options={'verbose_name': 'Searchable', 'verbose_name_plural': 'Searchables'},
),
migrations.AlterModelOptions(
name='staticsite',
options={'verbose_name': 'static site', 'verbose_name_plural': 'static sites'},
),
migrations.AlterField(
model_name='searchable',
name='desc_de',
field=models.CharField(default='Beschreibung DE', max_length=250),
),
migrations.AlterField(
model_name='searchable',
name='desc_en',
field=models.CharField(default='Description EN', max_length=250),
),
]

View File

@ -30,8 +30,8 @@ class Searchable(models.Model):
title_en = models.CharField(max_length=50, default="title en") title_en = models.CharField(max_length=50, default="title en")
subtitle_de = models.CharField(max_length=50, blank=True) subtitle_de = models.CharField(max_length=50, blank=True)
subtitle_en = models.CharField(max_length=50, blank=True) subtitle_en = models.CharField(max_length=50, blank=True)
desc_de = models.CharField(max_length=250, unique=True, default="Beschreibung DE") desc_de = models.CharField(max_length=250, unique=False, default="Beschreibung DE")
desc_en = models.CharField(max_length=250, unique=True, default="Description EN") desc_en = models.CharField(max_length=250, unique=False, default="Description EN")
# may be empty/blank for some entries # may be empty/blank for some entries
date = models.DateField(blank=True, null=True) date = models.DateField(blank=True, null=True)
keywords = models.ManyToManyField(Keyword) keywords = models.ManyToManyField(Keyword)