Adds dark mode

Fix compare int-str bug
Fix empty values error
Replace sort by attribute filter with direct order_by
additional make targets
This commit is contained in:
relikd
2020-07-15 15:30:22 +02:00
parent 7a8dd41492
commit 265c865b52
10 changed files with 69 additions and 26 deletions

View File

@@ -2,6 +2,12 @@
--cBg1: #FAF9F7; --cBg2: #EAE9E7; --cBg3: #9A9997;
--cRed1: #DC3A59; --cRed2: #AA203A; --cRed3: #EE6A84;
}
@media (prefers-color-scheme: dark) {
:root { --cTxt: #DDD;
--cBg1: #191816; --cBg2: #292725; --cBg3: #373635;
--cRed1: #B31; --cRed2: #F64; --cRed3: #FB9;
}
}
.center { text-align: center }
.small { font-size: 0.8em }
@@ -69,7 +75,7 @@ footer table { margin: -10px 0 }
*/
.tags { display: flex; flex-wrap: wrap; justify-content: center }
.tags > * {
background: #FFF;
background: var(--cBg1);
border: 1px solid var(--cRed1);
border-radius: 0.3em;
padding: 0.3em 0.5em;

View File

@@ -73,7 +73,8 @@ def group_by_time_cluster(dic, arr=[30, 60, 120], reverse=False):
except KeyError:
groups[key] = set()
groups[key].update(recipes)
return sorted(groups.items(), reverse=bool(reverse))
return sorted(groups.items(), reverse=bool(reverse),
key=lambda x: x[0] if x[0] != '' else 999999999)
class TimeDurationPlugin(Plugin):

View File

@@ -33,7 +33,7 @@ CACHE MANIFEST
{%- endfor -%}
{%- endif -%}
{% set img = x.attachments.images|sort(attribute='record_label')|first -%}
{% set img = x.attachments.images.order_by('record_label').first() -%}
{%- if img -%}
{{- _add_(cacheList, img.thumbnail(200, 150, 'crop')) -}}
{%- endif -%}

View File

@@ -2,7 +2,7 @@
<div class="tile-grid">
{%- for recipe in recipes -%}
{%- if limit == 0 or loop.index <= limit -%}
{%- set img = recipe.attachments.images|sort(attribute='record_label')|first -%}
{%- set img = recipe.attachments.images.order_by('record_label').first() -%}
<a href="{{ recipe|url }}">{#--#}
<div class="recipe-tile">

View File

@@ -4,7 +4,7 @@
<article class="recipe">
<!-- date added: {{ this.date }} -->
<section id="img-carousel" class="v-scroll center">
{%- for img in this.attachments.images|sort(attribute='record_label') %}
{%- for img in this.attachments.images.order_by('record_label') %}
<img class="lozad" data-src="{{ img|url }}" height="400">
{%- endfor %}
</section>

View File

@@ -3,6 +3,6 @@
{% block body %}
<h1>{{ localize(this.alt, 'title.latest') }}</h1>
<div class="latest">
{{ render_recipe_list(site.query('recipes', this.alt) | sort(attribute='date', reverse=True), limit=6) }}
{{ render_recipe_list(site.query('recipes', this.alt).order_by('-date', 'name'), limit=6) }}
</div>
{% endblock %}