Reputation: 21
I'm not completely new to Lektor but its a few years ago that I worked with it the last time. Now I have the problem that the flowblock is shown in the admin view but not in the content view.
speisekarte.html
{% extends "layout.html" %}
{% block title %}{{ this.title }}{% endblock %}
{% block body %}
<nav>
<table class="nav navbar-nav">
<tr>
{% for href, title in [
['/speisekarte', 'Salate'],
['/speisekarte/vorspeise', 'Vorspeise'],
['/speisekarte/suppen', 'Suppen'],
] %}
<td{% if this.is_child_of(href) %} class="active"{% endif
%}><a href="{{ href|url }}">{{ title }}</a></td>
{% endfor %}
</tr>
</table>
</nav>
<!--<h2>{{ this.title }}</h2>-->
{{ this.body }}
{% for blk in this.demo_flow.blocks %}
<div class="block block-{{ blk._flowblock }}">
{{ blk }}
</div>
{% endfor %}
speisekarte.ini
[model]
name = Speisekarte
label = {{ this.title }}
[fields.title]
label = Title
type = string
[fields.salat]
lable = Salat
type = flow
flow_blocks = Text Block
gericht.html
<div class="text-block text-block-{{ this.class }}">
{{ this.text }}
</div>
gericht.ini
[block]
name = Text Block
button_label = Text
[fields.text]
label = Name
type = markdown
[fields.preis]
label = Preis
type = markdown
[fields.inhalt]
label = Inhalt
type = markdown
[fields.class]
label = Class
type = select
choices = centered
choice_labels = Centered
default = centered
Upvotes: 2
Views: 41
Reputation: 311
Shouldn't this.demo_flow.blocks
be this.salat.blocks
?
Also, you can define a template file per block:
templates/blocks/block-text.html
:
<div class="block block-text">
{{ this.content }}
</div>
and then, in your main template just use {{ this.salat }}
on the flow, which will render all flow blocks separately.
Upvotes: 0