Commit 3a3b0da8 authored by Ciro Santilli's avatar Ciro Santilli

Make blob new and edit file editors more uniform

parent 394e2ec5
.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
...@@ -6,21 +6,7 @@ ...@@ -6,21 +6,7 @@
= link_to editing_preview_title(@blob.name), '#preview', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) = 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 = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
.file-holder.file = render 'projects/blob_editor', ref: @ref, path: @path, blob_data: @blob.data
.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 'shared/commit_message_container', params: params, = render 'shared/commit_message_container', params: params,
placeholder: "Update #{@blob.name}" placeholder: "Update #{@blob.name}"
= hidden_field_tag 'last_commit', @last_commit = hidden_field_tag 'last_commit', @last_commit
...@@ -34,7 +20,6 @@ ...@@ -34,7 +20,6 @@
ace.config.loadModule("ace/ext/searchbox"); ace.config.loadModule("ace/ext/searchbox");
var ace_mode = "#{@blob.language.try(:ace_mode)}"; var ace_mode = "#{@blob.language.try(:ace_mode)}";
var editor = ace.edit("editor"); var editor = ace.edit("editor");
editor.setValue("#{escape_javascript(@blob.data)}");
if (ace_mode) { if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode); editor.getSession().setMode('ace/mode/' + ace_mode);
} }
......
...@@ -19,12 +19,7 @@ ...@@ -19,12 +19,7 @@
Encoding Encoding
.col-sm-10 .col-sm-10
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control' = select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control'
.file-holder = render 'projects/blob_editor', ref: @ref
.file-title
%i.fa.fa-file
.file-content.code
%pre#editor= params[:content]
= render 'shared/commit_message_container', params: params, = render 'shared/commit_message_container', params: params,
placeholder: 'Add new file' placeholder: 'Add new file'
= hidden_field_tag 'content', '', id: 'file-content' = hidden_field_tag 'content', '', id: 'file-content'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment