blog-browse #40
|
@ -14,113 +14,104 @@
|
|||
{% include 'nav.html' %}
|
||||
{% endblock nav %}
|
||||
{% block main %}
|
||||
<div class="container">
|
||||
<div class="row pb-5">
|
||||
<div class="col">
|
||||
<!-- <div class="position-absolute top-50 start-50 translate-middle"> -->
|
||||
<h1 class="">
|
||||
Browse
|
||||
<!-- TODO: tell the user what the filters are? -->
|
||||
</h1>
|
||||
<!-- </div> -->
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-5">
|
||||
<div class="col col-xxl mb-5">
|
||||
{# TODO: center in mobile view #}
|
||||
<h1 class="display-1">Browse</h1>
|
||||
</div>
|
||||
<div class="col">
|
||||
<form class="d-flex" role="search" action="" method="GET" novalidate>
|
||||
<div class="container overflow-hidden ">
|
||||
<div class="row gy-5">
|
||||
<div class="col">
|
||||
<input class="tagify" name="keywords" placeholder="{% trans "Keywords" %}">
|
||||
</div>
|
||||
<div class="col position-relative">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<input type="search"
|
||||
name="search"
|
||||
class="form-control me-2 flex-fill"
|
||||
aria-label="Search"
|
||||
placeholder="{% trans "Search" %}"
|
||||
required=""
|
||||
id="id_search">
|
||||
<div class="col">
|
||||
<div class="row mt-2">
|
||||
<div class="col col-xxl">
|
||||
<select class="form-select" aria-label="Large select example" name="category">
|
||||
<option value="" selected>{% trans "select category" %}</option>
|
||||
{% for category in categories %}<option value="{{ category.slug }}">{{ category.name }}</option>{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<button class="btn bg-primary fw-bold" type="submit">{% trans "Filter" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="container-fluid w-100 h-100 p-2">
|
||||
<form class="w-100 h-100" role="search" action="" method="GET" novalidate>
|
||||
<div class="py-2">
|
||||
<input type="search"
|
||||
name="search"
|
||||
class="form-control flex-fill py-2"
|
||||
aria-label="Search"
|
||||
placeholder="{% trans "Search" %}"
|
||||
required=""
|
||||
id="id_search">
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
<div class="py-2">
|
||||
<select class="form-select py-2"
|
||||
aria-label="Large select example"
|
||||
name="category">
|
||||
<option value="" selected>{% trans "select category" %}</option>
|
||||
{% for category in categories %}<option value="{{ category.slug }}">{{ category.name }}</option>{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="py-2">
|
||||
<input class="tagify" name="keywords" placeholder="{% trans "Keywords" %}">
|
||||
</div>
|
||||
<button class="btn bg-primary fw-bold py-2" type="submit">{% trans "Filter" %}</button>
|
||||
<script>
|
||||
// The DOM element you wish to replace with Tagify
|
||||
var input = document.querySelector('input[class=tagify]');
|
||||
// initialize Tagify on the above input node reference
|
||||
new Tagify(input)
|
||||
</script>
|
||||
</form>
|
||||
</script>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-6 gap-1">
|
||||
{% for post in posts %}
|
||||
<div class="card col mx-auto my-2">
|
||||
<a class="text-reset link-offset-2 link-underline link-underline-opacity-0"
|
||||
href=" {% url 'blog:post' post.category.slug post.slug %}">
|
||||
<img src="{{ post.thumbnail.url }}"
|
||||
class="card-img-top img-fluid mx-auto d-block"
|
||||
style="max-height: 150px;
|
||||
width: auto;
|
||||
padding-top: 8px"
|
||||
alt="thumbnail" />
|
||||
<div class="card-body" style="height: 100px">
|
||||
{% 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">{{ post.desc_en }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="container pt-5">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
{% translate "category" %}: <b>{{ post.category.name }}</b>
|
||||
</li>
|
||||
{% for keyword in post.keywords.all %}
|
||||
<div class="row mb-5">
|
||||
<div class="container-fluid p-0 w-100 h-100">
|
||||
<div class="row gap-3">
|
||||
{% for post in posts %}
|
||||
<div class="card col mx-auto my-2" style="min-width: 200px;">
|
||||
<a class="text-reset link-offset-2 link-underline link-underline-opacity-0"
|
||||
href=" {% url 'blog:post' post.category.slug post.slug %}">
|
||||
<img src="{{ post.thumbnail.url }}"
|
||||
class="card-img-top img-fluid mx-auto d-block"
|
||||
style="max-height: 150px;
|
||||
width: auto;
|
||||
padding-top: 8px"
|
||||
alt="thumbnail" />
|
||||
<div class="card-body" style="height: 100px">
|
||||
{% if LANGUAGE_CODE == "de" %}
|
||||
<li class="list-group-item">{{ keyword.text_de }}</li>
|
||||
<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" %}
|
||||
<li class="list-group-item">{{ keyword.text_en }}</li>
|
||||
<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 %}
|
||||
<li class="list-group-item">{{ keyword.text_en }}</li>
|
||||
<h5 class="card-title">
|
||||
{{ post.title_en }}<small class="text-body-secondary">{{ post.subtitle }}</small>
|
||||
</h5>
|
||||
<p class="card-text">{{ post.desc_en }}</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container pt-5">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
{% translate "category" %}: <b>{{ post.category.name }}</b>
|
||||
</li>
|
||||
{% for keyword in post.keywords.all %}
|
||||
{% 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 %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container p-1 text-center" style="border-top: solid">
|
||||
<li class="list-group-item">
|
||||
{% format_time post.date "%F" as date %}
|
||||
{% trans "published" %}: {{ date }}
|
||||
</li>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="container p-1 text-center" style="border-top: solid">
|
||||
<li class="list-group-item">
|
||||
{% format_time post.date "%F" as date %}
|
||||
{% trans "published" %}: {{ date }}
|
||||
</li>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock main %}
|
||||
</div>
|
||||
{% endblock main %}
|
||||
|
|
Loading…
Reference in New Issue