From 96363c55b2d33067abd8bc66e9fa0eb027e98351 Mon Sep 17 00:00:00 2001 From: iou1name Date: Mon, 25 Jun 2018 10:11:43 -0400 Subject: [PATCH] added /quest/.../edit_quest and centered header better --- templates/edit_quest.html | 30 ++++++++++++++++++++++++++++++ templates/quest.html | 5 +++-- views.py | 15 ++++++++++++--- 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 templates/edit_quest.html diff --git a/templates/edit_quest.html b/templates/edit_quest.html new file mode 100644 index 0000000..83bb9ee --- /dev/null +++ b/templates/edit_quest.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% block title %}Edit {{ quest_title }}{% endblock %} +{% block content %} +

{{ quest_title }}

+
+ + + + + + + + + + + + + + + + + + + + + +
Quest Title:
Visible:
Anonymous Name:
Live:
Live In:Placeholder
+ +
+{% endblock %} diff --git a/templates/quest.html b/templates/quest.html index bdbc3a7..6cde408 100644 --- a/templates/quest.html +++ b/templates/quest.html @@ -78,14 +78,15 @@ {% endblock %} {% block header %} {% if session.get("user_id") == owner_id %} -
  • Edit Quest
  • +
  • Edit Quest
  • {% endif %} {% endblock %} {% block content %}
    -

    {{ quest_title }}

    + + {% for quest_post in quest_posts %}

    {{ quest_title }}

    diff --git a/views.py b/views.py index b3bc69d..535e253 100644 --- a/views.py +++ b/views.py @@ -65,6 +65,7 @@ def quest(quest_title): messages = db.get_chat_messages(quest_id) return render_template('quest.html', quest_title=quest_title, + ident_title=ident_title, quest_posts=quest_posts, owner_id=owner_id, room_id=quest_id, @@ -111,12 +112,20 @@ def create_quest(): return redirect(url_for('.quest', quest_title=ident_title)) -@views.route("/edit_quest") -def edit_quest(): +@views.route("/quest//edit_quest", methods=["GET", "POST"]) +def edit_quest(quest_title): """ Allows the quest owner to edit the quest. """ - return "lol" + ident_title = quest_title + data = db.get_quest_meta(ident_title=ident_title) + if not data: + abort(404) + quest_id, quest_title, _, owner_id = data + if request.method == "GET": + return render_template("edit_quest.html", + quest_title=quest_title, + ident_title=ident_title) @views.route("/set_session")