diff --git a/app/views/projects/_blob_editor.html.haml b/app/views/projects/_blob_editor.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..1fb74b55c4125e188ec61f9ff064659134412803
--- /dev/null
+++ b/app/views/projects/_blob_editor.html.haml
@@ -0,0 +1,15 @@
+.file-holder.file
+ .file-title
+ %i.icon-file
+ %span.file_name
+ %span.monospace.light #{ref}
+ - if local_assigns[:path]
+ = ': ' + local_assigns[:path]
+ .file-content.code
+ %pre.js-edit-mode-pane#editor
+ = params[:content] || local_assigns[:blob_data]
+ - if local_assigns[:path]
+ .js-edit-mode-pane#preview.hide
+ .center
+ %h2
+ %i.icon-spinner.icon-spin
diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml
index 5ccde05063e6f4f5e7b64b44cbe42ccc905b4961..7e0789853af1547e337ba78c326d3a1a707e70c1 100644
--- a/app/views/projects/edit_tree/show.html.haml
+++ b/app/views/projects/edit_tree/show.html.haml
@@ -6,21 +6,7 @@
= link_to editing_preview_title(@blob.name), '#preview', 'data-preview-url' => preview_project_edit_tree_path(@project, @id)
= form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
- .file-holder.file
- .file-title
- %i.fa.fa-file
- %span.file_name
- %span.monospace.light #{@ref}:
- = @path
- %span.options
- .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
- .js-edit-mode-pane#preview.hide
- .center
- %h2
- %i.fa.fa-spinner.fa-spin
+ = render 'projects/blob_editor', ref: @ref, path: @path, blob_data: @blob.data
= render 'shared/commit_message_container', params: params,
placeholder: "Update #{@blob.name}"
= hidden_field_tag 'last_commit', @last_commit
@@ -34,7 +20,6 @@
ace.config.loadModule("ace/ext/searchbox");
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);
}
diff --git a/app/views/projects/new_tree/show.html.haml b/app/views/projects/new_tree/show.html.haml
index f09d3659774510cb2a5dd0bc90c0ab775e12b9b7..cf7b768694f842171976b37882fa26eb446232b3 100644
--- a/app/views/projects/new_tree/show.html.haml
+++ b/app/views/projects/new_tree/show.html.haml
@@ -19,12 +19,7 @@
Encoding
.col-sm-10
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control'
- .file-holder
- .file-title
- %i.fa.fa-file
- .file-content.code
- %pre#editor= params[:content]
-
+ = render 'projects/blob_editor', ref: @ref
= render 'shared/commit_message_container', params: params,
placeholder: 'Add new file'
= hidden_field_tag 'content', '', id: 'file-content'