2012-10-09 13:11:49 -04:00
|
|
|
.file-editor
|
2013-03-24 05:57:44 -04:00
|
|
|
= form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
|
2012-10-10 05:41:15 -04:00
|
|
|
.file_holder
|
|
|
|
.file_title
|
|
|
|
%i.icon-file
|
2012-10-15 12:51:11 -04:00
|
|
|
%span.file_name
|
2013-04-03 09:49:32 -04:00
|
|
|
= @path
|
2012-11-17 09:43:13 -05:00
|
|
|
%small
|
|
|
|
on
|
|
|
|
%strong= @ref
|
|
|
|
%span.options
|
|
|
|
.btn-group.tree-btn-group
|
2013-05-27 08:43:44 -04:00
|
|
|
= link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: leave_edit_message
|
2012-10-10 05:41:15 -04:00
|
|
|
.file_content.code
|
2013-04-03 09:49:32 -04:00
|
|
|
%pre#editor= @blob.data
|
2012-10-10 05:41:15 -04:00
|
|
|
|
2012-11-17 09:43:13 -05:00
|
|
|
.control-group.commit_message-group
|
|
|
|
= label_tag 'commit_message', class: "control-label" do
|
|
|
|
Commit message
|
|
|
|
.controls
|
2013-04-03 09:49:32 -04:00
|
|
|
= text_area_tag 'commit_message', '', placeholder: "Update #{@blob.name}", required: true, rows: 3
|
2012-10-10 05:41:15 -04:00
|
|
|
.form-actions
|
2012-10-08 11:43:54 -04:00
|
|
|
= hidden_field_tag 'last_commit', @last_commit
|
2012-11-17 09:43:13 -05:00
|
|
|
= hidden_field_tag 'content', '', id: :file_content
|
|
|
|
.commit-button-annotation
|
2013-06-13 10:41:21 -04:00
|
|
|
= button_tag "Commit changes", class: 'btn commit-btn js-commit-button btn-primary'
|
2012-11-17 09:43:13 -05:00
|
|
|
.message
|
|
|
|
to branch
|
|
|
|
%strong= @ref
|
2013-05-27 08:43:44 -04:00
|
|
|
= link_to "Cancel", project_blob_path(@project, @id), class: "btn btn-cancel", confirm: leave_edit_message
|
2012-10-09 13:11:49 -04:00
|
|
|
|
|
|
|
:javascript
|
2013-05-03 06:09:57 -04:00
|
|
|
ace.config.set("modePath", "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict")
|
2013-04-03 09:49:32 -04:00
|
|
|
var ace_mode = "#{@blob.language.try(:ace_mode)}";
|
2012-10-09 13:11:49 -04:00
|
|
|
var editor = ace.edit("editor");
|
2012-11-17 09:28:32 -05:00
|
|
|
if (ace_mode) {
|
|
|
|
editor.getSession().setMode('ace/mode/' + ace_mode);
|
|
|
|
}
|
2012-10-12 10:14:52 -04:00
|
|
|
|
2012-11-17 09:43:13 -05:00
|
|
|
disableButtonIfEmptyField("#commit_message", ".js-commit-button");
|
|
|
|
|
|
|
|
$(".js-commit-button").click(function(){
|
2012-10-12 10:14:52 -04:00
|
|
|
$("#file_content").val(editor.getValue());
|
2012-11-17 09:43:13 -05:00
|
|
|
$(".file-editor form").submit();
|
2012-10-12 10:14:52 -04:00
|
|
|
});
|