gitlab-org--gitlab-foss/app/views/edit_tree/show.html.haml

46 lines
1.6 KiB
Plaintext
Raw Normal View History

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