wiki: Fix editing the index page
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 May 2019 15:02:44 +0000 (16:02 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 May 2019 15:02:44 +0000 (16:02 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/wiki/404.html
src/templates/wiki/edit.html
src/templates/wiki/page.html

index bd3a4a5..c410a7a 100644 (file)
@@ -3,6 +3,8 @@
 {% block title %}{{ _("Page Not Found") }}{% end block %}
 
 {% block container %}
+    {% import os.path %}
+
     <section>
         <div class="container">
             <div class="row justify-content-center mt-5">
@@ -15,7 +17,7 @@
                         {{ _("This wiki page does not exist, yet.") }}
                     </p>
 
-                    <a class="btn btn-primary btn-block" href="{{ request.path }}/_edit">
+                    <a class="btn btn-primary btn-block" href="{{ os.path.join(request.path, "_edit") }}">
                         {{ _("Create Now") }}
                     </a>
                 </div>
index 8933b40..4969e3b 100644 (file)
@@ -69,6 +69,8 @@
 {% end block %}
 
 {% block javascript %}
+       {% import os.path %}
+
        <script type="text/javascript">
                var update = null;
 
@@ -94,7 +96,7 @@
                                update = setTimeout(function() {
                                        var c = $("#preview-content");
 
-                                       $.post("{{ page.url }}/_render", { content : content },
+                                       $.post("{{ os.path.join(request.path, "_render") }}", { content : content },
                                                function(data) {
                                                        c.html(data);
 
index e962400..f6814c7 100644 (file)
 {% end block %}
 
 {% block main %}
+       {% import os.path %}
+
        <div class="card mb-3">
                <div class="card-body wiki-content">
                        {% raw page.html %}
                </div>
        </div>
 
-       <a class="btn btn-primary btn-block mb-3" href="{{ request.path }}/_edit">
+       <a class="btn btn-primary btn-block mb-3" href="{{ os.path.join(request.path, "_edit") }}">
                <span class="fas fa-edit mr-2"></span> {{ _("Edit Page") }}
                {% if not current_user %}&dash; {{ _("Yes, you can edit!") }}{% end %}
        </a>
@@ -25,9 +27,9 @@
        <p class="small text-muted">
                {% if current_user %}
                        {% if page.is_watched_by(current_user) %}
-                               <a href="{{ page.url }}/_unwatch"><span class="fas fa-star" title="{{ _("Stop watching this page") }}"></span></a>
+                               <a href="{{ os.path.join(page.url, "_unwatch") }}"><span class="fas fa-star" title="{{ _("Stop watching this page") }}"></span></a>
                        {% else %}
-                               <a href="{{ page.url }}/_watch"><span class="far fa-star" title="{{ _("Watch this page") }}"></span></a>
+                               <a href="{{ os.path.join(page.url, "_watch") }}"><span class="far fa-star" title="{{ _("Watch this page") }}"></span></a>
                        {% end %} &bull;
                {% end %}