This commit is contained in:
andis
2017-02-18 21:28:49 +01:00
2 changed files with 27 additions and 6 deletions

View File

@@ -38,6 +38,18 @@ def get_sub_ipages(path, page):
ps=[p for p in flatpages if p.path.startswith(path) and not ( re.match('.*index',p.path) is None) and ( re.match(ppath,p.path) is None) and len(p.path.split('/'))<=cc+2 ]
return ps
def get_bc(path, page):
ppath=page.path
elements=path.split('/')#[0:-1]
elements2=['index']
for i in range(0,len(elements)):
elements2.append(pjoin2(elements[0:i])+u'/index')
ps=[p for p in flatpages if p.path in elements2 ]
return ps
def get_flatpage(path):
is_index=False
if path == 'index' or path=='':
@@ -59,6 +71,8 @@ def get_flatpage(path):
def pjoin (rt,pth):
return u'{}/{}'.format(rt,pth)
def pjoin2 (pth):
return u'/'.join(pth) or u''
def misskey(a,key):
if not a.has_key(key):
@@ -91,7 +105,7 @@ def post(name='index'):
if not page is None:
page_defaults(page,is_index,path)
app.logger.info("Render Template"+page["template"] +"for "+path)
return render_template(page.meta["template"], ld=ld, post=page, sp=sp, spi=spi, pth=path)
return render_template(page.meta["template"], ld=ld, post=page, sp=sp, spi=spi, pth=path, pagebreadcrumbs=get_bc(path,page))
if os.path.exists(u'{}/{}'.format(FLATPAGES_ROOT,path)):
return send_from_directory(FLATPAGES_ROOT,path)

View File

@@ -1,19 +1,26 @@
<LINK href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<div class="container">
<div class="row">
<div class="col-12">
<nav class="breadcrumb" style="background-color: #FFF">
{% for b in pagebreadcrumbs %}
<a href="{{url_for('post',name=b.path)}}" class="breadcrumb-item">{{b.title}} </a>
{% endfor %}
<a href="{{url_for('post',name=post.path)}}" class="breadcrumb-item active">{{post.title}} </a>
</nav>
<h1>{{post.title}}</h1>
{{post.date}}
{{ post.html|safe }}
<br>
Unterordner:
<ul>
<b id="up_head"> Unterordner: </b>
<ul class="nav flex-column" labeledby="uo_head">
{% for d in spi %}
<li>
<a href="{{url_for('post',name=d['path'])}}">{{d.title}} {{'/'.join(d.path.split('/')[-2:-1])}}</a>
<li class="nav-item">
<a href="{{url_for('post',name=d['path'])}}" class="nav-link">{{d.title}} {{'/'.join(d.path.split('/')[-2:-1])}}</a>
</li>
{% endfor %}
</ul>