Fix bug with rename feature to also delete old page
This commit is contained in:
parent
459a9c2c59
commit
fdf482d14b
|
@ -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("<h3>" + res['message'] + "</h3>");
|
||||
} else {
|
||||
location.href = path;
|
||||
location.href = newPath;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
<script>
|
||||
var Commit = {};
|
||||
Commit.info = {{ info|tojson }};
|
||||
|
||||
var PAGE_NAME = '{{ name }}';
|
||||
</script>
|
||||
<script src="{{ url_for('static', filename='js/editor.js') }}"></script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue