2013-11-05 08:28:49 +00:00
|
|
|
%h3.page-title New file
|
|
|
|
%hr
|
|
|
|
.file-editor
|
2014-09-03 11:13:26 +00:00
|
|
|
= form_tag(project_new_tree_path(@project, @id), method: :put, class: 'form-horizontal form-new-file') do
|
2013-12-30 23:27:02 +00:00
|
|
|
.form-group.commit_message-group
|
2014-09-03 11:13:26 +00:00
|
|
|
= label_tag 'file_name', class: 'control-label' do
|
2013-11-05 08:28:49 +00:00
|
|
|
File name
|
2013-12-30 23:27:02 +00:00
|
|
|
.col-sm-10
|
2014-01-13 07:47:32 +00:00
|
|
|
.input-group
|
|
|
|
%span.input-group-addon
|
|
|
|
= @path[-1] == "/" ? @path : @path + "/"
|
|
|
|
= text_field_tag 'file_name', params[:file_name], placeholder: "sample.rb", required: true, class: 'form-control'
|
|
|
|
%span.input-group-addon
|
|
|
|
on
|
|
|
|
%span= @ref
|
2013-11-05 08:28:49 +00:00
|
|
|
|
2014-01-16 16:25:32 +00:00
|
|
|
.form-group.commit_message-group
|
|
|
|
= label_tag :encoding, class: "control-label" do
|
|
|
|
Encoding
|
|
|
|
.col-sm-10
|
|
|
|
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control'
|
2014-10-03 10:56:48 +00:00
|
|
|
= render 'projects/blob_editor', ref: @ref
|
2014-10-02 22:26:56 +00:00
|
|
|
= render 'shared/commit_message_container', params: params,
|
|
|
|
placeholder: 'Add new file'
|
2014-10-02 22:13:23 +00:00
|
|
|
= hidden_field_tag 'content', '', id: 'file-content'
|
|
|
|
= render 'projects/commit_button', ref: @ref,
|
|
|
|
cancel_path: project_tree_path(@project, @id)
|
2013-11-05 08:28:49 +00:00
|
|
|
|
|
|
|
:javascript
|
|
|
|
ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict")
|
|
|
|
var editor = ace.edit("editor");
|
|
|
|
|
2014-09-03 11:13:26 +00:00
|
|
|
disableButtonIfAnyEmptyField($('.form-new-file'), '.form-control', '.btn-create')
|
2013-11-05 08:28:49 +00:00
|
|
|
|
|
|
|
$(".js-commit-button").click(function(){
|
|
|
|
$("#file-content").val(editor.getValue());
|
|
|
|
$(".file-editor form").submit();
|
|
|
|
});
|