Commit dfacc6cb authored by Dave Kliczbor's avatar Dave Kliczbor
Browse files

Added Bulk deletion of signs

parent 8333ac28
......@@ -234,10 +234,7 @@ def printout():
flash(u'Ungültige Anzahl Kopien!')
return redirect(url_for('index'))
@app.route('/delete', methods=['POST'])
def delete():
filename = secure_filename(request.form['filename'])
def delete_file(filename):
try:
os.unlink(os.path.join(config.datadir, filename))
for f in glob.glob(os.path.join(config.pdfdir, filename + '.pdf*')):
......@@ -249,6 +246,16 @@ def delete():
return redirect(url_for('schild', filename=filename))
@app.route('/delete', methods=['POST'])
def delete():
return delete_file(secure_filename(request.form['filename']))
@app.route('/deletelist', methods=['POST'])
def deletelist():
for filename in request.form.getlist('filenames'):
delete_file(secure_filename(filename))
return redirect(url_for('index'))
@app.route('/image/<imgname>')
def image(imgname):
imgpath = os.path.join(config.imagedir, secure_filename(imgname))
......
......@@ -92,24 +92,22 @@ form li {
list-style-type:none;
display: inline-block;
}
input[type="radio"] {
input[type="radio"], input[type="checkbox"] {
position:relative;
z-index:5;
margin-bottom:0;
margin:0;
}
input[type="radio"]+label > img {
input[type="radio"]+label > img,
input[type="checkbox"]+a > img {
position:relative;
z-index:4;
top:0;
left:-1.4em;
margin-right:-1.2em;
margin-left:-1.2em;
max-width: 100%;
max-height: 10em;
border:3px solid lightgray;
border-radius: 5px;
}
input[type="radio"]:checked+label > img {
border:3px dotted red;
border:3px solid red;
}
input[type="radio"] + input[type="file"] {
display:none;
......
......@@ -63,15 +63,13 @@
</ul>
</div>
<br/>
<div class="box">
<py:if test="defined('form') and len(form.filename) > 5">
<input type="hidden" name="filename" value="${form.filename}"/>
<div class="box">
<input id="form:reusefilename" type="checkbox" name="reusefilename"/>
<label for="form:reusefilename">Änderungen unter gleichem Dateinamen speichern: ${form.filename}</label>
</div>
<label for="form:reusefilename">Überschreibe bisherige Version von ${form.filename}.</label>
<br/>
</py:if>
<div class="box">
<input type="submit" value="Schild erstellen"/>
</div>
</form>
......
......@@ -16,9 +16,17 @@
<a href="${ url_for('edit') }">Neues Schild</a>
<py:if test="defined('files')">
<ul class="list">
<li py:for="file in files"><a href="${ url_for('schild', filename=file) }" title="${file}"><img src="${ url_for('pdfthumbnail', pdfname=file+'.pdf', maxgeometry=150) }"/></a></li>
<form method="POST" action="/deletelist">
<ul>
<li py:for="file in files">
<input id="form:${file}" type="checkbox" name="filenames" value="${file}"/>
<a href="${ url_for('schild', filename=file) }" title="${file}">
<img src="${ url_for('pdfthumbnail', pdfname=file+'.pdf', maxgeometry=150) }"/>
</a>
</li>
</ul>
<input type="submit" value="Ausgewählte Schilder löschen"/>
</form>
</py:if>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment