Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
osp
tools.ethertoff
Commits
d5261ca4
Commit
d5261ca4
authored
Nov 13, 2019
by
gijs
Browse files
Separate pages for trajectories without a produser
parent
9222ee77
Changes
4
Hide whitespace changes
Inline
Side-by-side
generator/management/commands/generate.py
View file @
d5261ca4
...
...
@@ -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'
),
...
...
generator/models.py
View file @
d5261ca4
...
...
@@ -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'
...
...
generator/templates/trajectories.html
View file @
d5261ca4
...
...
@@ -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>
...
...
generator/templates/trajectory.html
0 → 100644
View file @
d5261ca4
{% 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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment