gallery template
This commit is contained in:
10
__init__.py
10
__init__.py
@@ -24,6 +24,11 @@ app.config.from_object(__name__)
|
|||||||
|
|
||||||
def list_dir(mypath):
|
def list_dir(mypath):
|
||||||
return [f for f in os.listdir(mypath) if isfile(os.path.join(mypath, f)) and re.match('.*\.md.*',f) is None]
|
return [f for f in os.listdir(mypath) if isfile(os.path.join(mypath, f)) and re.match('.*\.md.*',f) is None]
|
||||||
|
|
||||||
|
def list_img(mypath):
|
||||||
|
return [f for f in os.listdir(mypath) if isfile(os.path.join(mypath, f)) and re.match('.*\.jpg',f) is not None]
|
||||||
|
|
||||||
|
|
||||||
def get_sub_pages(path, page):
|
def get_sub_pages(path, page):
|
||||||
ppath=page.path
|
ppath=page.path
|
||||||
cc=len(path.split('/'))
|
cc=len(path.split('/'))
|
||||||
@@ -95,17 +100,18 @@ def post(name='index'):
|
|||||||
|
|
||||||
if is_index == True and not page is None:
|
if is_index == True and not page is None:
|
||||||
ld=list_dir(path2)
|
ld=list_dir(path2)
|
||||||
|
il=list_img(path2)
|
||||||
sp=get_sub_pages(path,page)
|
sp=get_sub_pages(path,page)
|
||||||
spi=get_sub_ipages(path,page)
|
spi=get_sub_ipages(path,page)
|
||||||
else:
|
else:
|
||||||
ld=[]
|
ld=[]
|
||||||
sp=[]
|
sp=[]
|
||||||
spi=[]
|
spi=[]
|
||||||
|
il=[]
|
||||||
if not page is None:
|
if not page is None:
|
||||||
page_defaults(page,is_index,path)
|
page_defaults(page,is_index,path)
|
||||||
app.logger.info("Render Template"+page["template"] +"for "+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, pagebreadcrumbs=get_bc(path,page))
|
return render_template(page.meta["template"], ld=ld, post=page, sp=sp, spi=spi, il=il, pth=path, pagebreadcrumbs=get_bc(path,page))
|
||||||
|
|
||||||
if os.path.exists(u'{}/{}'.format(FLATPAGES_ROOT,path)):
|
if os.path.exists(u'{}/{}'.format(FLATPAGES_ROOT,path)):
|
||||||
return send_from_directory(FLATPAGES_ROOT,path)
|
return send_from_directory(FLATPAGES_ROOT,path)
|
||||||
|
|||||||
44
templates/gallery.html
Normal file
44
templates/gallery.html
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/Gallery/css/blueimp-gallery.min.css">
|
||||||
|
<script src="/Gallery/js/blueimp-gallery.min.js"></script>
|
||||||
|
<style>
|
||||||
|
#links a {
|
||||||
|
margin-left: -2px;
|
||||||
|
margin-right:-2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="blueimp-gallery" class="blueimp-gallery">
|
||||||
|
<div class="slides"></div>
|
||||||
|
<h3 class="title"></h3>
|
||||||
|
<a class="prev">‹</a>
|
||||||
|
<a class="next">›</a>
|
||||||
|
<a class="close">×</a>
|
||||||
|
<a class="play-pause"></a>
|
||||||
|
<ol class="indicator"></ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1>{{post.title}}</h1>
|
||||||
|
<div id="links">
|
||||||
|
{% for d in il %}
|
||||||
|
<a href="/{{pth}}/{{d}}">
|
||||||
|
<img src="/{{pth}}/{{d}}" width="80" height="80" alt="">
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('links').onclick = function (event) {
|
||||||
|
event = event || window.event;
|
||||||
|
var target = event.target || event.srcElement,
|
||||||
|
link = target.src ? target.parentNode : target,
|
||||||
|
options = {index: link, event: event},
|
||||||
|
links = this.getElementsByTagName('a');
|
||||||
|
blueimp.Gallery(links, options);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
24
templates/layout.html
Normal file
24
templates/layout.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<LINK href="/bootstrap/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 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>
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,35 +1,37 @@
|
|||||||
<LINK href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
{% extends "layout.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
<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>
|
<h1>{{post.title}}</h1>
|
||||||
{{post.date}}
|
{{post.date}}
|
||||||
{{ post.html|safe }}
|
{{ post.html|safe }}
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
|
{% if spi|length > 0 %}
|
||||||
|
<hr>
|
||||||
<b id="up_head"> Unterordner: </b>
|
<b id="up_head"> Unterordner: </b>
|
||||||
<ul class="nav flex-column" labeledby="uo_head">
|
<ul class="nav flex-column flex-sm-row " labeledby="up_head">
|
||||||
{% for d in spi %}
|
{% for d in spi %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{url_for('post',name=d['path'])}}" class="nav-link">{{d.title}} {{'/'.join(d.path.split('/')[-2:-1])}}</a>
|
<a href="{{url_for('post',name=d['path'])}}" class="nav-link">
|
||||||
|
<h6> {{d.title}} <small class="text-muted">{{'/'.join(d.path.split('/')[-2:-1])}} </small>
|
||||||
|
</h6>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% endif %}
|
||||||
<hr>
|
<hr>
|
||||||
Info:
|
|
||||||
<ul>
|
<b id="inf_head"> Info: </b>
|
||||||
|
<ul class="nav flex-column flex-sm-row " labeledby="inf_head">
|
||||||
|
|
||||||
{% for d in sp %}
|
{% for d in sp %}
|
||||||
<li>
|
<li class="nav-item">
|
||||||
<a href="{{url_for('post',name=d.path)}}">{{d.title}} </a>
|
<a href="{{url_for('post',name=d['path'])}}" class="nav-link">
|
||||||
|
<h6> {{d.title}} <small class="text-muted">{{d.path.split('/')[-1]}} </small>
|
||||||
|
</h6>
|
||||||
|
</a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -42,6 +44,4 @@ Files:
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
{% endblock %}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user