blog-browse #40

Merged
PlexSheep merged 17 commits from blog-browse into devel 2023-10-08 14:46:09 +02:00
3 changed files with 21 additions and 14 deletions
Showing only changes of commit 917e6b6167 - Show all commits

View File

@ -110,7 +110,6 @@
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="container-fluid p-0 w-100 h-100"> <div class="container-fluid p-0 w-100 h-100">
<div class="row gap-3">
{% if is_empty %} {% if is_empty %}
<div class="text-center"> <div class="text-center">
<img src="/media/img/http/404.svg" <img src="/media/img/http/404.svg"
@ -120,8 +119,9 @@
<h2 class="display-5">{% trans "No posts found for your filters." %}</h2> <h2 class="display-5">{% trans "No posts found for your filters." %}</h2>
</div> </div>
{% else %} {% else %}
<div class="row gap-3 cardrow">
{% for post in posts %} {% for post in posts %}
<div class="card col mx-auto my-2 py-2" style="min-width: 400px;"> <div class="card col mx-auto my-2 py-2">
<a class="text-reset link-offset-2 link-underline link-underline-opacity-0" <a class="text-reset link-offset-2 link-underline link-underline-opacity-0"
href=" {% url 'blog:post' post.category.slug post.slug %}"> href=" {% url 'blog:post' post.category.slug post.slug %}">
<img src="{{ post.thumbnail.url }}" <img src="{{ post.thumbnail.url }}"
@ -173,9 +173,9 @@
</a> </a>
</div> </div>
{% endfor %} {% endfor %}
</div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div>
{% endblock main %} {% endblock main %}

View File

@ -3,7 +3,7 @@
{% get_current_language as LANGUAGE_CODE %} {% 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 row-cols-6 gap-1"> <div class="row gap-1 cardrow">
{% for post in featured_posts %} {% for post in featured_posts %}
<div class="card col mx-auto my-2"> <div class="card col mx-auto my-2">
<a class="text-reset link-offset-2 link-underline link-underline-opacity-0" <a class="text-reset link-offset-2 link-underline link-underline-opacity-0"

View File

@ -58,3 +58,10 @@ document.querySelectorAll(".reset-empty-button").forEach((element) => {
element.form.reset(); element.form.reset();
}; };
}); });
// smaller cards depending on viewport
document.querySelectorAll(".cardrow").forEach((element) => {
var level = Math.min(Math.floor(screen.width / 200), 6);
console.log(level);
element.classList.add("row-cols-" + level);
});