made views in url_for relative to current blueprint
This commit is contained in:
parent
1529c77084
commit
124adf5580
|
@ -9,12 +9,12 @@
|
||||||
if (document.getElementById('header').style.display == 'initial') {
|
if (document.getElementById('header').style.display == 'initial') {
|
||||||
document.getElementById('header').style.display = 'none';
|
document.getElementById('header').style.display = 'none';
|
||||||
document.getElementById('headerHidden').style.display = 'initial';
|
document.getElementById('headerHidden').style.display = 'initial';
|
||||||
xhr.open('GET', '{{ url_for("views.set_session", hide_header="on") }}', true);
|
xhr.open('GET', '{{ url_for(".set_session", hide_header="on") }}', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.getElementById('header').style.display = 'initial';
|
document.getElementById('header').style.display = 'initial';
|
||||||
document.getElementById('headerHidden').style.display = 'none';
|
document.getElementById('headerHidden').style.display = 'none';
|
||||||
xhr.open('GET', '{{ url_for("views.set_session", hide_header="off") }}', true);
|
xhr.open('GET', '{{ url_for(".set_session", hide_header="off") }}', true);
|
||||||
}
|
}
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<body>
|
<body>
|
||||||
<ul id="header" class="header" style="{% if session.get("hide_header") == True %}display:none;{% else %}display:initial;{% endif %}">
|
<ul id="header" class="header" style="{% if session.get("hide_header") == True %}display:none;{% else %}display:initial;{% endif %}">
|
||||||
<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('.index') }}">Home</a></li>
|
||||||
{% block header %}{% endblock %}
|
{% block header %}{% endblock %}
|
||||||
</ul>
|
</ul>
|
||||||
<ul id="headerHidden" class="header" style="{% if session.get("hide_header") == True %}display:initial;{% else %}display:none;{% endif %}">
|
<ul id="headerHidden" class="header" style="{% if session.get("hide_header") == True %}display:initial;{% else %}display:none;{% endif %}">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{% block title %}Start a new quest{% endblock %}
|
{% block title %}Start a new quest{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>New Quest</h1>
|
<h1>New Quest</h1>
|
||||||
<form method="post" action="{{ url_for('views.create_quest') }}">
|
<form method="post" action="{{ url_for('.create_quest') }}">
|
||||||
<input type="text" placeholder="Quest Title" name="quest_title" maxlength="300" required/><br/>
|
<input type="text" placeholder="Quest Title" name="quest_title" maxlength="300" required/><br/>
|
||||||
<textarea id="create_textarea" name="quest_body"></textarea>
|
<textarea id="create_textarea" name="quest_body"></textarea>
|
||||||
<input type="submit" name="submit" value="Submit"/>
|
<input type="submit" name="submit" value="Submit"/>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{% block title %}Login{% endblock %}
|
{% block title %}Login{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Login</h1>
|
<h1>Login</h1>
|
||||||
<form method="post" action="{{ url_for('views.login') }}">
|
<form method="post" action="{{ url_for('.login') }}">
|
||||||
<input type="text" placeholder="Username" name="user" maxlength="20" required/><br />
|
<input type="text" placeholder="Username" name="user" maxlength="20" required/><br />
|
||||||
<input type="password" placeholder="Password" name="pass" maxlength="1024" required/><br />
|
<input type="password" placeholder="Password" name="pass" maxlength="1024" required/><br />
|
||||||
<input type="submit" value="Log in" name="submit"/>
|
<input type="submit" value="Log in" name="submit"/>
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block header %}
|
{% block header %}
|
||||||
{% if session.get("user_id") == owner_id %}
|
{% if session.get("user_id") == owner_id %}
|
||||||
<li><a href="{{ url_for('views.edit_quest') }}">Edit Quest</a></li>
|
<li><a href="{{ url_for('.edit_quest') }}">Edit Quest</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<li>Must be between 8 and 1024 characters</li>
|
<li>Must be between 8 and 1024 characters</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="{{ url_for('views.signup') }}">
|
<form method="post" action="{{ url_for('.signup') }}">
|
||||||
<input type="text" placeholder="Username" name="user" maxlength="20" required/><br />
|
<input type="text" placeholder="Username" name="user" maxlength="20" required/><br />
|
||||||
<input type="password" placeholder="Password" name="pass" maxlength="1024" required/><br />
|
<input type="password" placeholder="Password" name="pass" maxlength="1024" required/><br />
|
||||||
<input type="password" placeholder="Verify password" name="pass_verify" maxlength="1024" required/><br />
|
<input type="password" placeholder="Verify password" name="pass_verify" maxlength="1024" required/><br />
|
||||||
|
|
8
views.py
8
views.py
|
@ -72,7 +72,7 @@ def quest(quest_title):
|
||||||
|
|
||||||
|
|
||||||
@views.route("/create_quest", methods=["GET", "POST"])
|
@views.route("/create_quest", methods=["GET", "POST"])
|
||||||
@login_required("views.login")
|
@login_required(".login")
|
||||||
def create_quest():
|
def create_quest():
|
||||||
"""
|
"""
|
||||||
Starts a new quest.
|
Starts a new quest.
|
||||||
|
@ -92,7 +92,7 @@ def create_quest():
|
||||||
quest_id = db.insert_quest(canon_title, ident_title, owner_id)
|
quest_id = db.insert_quest(canon_title, ident_title, owner_id)
|
||||||
db.insert_quest_post(quest_id, quest_body, timestamp)
|
db.insert_quest_post(quest_id, quest_body, timestamp)
|
||||||
|
|
||||||
return redirect(url_for('views.quest', quest_title=ident_title))
|
return redirect(url_for('.quest', quest_title=ident_title))
|
||||||
|
|
||||||
|
|
||||||
@views.route("/edit_quest")
|
@views.route("/edit_quest")
|
||||||
|
@ -129,7 +129,7 @@ def login():
|
||||||
|
|
||||||
if db.verify_password(username, password):
|
if db.verify_password(username, password):
|
||||||
session["username"] = username
|
session["username"] = username
|
||||||
return redirect(url_for("views.index"))
|
return redirect(url_for(".index"))
|
||||||
else:
|
else:
|
||||||
abort(401)
|
abort(401)
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ def signup():
|
||||||
"passwords_dont_match"
|
"passwords_dont_match"
|
||||||
|
|
||||||
res = db.add_user(username, password)
|
res = db.add_user(username, password)
|
||||||
return redirect(url_for("views.index"))
|
return redirect(url_for(".index"))
|
||||||
|
|
||||||
|
|
||||||
@views.route("/")
|
@views.route("/")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user