added /edit_quest link to header
This commit is contained in:
parent
fb2770dc2c
commit
c2fb07d8f9
|
@ -21,6 +21,9 @@
|
||||||
<ul id="header" class="header" style="display:initial;">
|
<ul id="header" class="header" style="display:initial;">
|
||||||
<li><a onclick="toggleHeader();" href="javascript:void(0);">^</a></li>
|
<li><a onclick="toggleHeader();" href="javascript:void(0);">^</a></li>
|
||||||
<li><a href="{{ url_for('views.index') }}">Home</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>
|
||||||
<ul id="headerHidden" class="header" style="display:none;">
|
<ul id="headerHidden" class="header" style="display:none;">
|
||||||
<li><a onclick="toggleHeader();" href="javascript:void(0);">^</a></li>
|
<li><a onclick="toggleHeader();" href="javascript:void(0);">^</a></li>
|
||||||
|
|
18
views.py
18
views.py
|
@ -62,11 +62,11 @@ def quest(quest_title):
|
||||||
if not data:
|
if not data:
|
||||||
abort(404)
|
abort(404)
|
||||||
quest_id, quest_title, _, owner_id, quest_data = data
|
quest_id, quest_title, _, owner_id, quest_data = data
|
||||||
|
|
||||||
messages = db.get_chat_messages(quest_id)
|
messages = db.get_chat_messages(quest_id)
|
||||||
return render_template('quest.html',
|
return render_template('quest.html',
|
||||||
quest_title=quest_title,
|
quest_title=quest_title,
|
||||||
quest_body=quest_data,
|
quest_body=quest_data,
|
||||||
|
owner_id=owner_id,
|
||||||
room_id=quest_id,
|
room_id=quest_id,
|
||||||
messages=messages)
|
messages=messages)
|
||||||
|
|
||||||
|
@ -86,12 +86,24 @@ def create_quest():
|
||||||
quest_body = bleach.clean(quest_body.strip())
|
quest_body = bleach.clean(quest_body.strip())
|
||||||
quest_body = quest_body.replace("\n", "<br />")
|
quest_body = quest_body.replace("\n", "<br />")
|
||||||
|
|
||||||
|
owner_id = session.get("user_id")
|
||||||
|
|
||||||
db._DB.execute(
|
db._DB.execute(
|
||||||
"INSERT INTO `quests` (`canon_title`, `ident_title`, `quest_data`) " \
|
"INSERT INTO `quests` " \
|
||||||
"VALUES (%s, %s, %s)", (canon_title, ident_title, quest_body))
|
+ "(`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))
|
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"])
|
@views.route("/login", methods=["GET", "POST"])
|
||||||
def login():
|
def login():
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user