mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Update wiki related stuff
This commit is contained in:
parent
c863ce1464
commit
ce6593a8fd
4 changed files with 8 additions and 17 deletions
|
@ -55,20 +55,11 @@ def wikiview_index():
|
|||
return f.render_template("wikiview_index.html", pages=pages)
|
||||
|
||||
|
||||
@bp.route("/id/<page_id>")
|
||||
def wikiview_by_id(page_id: str):
|
||||
@bp.route("/<uuid:page_id>", defaults={"title": ""})
|
||||
@bp.route("/<uuid:page_id>/<title>")
|
||||
def wikiview_by_id(page_id: uuid.UUID, title: str):
|
||||
from ...alchemyhandler import alchemy, alchemy_session
|
||||
page_uuid = uuid.UUID(page_id)
|
||||
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()
|
||||
page = alchemy_session.query(alchemy.WikiPage).filter(alchemy.WikiPage.page_id == page_id).one_or_none()
|
||||
if page is None:
|
||||
return "No such page", 404
|
||||
return prepare_page(page)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<div class="bot">
|
||||
<ul>
|
||||
{% 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 %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
{{ page.title }}
|
||||
</span>
|
||||
<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>
|
||||
</div>
|
||||
<div class="bot">
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
<body>
|
||||
<nav>
|
||||
<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") }}">
|
||||
<span class="nav-sitename">Royal Games</span>
|
||||
</span>
|
||||
</a>
|
||||
<span class="nav-modules">
|
||||
<a class="no-icon" href="{{ url_for("wikiview.wikiview_index") }}">Wiki</a>
|
||||
</span>
|
||||
|
|
Loading…
Reference in a new issue