Maintenance

Fixed js error btn.PreventDefault is not a function
Fixed another bug where export would not happen after administrative action
Streamlined parameters
projects
Domeniko Gentner 4 years ago
parent 01b534f027
commit 698e1dee50
  1. 4
      js/labertasche.js
  2. 38
      labertasche/blueprints/bp_dashboard.py

@ -78,7 +78,5 @@ function labertasche_post_comment(btn, callback)
}) })
// Don't reload the page // Don't reload the page
if (btn) { return false;
btn.preventDefault();
}
} }

@ -45,55 +45,57 @@ def dashboard_index():
@bp_dashboard.route('/review-spam/', methods=["POST", "GET"]) @bp_dashboard.route('/review-spam/', methods=["POST", "GET"])
@bp_dashboard.route('/review-spam/<int:location>', methods=["POST", "GET"]) @bp_dashboard.route('/review-spam/<int:location_id>', methods=["POST", "GET"])
@login_required @login_required
def dashboard_review_spam(location=None): def dashboard_review_spam(location_id=None):
all_locations = db.session.query(TLocation).all() all_locations = db.session.query(TLocation).all()
# Check post # Check post
if request.method == "POST": if request.method == "POST":
location = request.form.get('selected_location') location_id = request.form.get('selected_location')
# no parameters found # no parameters found
if location is None: if location_id is None:
return render_template("review-spam.html", locations=all_locations, selected=location) return render_template("review-spam.html", locations=all_locations, selected=location_id)
try: try:
if int(location) >= 1: if int(location_id) >= 1:
spam_comments = db.session.query(TComments).filter(TComments.location_id == location)\ spam_comments = db.session.query(TComments).filter(TComments.location_id == location_id)\
.filter(TComments.is_spam == True) .filter(TComments.is_spam == True)
return render_template("review-spam.html", locations=all_locations, selected=location, return render_template("review-spam.html", locations=all_locations, selected=location_id,
spam_comments=spam_comments) spam_comments=spam_comments)
except ValueError: except ValueError:
pass pass
return render_template("review-spam.html", locations=all_locations, selected=location) export_location(location_id)
return render_template("review-spam.html", locations=all_locations, selected=location_id)
@bp_dashboard.route('/manage-comments/', methods=["POST", "GET"]) @bp_dashboard.route('/manage-comments/', methods=["POST", "GET"])
@bp_dashboard.route('/manage-comments/<int:location>', methods=["POST", "GET"]) @bp_dashboard.route('/manage-comments/<int:location_id>', methods=["POST", "GET"])
@login_required @login_required
def dashboard_manage_regular_comments(location=None): def dashboard_manage_regular_comments(location_id=None):
all_locations = db.session.query(TLocation).all() all_locations = db.session.query(TLocation).all()
# Check post # Check post
if request.method == "POST": if request.method == "POST":
location = request.form.get('selected_location') location_id = request.form.get('selected_location')
# no parameters found # no parameters found
if location is None: if location_id is None:
return render_template("manage-comments.html", locations=all_locations, selected=location) return render_template("manage-comments.html", locations=all_locations, selected=location_id)
try: try:
if int(location) >= 1: if int(location_id) >= 1:
spam_comments = db.session.query(TComments).filter(TComments.location_id == location) \ spam_comments = db.session.query(TComments).filter(TComments.location_id == location_id) \
.filter(TComments.is_spam == False) .filter(TComments.is_spam == False)
return render_template("manage-comments.html", locations=all_locations, selected=location, return render_template("manage-comments.html", locations=all_locations, selected=location_id,
spam_comments=spam_comments) spam_comments=spam_comments)
except ValueError: except ValueError:
pass pass
return render_template("manage-comments.html", locations=all_locations, selected=location) export_location(location_id)
return render_template("manage-comments.html", locations=all_locations, selected=location_id)
@bp_dashboard.route('/manage-mail/') @bp_dashboard.route('/manage-mail/')

Loading…
Cancel
Save