diff --git a/files/helpers/const.py b/files/helpers/const.py index 89cc64e91..b51a548d0 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -119,7 +119,6 @@ AGENDAPOSTER_MSG_HTML = """

Hi here.

""" - ################################################################################ ### SITE SPECIFIC CONSTANTS ################################################################################ @@ -155,6 +154,7 @@ FEATURES = { 'MARKUP_COMMANDS': True, 'REPOST_DETECTION': True, 'PATRON_ICONS': False, + 'ORDER': False } EMOJI_MARSEYS = True @@ -217,6 +217,7 @@ SNAPPY_THREAD = 0 if SITE == 'rdrama.net': FEATURES['PRONOUNS'] = True FEATURES['HOUSES'] = True + FEATURES['ORDER'] = True SIDEBAR_THREAD = 37696 BANNER_THREAD = 37697 @@ -314,6 +315,7 @@ elif SITE == 'watchpeopledie.co': else: # localhost or testing environment implied FEATURES['PRONOUNS'] = True FEATURES['HOUSES'] = True + FEATURES['ORDER'] = True if CARP_ID: GIFT_NOTIF_ID = CARP_ID elif AEVANN_ID: GIFT_NOTIF_ID = AEVANN_ID diff --git a/files/routes/__init__.py b/files/routes/__init__.py index f9c046e1c..7a5242785 100644 --- a/files/routes/__init__.py +++ b/files/routes/__init__.py @@ -21,4 +21,4 @@ from .casino import * from .polls import * from .notifications import * from .hats import * -from .asset_submissions import * +from .asset_submissions import * \ No newline at end of file diff --git a/files/routes/static.py b/files/routes/static.py index eb3fa40ca..3b970664d 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -180,6 +180,37 @@ def static_megathread_index(v): def api(v): return render_template("api.html", v=v) + +@app.get("/order") +@auth_desired +def order(v): + if not FEATURES['ORDER']: abort(404) + if v: return redirect("/") + return render_template("order.html", v=v) + +@app.post("/order") +@limiter.limit("1/hour;2/day") +def submit_order(): + if not FEATURES['ORDER']: abort(404) + + body = request.values.get("message") + if not body: abort(400) + + body = 'This message has been sent automatically to all admins via [/order](/order)\n\nMessage:\n\n' + body + body = body.strip() + body_html = sanitize(body) + new_comment = Comment(author_id=AUTOJANNY_ID, parent_submission=None, level=1, body_html=body_html, sentto=2) + g.db.add(new_comment) + g.db.flush() + + new_comment.top_comment_id = new_comment.id + + for admin in g.db.query(User).filter(User.admin_level > 2, User.id != AEVANN_ID).all(): + notif = Notification(comment_id=new_comment.id, user_id=admin.id) + g.db.add(notif) + + return {"success": True} + @app.get("/contact") @app.get("/contactus") @app.get("/contact_us") diff --git a/files/templates/header.html b/files/templates/header.html index 3a71f9388..8b990369b 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -56,7 +56,6 @@ } {% endif %} - {% else %} - + {% endif %} + {% else %} + {% if FEATURES['ORDER'] %} + + {% endif %} diff --git a/files/templates/order.html b/files/templates/order.html new file mode 100644 index 000000000..f4fcd6a3b --- /dev/null +++ b/files/templates/order.html @@ -0,0 +1,218 @@ +{% extends "default.html" %} + +{% block content %} + + +
+

+
Request a quote +
+

+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
We respect your privacy. Learn + more.
+
+ + + +
+ +
+
+

Order Received

+

We will get back to you as quickly as possible with a quote.

+
+
+ + + + + + +{% endblock %} \ No newline at end of file