featured section has functionality

This commit is contained in:
Christoph J. Scherr 2023-06-04 20:48:45 +02:00
parent c708cd1d03
commit 4b6930acf3
Signed by: PlexSheep
GPG Key ID: 25B4ACF7D88186CC
6 changed files with 26 additions and 11 deletions

View File

@ -1,23 +1,38 @@
{% load i18n %} {% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<div class="container-lg mt-5"> <div class="container-lg mt-5">
<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-3" style="width: 18rem;"> <div class="card mx-2 p-0" style="width: 18rem;">
<img src="https://static.cscherr.de/images/profile/profile-margin-downscaled.png" class="card-img-top" alt="..."> <img src="{{ post.thumbnail.url }}" class="card-img-top img-fluid m-auto d-block mt-0" style="max-height: 45%;" alt="thumbnail">
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Card title<small class="text-body-secondary">sus</small></h5> {% if LANGUAGE_CODE == "de" %}
<h5 class="card-title">{{ post.title_de }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5>
<p class="card-text">{{ post.desc_de }}</p>
{% elif LANGUAGE_CODE == "en" %}
<h5 class="card-title">{{ post.title_en }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5>
<p class="card-text">{{ post.desc_en }}</p>
{% else %}
<h5 class="card-title">{{ post.title_en }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5>
<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 %}
</div> </div>
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
<li class="list-group-item">An item</li> <li class="list-group-item">{% translate "category" %}: <b>{{ post.category.name }}</b></li>
<li class="list-group-item">A second item</li> {% for keyword in post.keywords.all %}
<li class="list-group-item">A third item</li> {% if LANGUAGE_CODE == "de" %}
<li class="list-group-item">{{ keyword.text_de }}</li>
{% elif LANGUAGE_CODE == "en" %}
<li class="list-group-item">{{ keyword.text_en }}</li>
{% else %}
<li class="list-group-item">{{ keyword.text_en }}</li>
{% endif %}
{% 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 class="card-body">
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -15,7 +15,7 @@
<a class="nav-link" aria-current="page" href="{% url 'start:index' %}">{% translate "Start" %}</a> <a class="nav-link" aria-current="page" href="{% url 'start:index' %}">{% translate "Start" %}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'blog:index' %}">{% translate "Blog" %}</a> <a class="nav-link active" href="{% url 'blog:index' %}">{% translate "Blog" %}</a>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB