repo/editor: fix wrong context for subdirectory (#4368)

This commit is contained in:
Unknwon
2017-04-07 21:44:55 -04:00
parent 6ea9642d64
commit 91cd350b63
7 changed files with 116 additions and 98 deletions

View File

@@ -64,7 +64,6 @@ function initEditDiffTab($form) {
var $this = $(this);
$.post($this.data('url'), {
"_csrf": csrf,
"context": $this.data('context'),
"content": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
},
function (data) {
@@ -704,9 +703,13 @@ function initEditor() {
parts.push(element.text());
}
});
if ($(this).val())
if ($(this).val()) {
parts.push($(this).val());
$('#tree_path').val(parts.join('/'));
}
var tree_path = parts.join('/');
$('#tree_path').val(tree_path);
$('#preview-tab').data('context', $('#preview-tab').data('root-context') + tree_path.substring(0, tree_path.lastIndexOf("/")+1));
}).trigger('keyup');
var $editArea = $('.repository.editor textarea#edit_area');