diff --git a/realms/static/js/editor.js b/realms/static/js/editor.js index fc39062..08d7e6b 100644 --- a/realms/static/js/editor.js +++ b/realms/static/js/editor.js @@ -73,7 +73,11 @@ var aced = new Aced({ content: content }; - var path = Config['RELATIVE_PATH'] + '/' + data['name']; + // If renaming an existing page, use the old page name for the URL to PUT to + var subPath = (PAGE_NAME) ? PAGE_NAME : data['name'] + var path = Config['RELATIVE_PATH'] + '/' + subPath; + var newPath = Config['RELATIVE_PATH'] + '/' + data['name']; + var type = (Commit.info['sha']) ? "PUT" : "POST"; $.ajax({ @@ -87,7 +91,7 @@ var aced = new Aced({ $page_name.addClass('parsley-error'); bootbox.alert("

" + res['message'] + "

"); } else { - location.href = path; + location.href = newPath; } }); } diff --git a/realms/templates/wiki/edit.html b/realms/templates/wiki/edit.html index 3812f39..71c7dd1 100644 --- a/realms/templates/wiki/edit.html +++ b/realms/templates/wiki/edit.html @@ -3,6 +3,8 @@ @@ -169,4 +171,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %}