gitlabhq/app/views/edit_tree/show.html.haml

45 lines
1.5 KiB
Plaintext
Raw Normal View History

2012-10-09 19:11:49 +02:00
.file-editor
= form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
2012-10-10 11:41:15 +02:00
.file_holder
.file_title
%i.icon-file
%span.file_name
2012-11-17 15:43:13 +01:00
= @tree.path
%small
on
%strong= @ref
%span.options
.btn-group.tree-btn-group
2013-01-29 21:29:21 +01:00
= link_to "Cancel", project_tree_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: "Are you sure?"
2012-10-10 11:41:15 +02:00
.file_content.code
2012-11-17 01:00:26 +01:00
%pre#editor= @tree.data
2012-10-10 11:41:15 +02:00
2012-11-17 15:43:13 +01:00
.control-group.commit_message-group
= label_tag 'commit_message', class: "control-label" do
Commit message
.controls
= text_area_tag 'commit_message', '', placeholder: "Update #{@tree.name}", required: true, rows: 3
2012-10-10 11:41:15 +02:00
.form-actions
2012-10-08 17:43:54 +02:00
= hidden_field_tag 'last_commit', @last_commit
2012-11-17 15:43:13 +01: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-01-29 21:18:19 +01:00
= link_to "Cancel", project_tree_path(@project, @id), class: "btn btn-cancel", confirm: "Are you sure?"
2012-10-09 19:11:49 +02:00
:javascript
2012-11-17 15:28:32 +01:00
var ace_mode = "#{@tree.language.try(:ace_mode)}";
2012-10-09 19:11:49 +02:00
var editor = ace.edit("editor");
2012-11-17 15:28:32 +01:00
if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode);
}
2012-10-12 16:14:52 +02:00
2012-11-17 15:43:13 +01:00
disableButtonIfEmptyField("#commit_message", ".js-commit-button");
$(".js-commit-button").click(function(){
2012-10-12 16:14:52 +02:00
$("#file_content").val(editor.getValue());
2012-11-17 15:43:13 +01:00
$(".file-editor form").submit();
2012-10-12 16:14:52 +02:00
});