tests added
This commit is contained in:
@@ -6,11 +6,11 @@ import flatpages_index
|
||||
def create_bp(app):
|
||||
|
||||
flatpages = FlatPagesIndex(app)
|
||||
flatpages_index.Links.endpoint="stuff.page"
|
||||
flatpages_index.Links.endpoint="pages.page"
|
||||
flatpages_index.Links.url=(lambda s,x: url_for(s.endpoint, name=x))
|
||||
#flatpages_index.Links.image_url=(lambda s,x: url_for('stuff.page', name=x))
|
||||
flatpages_index.Links.file_url=(lambda s,x: url_for('stuff.page', name=x))
|
||||
flatpages_index.Links.thumb_url=(lambda s,x: url_for('stuff.thumb', size=128,name=x))
|
||||
flatpages_index.Links.file_url=(lambda s,x: url_for('pages.page', name=x))
|
||||
flatpages_index.Links.thumb_url=(lambda s,x: url_for('pages.thumb', size=128,name=x))
|
||||
|
||||
flatpages.get('index')
|
||||
app.logger.debug('flatpages loaded %d pages' % len(flatpages._pages))
|
||||
@@ -28,7 +28,7 @@ def create_bp(app):
|
||||
|
||||
if page:
|
||||
page["has_img"]=True
|
||||
page.links.endpoint='stuff.page'
|
||||
page.links.endpoint='pages.page'
|
||||
return render_template(page["template"], post=page,
|
||||
pth=page["dirpath"])
|
||||
|
||||
@@ -45,7 +45,7 @@ def create_bp(app):
|
||||
page = flatpages.get(name)
|
||||
if not page is None:
|
||||
page["has_img"]=False
|
||||
page.links.endpoint='stuff.pagejson'
|
||||
page.links.endpoint='pages.pagejson'
|
||||
# page.links.file_url=lambda n: url_for('intern.post', name=n)
|
||||
return jsonify(page=dict(page))
|
||||
|
||||
|
||||
25
flaskpages/templates/layout.html
Normal file
25
flaskpages/templates/layout.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{# -*-jinja2-*- #}
|
||||
<html>
|
||||
<head></head>
|
||||
<LINK href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<nav class="breadcrumb" style="background-color: #FFF">
|
||||
{% for b in post.links.breadcrumbs %}
|
||||
<a href="{#url_for('page',name=b.path)#}{{b.url}}" class="breadcrumb-item">{{b.title}} </a>
|
||||
{% endfor %}
|
||||
|
||||
</nav>
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
67
flaskpages/templates/page.html
Normal file
67
flaskpages/templates/page.html
Normal file
@@ -0,0 +1,67 @@
|
||||
{# -*-jinja2-*- #}
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{post.title}}</h1>
|
||||
{{post.date}}
|
||||
{% if post.links["subindexpages"] | length > 0 %}
|
||||
<hr/>
|
||||
<b id="up_head"> Unterseiten: </b>
|
||||
<ul class="nav flex-column flex-sm-row " labeledby="up_head">
|
||||
{% for d in post.links["subindexpages"] %}
|
||||
<li class="nav-item">
|
||||
<a href="{{d.url}}" class="nav-link">
|
||||
<h6> {{d.title}} <small class="text-muted">{{d.desc}} </small> </h6>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{{ post.html|safe }}
|
||||
|
||||
|
||||
{% if post.links["subpages"] |length > 0 %}
|
||||
<ul class="nav flex-column flex-sm-row" labeledby="inf_head">
|
||||
{% for d in post.sub_pages %}
|
||||
<li class="nav-item">
|
||||
<a href="{{d.url}}" class="nav-link text-info">
|
||||
<h6> {{d.title}} <small class="text-muted">{{d.desc}} </small>
|
||||
</h6>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if post.links["files"] |length > 0 %}
|
||||
|
||||
<hr/>
|
||||
|
||||
<b id="inf_head">Files:</b>
|
||||
<ul>
|
||||
{% for d in post.links.files %}
|
||||
<li>
|
||||
<a href="{{d.url}}">{{d.title}} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if post.links["images"] |length > 0 %}
|
||||
|
||||
<hr/>
|
||||
|
||||
<b id="inf_head">Images:</b>
|
||||
<ul>
|
||||
{% for d in post.links.images %}
|
||||
<li>
|
||||
<a href="{{d.url}}">{{d.title}} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
68
flaskpages/templates/page_plain.html
Normal file
68
flaskpages/templates/page_plain.html
Normal file
@@ -0,0 +1,68 @@
|
||||
{# -*-jinja2-*- #}
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{post.title}}</h1>
|
||||
{{post.date}}
|
||||
{% if post.links["subindexpages"] | length > 0 %}
|
||||
<hr/>
|
||||
<b id="up_head"> Unterseiten: </b>
|
||||
<ul class="nav flex-column flex-sm-row " labeledby="up_head">
|
||||
{% for d in post.links["subindexpages"] %}
|
||||
<li class="nav-item">
|
||||
<a href="{{d.url}}" class="nav-link">
|
||||
<h6> {{d.title}} <small class="text-muted">{{d.desc}} </small> </h6>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{{ post.html|safe }}
|
||||
|
||||
|
||||
{% if post.links.subpages |length > 0 %}
|
||||
hi
|
||||
<ul class="nav flex-column flex-sm-row" labeledby="inf_head">
|
||||
{% for d in post.links.subpages %}
|
||||
<li class="nav-item">
|
||||
<a href="{{d.url}}" class="nav-link text-info">
|
||||
<h6> {{d.title}} <small class="text-muted">{{d.desc}} </small>
|
||||
</h6>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if post.links["files"] |length > 0 %}
|
||||
|
||||
<hr/>
|
||||
|
||||
<b id="inf_head">Files:</b>
|
||||
<ul>
|
||||
{% for d in post.links.files %}
|
||||
<li>
|
||||
<a href="{{d.url}}">{{d.title}} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if post.links["images"] |length > 0 %}
|
||||
|
||||
<hr/>
|
||||
|
||||
<b id="inf_head">Images:</b>
|
||||
<ul>
|
||||
{% for d in post.links.images %}
|
||||
<li>
|
||||
<a href="{{d.url}}">{{d.title}} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
67
flaskpages/templates/title.html
Normal file
67
flaskpages/templates/title.html
Normal file
@@ -0,0 +1,67 @@
|
||||
{# -*-jinja2-*- #}
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{post.title}}</h1>
|
||||
{{post.date}}
|
||||
{% if post.links["subindexpages"] | length > 0 %}
|
||||
<hr/>
|
||||
<b id="up_head"> Unterseiten: </b>
|
||||
<ul class="nav flex-column flex-sm-row " labeledby="up_head">
|
||||
{% for d in post.links["subindexpages"] %}
|
||||
<li class="nav-item">
|
||||
<a href="{{d.url}}" class="nav-link">
|
||||
<h6> {{d.title}} <small class="text-muted">{{d.desc}} </small> </h6>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{{ post.html|safe }}
|
||||
|
||||
|
||||
{% if post.links["subpages"] |length > 0 %}
|
||||
<ul class="nav flex-column flex-sm-row" labeledby="inf_head">
|
||||
{% for d in post.sub_pages %}
|
||||
<li class="nav-item">
|
||||
<a href="{{d.url}}" class="nav-link text-info">
|
||||
<h6> {{d.title}} <small class="text-muted">{{d.desc}} </small>
|
||||
</h6>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if post.links["files"] |length > 0 %}
|
||||
|
||||
<hr/>
|
||||
|
||||
<b id="inf_head">Files:</b>
|
||||
<ul>
|
||||
{% for d in post.links.files %}
|
||||
<li>
|
||||
<a href="{{d.url}}">{{d.title}} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if post.links["images"] |length > 0 %}
|
||||
|
||||
<hr/>
|
||||
|
||||
<b id="inf_head">Images:</b>
|
||||
<ul>
|
||||
{% for d in post.links.images %}
|
||||
<li>
|
||||
<a href="{{d.url}}">{{d.title}} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user