wymiana lightbox, usunięcie jquery, zmiana na glightbox poprawa js i emitowanie wgrania z endpointy uploadu
This commit is contained in:
12
app.py
12
app.py
@@ -322,6 +322,10 @@ def internal_error(e):
|
||||
message="Wystąpił nieoczekiwany błąd. Spróbuj ponownie później."
|
||||
), 500
|
||||
|
||||
@app.route('/favicon.ico')
|
||||
def favicon_ico():
|
||||
return redirect(url_for('static', filename='favicon.svg'))
|
||||
|
||||
@app.route('/favicon.svg')
|
||||
def favicon():
|
||||
svg = '''
|
||||
@@ -631,6 +635,9 @@ def upload_receipt(list_id):
|
||||
|
||||
if request.is_json or request.headers.get('X-Requested-With') == 'XMLHttpRequest':
|
||||
url = url_for('uploaded_file', filename=full_filename)
|
||||
|
||||
socketio.emit('receipt_added', {'url': url}, to=str(list_id))
|
||||
|
||||
return jsonify({'success': True, 'url': url})
|
||||
|
||||
flash('Wgrano paragon', 'success')
|
||||
@@ -641,6 +648,7 @@ def upload_receipt(list_id):
|
||||
flash('Niedozwolony format pliku', 'danger')
|
||||
return redirect(request.referrer)
|
||||
|
||||
|
||||
@app.route('/uploads/<filename>')
|
||||
def uploaded_file(filename):
|
||||
response = send_from_directory(app.config['UPLOAD_FOLDER'], filename)
|
||||
@@ -1303,14 +1311,14 @@ def handle_add_expense(data):
|
||||
'total': total
|
||||
}, to=str(list_id))
|
||||
|
||||
@socketio.on('receipt_uploaded')
|
||||
""" @socketio.on('receipt_uploaded')
|
||||
def handle_receipt_uploaded(data):
|
||||
list_id = data['list_id']
|
||||
url = data['url']
|
||||
|
||||
emit('receipt_added', {
|
||||
'url': url
|
||||
}, to=str(list_id), include_self=False)
|
||||
}, to=str(list_id), include_self=False) """
|
||||
|
||||
@app.cli.command('create_db')
|
||||
def create_db():
|
||||
|
Reference in New Issue
Block a user