1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Update wiki related stuff

This commit is contained in:
Steffo 2019-06-13 00:15:09 +02:00
parent c863ce1464
commit ce6593a8fd
4 changed files with 8 additions and 17 deletions

View file

@ -55,20 +55,11 @@ def wikiview_index():
return f.render_template("wikiview_index.html", pages=pages) return f.render_template("wikiview_index.html", pages=pages)
@bp.route("/id/<page_id>") @bp.route("/<uuid:page_id>", defaults={"title": ""})
def wikiview_by_id(page_id: str): @bp.route("/<uuid:page_id>/<title>")
def wikiview_by_id(page_id: uuid.UUID, title: str):
from ...alchemyhandler import alchemy, alchemy_session from ...alchemyhandler import alchemy, alchemy_session
page_uuid = uuid.UUID(page_id) page = alchemy_session.query(alchemy.WikiPage).filter(alchemy.WikiPage.page_id == page_id).one_or_none()
page = alchemy_session.query(alchemy.WikiPage).filter(alchemy.WikiPage.page_id == page_uuid).one_or_none()
if page is None:
return "No such page", 404
return prepare_page(page)
@bp.route("/title/<title>")
def wikiview_by_title(title: str):
from ...alchemyhandler import alchemy, alchemy_session
page = alchemy_session.query(alchemy.WikiPage).filter(alchemy.WikiPage.title == title).one_or_none()
if page is None: if page is None:
return "No such page", 404 return "No such page", 404
return prepare_page(page) return prepare_page(page)

View file

@ -14,7 +14,7 @@
<div class="bot"> <div class="bot">
<ul> <ul>
{% for page in pages %} {% for page in pages %}
<li><a href="{{ url_for("wikiview.wikiview_by_id", page_id=page.page_id|string) }}">{{ page.title }}</a></li> <li><a href="{{ url_for("wikiview.wikiview_by_id", page_id=page.page_id|string, title=page.title) }}">{{ page.title }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View file

@ -11,7 +11,7 @@
{{ page.title }} {{ page.title }}
</span> </span>
<span class="right"> <span class="right">
<a class="permalink no-icon" href="{{ url_for("wikiview.wikiview_by_id", page_id=page.page_id|string) }}">#</a> <a class="permalink no-icon" href="{{ url_for("wikiview.wikiview_by_id", page_id=page.page_id|string, title=page.title) }}">#</a>
</span> </span>
</div> </div>
<div class="bot"> <div class="bot">

View file

@ -20,10 +20,10 @@
<body> <body>
<nav> <nav>
<div class="nav-left"> <div class="nav-left">
<span class="nav-site"> <a class="nav-site no-icon" href="{{ url_for("home.home_index") }}">
<img class="nav-image" alt="" src="{{ url_for("static", filename="logo.svg") }}"> <img class="nav-image" alt="" src="{{ url_for("static", filename="logo.svg") }}">
<span class="nav-sitename">Royal Games</span> <span class="nav-sitename">Royal Games</span>
</span> </a>
<span class="nav-modules"> <span class="nav-modules">
<a class="no-icon" href="{{ url_for("wikiview.wikiview_index") }}">Wiki</a> <a class="no-icon" href="{{ url_for("wikiview.wikiview_index") }}">Wiki</a>
</span> </span>