summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-08 09:43:23 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-08 09:43:23 +0300
commit7bd9a702e3cf2fa88968c723cbf014a6bba0f955 (patch)
tree0af453b1e4ef50c5e1239df4ec8496dc26cb4f82
parent715b8181ef4f06f49debfeedd71935498df08b3f (diff)
parentdf3c466e37fdd6a08b0274123d34997a2c006ba9 (diff)
downloadgitlab-ce-7bd9a702e3cf2fa88968c723cbf014a6bba0f955.tar.gz
Merge pull request #7222 from jhund/fix-5936
Don't remove trailing newline when editing a file in web UI editor
-rw-r--r--app/controllers/projects/edit_tree_controller.rb2
-rw-r--r--app/views/projects/edit_tree/show.html.haml3
2 files changed, 2 insertions, 3 deletions
diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb
index be611892bb0..ca83b21f429 100644
--- a/app/controllers/projects/edit_tree_controller.rb
+++ b/app/controllers/projects/edit_tree_controller.rb
@@ -28,8 +28,6 @@ class Projects::EditTreeController < Projects::BaseTreeController
def preview
@content = params[:content]
- #FIXME workaround https://github.com/gitlabhq/gitlabhq/issues/5936
- @content += "\n" if @blob.data.end_with?("\n")
diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3',
include_diff_info: true)
diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml
index 16fc1ab1f91..05050e7df7c 100644
--- a/app/views/projects/edit_tree/show.html.haml
+++ b/app/views/projects/edit_tree/show.html.haml
@@ -16,7 +16,7 @@
.btn-group.tree-btn-group
= link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message }
.file-content.code
- %pre.js-edit-mode-pane#editor= @blob.data
+ %pre.js-edit-mode-pane#editor
.js-edit-mode-pane#preview.hide
.center
%h2
@@ -43,6 +43,7 @@
ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace")
var ace_mode = "#{@blob.language.try(:ace_mode)}";
var editor = ace.edit("editor");
+ editor.setValue("#{escape_javascript(@blob.data)}");
if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode);
}