diff options
author | Unknwon <u@gogs.io> | 2017-04-07 21:44:55 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-07 21:44:55 -0400 |
commit | 91cd350b631f721d1d6dd38bbafd3cac612e53c6 (patch) | |
tree | 9c9355f33fa24ca8a9df18ee1851047a87685a61 /public/js | |
parent | 6ea9642d6415073c6312c80bf6533a5070630ad2 (diff) |
repo/editor: fix wrong context for subdirectory (#4368)
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/gogs.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index 85980462..5aca5652 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -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'); |