fix layout fet

This commit is contained in:
root
2020-09-26 12:08:18 +00:00
16 changed files with 89 additions and 46 deletions

View File

@@ -1,25 +0,0 @@
[uwsgi]
# User and group www-data on debian
uid = 33
gid = 33
master = true
# No. of processes can be increased
processes = 9
chown-socket =www-data:www-data
virtualenv = /opt/venv
pythonpath = /srv/flask-fet-fotos/
#pidfile = /srv/simple_sample_flat_index/uwsgi.pid
#socket = /srv/simple_sample_flat_index/uwsgi.sock
pidfile=/var/run/fet_fotos.pid
socket = /var/run/fet_fotos.sock
chmod-socket = 666
module = foto_gallery
callable= app
wsgi-file = run.py
logdate = true
loglevel = debug
gevent = 100
vacuum=true
plugins=python3,logfile
py-autoreload=2

25
blueimp/.github/workflows/nodejs.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Node CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm test
env:
CI: true

1
blueimp/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

View File

@@ -1,6 +0,0 @@
pages_root: 'data_sample'
static_root: 'static'
default_template: 'page.html'
url_prefix: "/stuff"
FLATPAGES_EXTENSION: ".md"
FLATPAGES_AUTO_RELOAD: True

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -0,0 +1,4 @@
title: ghg Title
author: andis
Asdf Asdf

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -15,8 +15,8 @@ import re
from PIL import Image, ExifTags, ImageOps
from functools import partial
from flask_csp.csp import csp_header, csp_default
import slugify
#cfg = Config("./config.cfg")
import environ
env = environ.Env(
# set casting, default value
@@ -45,11 +45,16 @@ app.logger.setLevel(logging.DEBUG)
# Initialize FlatPages Index
flatpages = FlatPagesIndex(app)
flatpages_index.Links.endpoint="intern.post"
flatpages_index.Links.image_url=lambda s,x: url_for(s.endpoint,name=x)
flatpages_index.Links.thumb_url=lambda s,x: url_for("intern.thumb",size=128,name=x)
flatpages_index.Links.image_url=lambda s,x: url_for("intern.post",name=x)
flatpages_index.Page.page_defaults={"type":"gallery", "template":"gallery.html"}
flatpages.cfg("url", lambda s,x: url_for("intern.post",name=x))
flatpages.cfg("thumb_url", lambda s,x: url_for("intern.thumb",size=512,name=x))
flatpages.get('index')
app.logger.info('Initialize FET Foto Gallery App')
@@ -57,17 +62,25 @@ app.logger.info('flatpages loaded %d pages' % len(flatpages._pages))
app.logger.info("Data directory is: %s" % flatpages.root)
#csp_d=csp_default()
#csp_d.update({'default-src':"'self' 'unsafe-inline'", 'script-src': "'unsafe-inline' 'self'"})
freezer = Freezer(app)
page_blueprint = Blueprint('intern', __name__)
api_blueprint = Blueprint('api', __name__)
@app.template_filter()
def thumbimage(post):
if post.thumb_url:
return post.thumb_url
elif len(post.images)>0:
return post.images[0]
@app.template_filter()
def slug(string):
return slugify.slugify(string)
@page_blueprint.route('/thumb<int:size>/<path:name>')
def thumb(size=64,name=''):
if not size in [32,64,128,256,512]:
@@ -150,6 +163,8 @@ def postjson(name='index'):
app.register_blueprint(page_blueprint, url_prefix=app.config["url_prefix"],static_folder='static')
app.register_blueprint(api_blueprint, url_prefix="/api/"+app.config["url_prefix"],static_folder='static')
app.add_url_rule('%s/<path:name>' % app.config["url_prefix"],'page', post)

View File

@@ -8,7 +8,7 @@
{% block content %}
<h1>{{post.title}}</h1>
<small> von {{post.author}} </small>
<a href="/members/member/{{post.author}}"><small> von {{post.author}} </small>
{{post.html | safe}}
{% if post.links.images |length > 0 %}

View File

@@ -24,13 +24,13 @@
<div class="top-bar" id="main-menu">
<div class="top-bar-left"><a href="/">
<img style="height:40px; width:40px" src="/assets/img/logo2014_64.png"/></a>
<img style="height:40px; width:40px" src="/fotos/img/logo2014_64.png"/></a>
</div>
<div class="top-bar-right">
<ul class="menu vertical medium-horizontal expanded medium-text-center">
<li class=""><a href="/">Home</a> </li>
<li class=""><a href="/">Aktuelles</a> </li>
<li class=""><a href="#">Info</a> </li>
<li class=""><a href="/fotos">Fotos</a> </li>
<li class=""><a href="#">Team</a>
</li>
</ul>

View File

@@ -6,3 +6,4 @@ Pillow
wheel
flask_csp
git+https://github.com/andreassteph/flatpages_index.git
python-slugify

2
run.py
View File

@@ -5,5 +5,5 @@ if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "build":
freezer.freeze()
else:
app.run(host='0.0.0.0',port=4444, debug=True)
app.run(host='0.0.0.0',port=8002, debug=True)

1
static/img Symbolic link
View File

@@ -0,0 +1 @@
design/static/img

View File

@@ -9,6 +9,30 @@ $(
link = target.src ? target.parentNode : target,
options = { index: link, event: event },
links = this.getElementsByTagName('a')
blueimp.Gallery(links, options)
options['onslide']=function(index,slide) {
console.log(index)
console.log($(`#links a:nth-child(${index})`).attr('id'))
history.replaceState(null,null,'#'+$(`#links a:nth-child(${index+1})`).attr('id'))
}
options['onclose']=function(){
history.pushState(null,null,'#')
}
blueimp.gallery=blueimp.Gallery(links, options)
}
window.onpopstate = function(){
console.log(`popped state ${$(location).attr('hash')}`)
if($(location).attr('hash')=="") {
blueimp.gallery.close()
}else {
$($(location).attr('hash')).trigger('click');
}
}
console.log($(location).attr('hash').substr(1))
$($(location).attr('hash')).trigger('click');
})

View File

@@ -4,3 +4,6 @@ gid = 101
module = main
callable = app
venv=/opt/venv
vacuum=true
plugins=python3,logfile
py-autoreload=2