added /edit_quest link to header

This commit is contained in:
iou1name 2018-06-19 17:00:49 -04:00
parent fb2770dc2c
commit c2fb07d8f9
2 changed files with 18 additions and 3 deletions

View File

@ -21,6 +21,9 @@
<ul id="header" class="header" style="display:initial;">
<li><a onclick="toggleHeader();" href="javascript:void(0);">^</a></li>
<li><a href="{{ url_for('views.index') }}">Home</a></li>
{% if session.get("user_id") == owner_id %}
<li><a href="{{ url_for('views.edit_quest') }}">Edit Quest</a></li>
{% endif %}
</ul>
<ul id="headerHidden" class="header" style="display:none;">
<li><a onclick="toggleHeader();" href="javascript:void(0);">^</a></li>

View File

@ -62,11 +62,11 @@ def quest(quest_title):
if not data:
abort(404)
quest_id, quest_title, _, owner_id, quest_data = data
messages = db.get_chat_messages(quest_id)
return render_template('quest.html',
quest_title=quest_title,
quest_body=quest_data,
owner_id=owner_id,
room_id=quest_id,
messages=messages)
@ -86,12 +86,24 @@ def create_quest():
quest_body = bleach.clean(quest_body.strip())
quest_body = quest_body.replace("\n", "<br />")
owner_id = session.get("user_id")
db._DB.execute(
"INSERT INTO `quests` (`canon_title`, `ident_title`, `quest_data`) " \
"VALUES (%s, %s, %s)", (canon_title, ident_title, quest_body))
"INSERT INTO `quests` " \
+ "(`canon_title`, `ident_title`, `owner_id`, `quest_data`) " \
+ "VALUES (%s, %s, %s, %s)",
(canon_title, ident_title, owner_id, quest_body))
return redirect(url_for('views.quest', quest_title=ident_title))
@views.route("/edit_quest")
def edit_quest():
"""
Allows the quest owner to edit the quest.
"""
return "lol"
@views.route("/login", methods=["GET", "POST"])
def login():
"""