From fb0f3d939572e447146e13abaab31f1c3ea94514 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 20 Jun 2019 17:01:13 +0200 Subject: [PATCH] Progress --- royalnet/web/royalprints/wikiedit/__init__.py | 4 +- .../wikiedit/templates/wikiedit_page.html | 44 ++++++++++--------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/royalnet/web/royalprints/wikiedit/__init__.py b/royalnet/web/royalprints/wikiedit/__init__.py index 4e9f2d3b..0d918fef 100644 --- a/royalnet/web/royalprints/wikiedit/__init__.py +++ b/royalnet/web/royalprints/wikiedit/__init__.py @@ -12,7 +12,7 @@ rp = Royalprint("wikiedit", __name__, url_prefix="/wikiedit", template_folder=tm @rp.route("/", defaults={"title": ""}, methods=["GET", "POST"]) -@rp.route("//") +@rp.route("/<uuid:page_id>/<title>", methods=["GET", "POST"]) def wikiedit_by_id(page_id: uuid.UUID, title: str): alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] page = alchemy_session.query(alchemy.WikiPage).filter(alchemy.WikiPage.page_id == page_id).one_or_none() @@ -23,4 +23,4 @@ def wikiedit_by_id(page_id: uuid.UUID, title: str): return f.render_template("wikiedit_page.html", page=page) elif f.request.method == "POST": - return "Haha doesn't work yet" + return "" \ No newline at end of file diff --git a/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html b/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html index fd77c6a7..6d2a24cb 100644 --- a/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html +++ b/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html @@ -18,26 +18,30 @@ </div> <div class="bot"> <form method="POST" class="wikiedit-form"> - <label for="wikiedit-title"> - <span class="label-text">Titolo</span> - <input id="wikiedit-title" type="text" name="title" placeholder="Titolo" value="{{ page.title }}"> - </label> - <label for="wikiedit-format"> - <span class="label-text">Formato</span> - <input id="wikiedit-format" type="text" name="format" placeholder="Format" disabled value="{{ page.format }}"> - </label> - <!--suppress HtmlFormInputWithoutLabel --> - <textarea id="wikiedit-content" name="content">{{ page.content }}</textarea> - <label for="wikiedit-css"> - <span class="label-text">Tema</span> - <select id="wikiedit-css" name="css"> - <option value="None" {% if page.css == None %}selected{% endif %}>Royal Games</option> - <option value="tf2.css" {% if page.css == "tf2.css" %}selected{% endif %}>Team Fortress 2</option> - </select> - </label> - <label for="wikiedit-submit"> - <input id="wikiedit-submit" type="submit" value="Salva"> - </label> + <label for="wikiedit-title"> + <span class="label-text">Titolo</span> + <input id="wikiedit-title" type="text" name="title" value="{{ page.title }}"> + </label> + <label for="wikiedit-format"> + <span class="label-text">Formato</span> + <input id="wikiedit-format" type="text" name="format" disabled value="{{ page.format }}"> + </label> + <!--suppress HtmlFormInputWithoutLabel --> + <textarea id="wikiedit-content" name="content">{{ page.content }}</textarea> + <label for="wikiedit-css"> + <span class="label-text">Tema</span> + <select id="wikiedit-css" name="css"> + <option value="None" {% if page.css == None %}selected{% endif %}>Royal Games</option> + <option value="tf2.css" {% if page.css == "tf2.css" %}selected{% endif %}>Team Fortress 2</option> + </select> + </label> + <label for="wikiedit-reason"> + <span class="label-text">Motivo</span> + <input id="wikiedit-reason" type="text" name="reason"> + </label> + <label for="wikiedit-submit"> + <input id="wikiedit-submit" type="submit" value="Salva"> + </label> </form> </div> </div>