Commit d5261ca4 authored by gijs's avatar gijs
Browse files

Separate pages for trajectories without a produser

parent 9222ee77
......@@ -101,6 +101,7 @@ def generate ():
os.mkdir(os.path.join(outputdir, 'tags'))
os.mkdir(os.path.join(outputdir, 'notes'))
os.mkdir(os.path.join(outputdir, 'questions'))
os.mkdir(os.path.join(outputdir, 'trajectories'))
models = parse_pads()
......@@ -199,6 +200,10 @@ def generate ():
'grouped_trajectories': grouped_trajectories
})
for trajectory in trajectories.models:
if not trajectory.produser.value:
output(os.path.join(outputdir, trajectory.prefix, '{}.html'.format(keyFilter(trajectory.title))), 'trajectory.html', lambda t: { 'trajectory': t })
## Questions
output(
os.path.join(outputdir, 'questions.html'),
......
......@@ -836,6 +836,13 @@ class Trajectory (Model):
'title': fields.Single(fields.StringField())
}
@property
def link (self):
if self.title.value:
return os.path.join(SITE_URL, self.prefix, '{}.html'.format(keyFilter(self.title.value)))
else:
return self.produser.target.link
class Pad (Model):
contentType = 'pad'
......
......@@ -48,7 +48,7 @@
<section class="trajectory--item">
{% if trajectory.title.value %}
<h2 class="produser">
{{ trajectory.title }}
<a href="{{ trajectory.link }}">{{ trajectory.title }}</a>
</h2>
{% else %}
<h2>
......@@ -60,7 +60,8 @@
{% else %}
{{ trajectory.content|truncatewords_html:60 }}
{% endif %}
<a href="{{ trajectory.produser.target.link }}" class="read-further">read further</a>
<a href="{{ trajectory.link }}" class="read-further">read further</a>
</section>
{% endfor %}
</section>
......
{% extends "generator_base.html" %}
{% block title %}Caveat → Trajectories → {{ trajectory.title|striptags }}{% endblock %}
{% block content %}
<nav class="breadcrumbs">
<ul>
<li><a href="../trajectories.html">Trajectories</a></li>
<li>{{ trajectory.title }}</li>
</ul>
</nav>
<section class="long-text">
<h1>{{ trajectory.title }}</h1>
{{ trajectory.content }}
</section>
{% endblock %}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment