summaryrefslogtreecommitdiff
path: root/app/views/projects/blob/new.html.haml
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-26 15:03:30 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-26 15:03:30 -0800
commit752cb506c033c281064abb56093c41a7dac2735a (patch)
treea3af84079a8109995a6ef33a4038c6860034a820 /app/views/projects/blob/new.html.haml
parent21297e78afd5ddfbfdf62f471acf1ab2f0c2a892 (diff)
downloadgitlab-ce-752cb506c033c281064abb56093c41a7dac2735a.tar.gz
Refactor blob views
Diffstat (limited to 'app/views/projects/blob/new.html.haml')
-rw-r--r--app/views/projects/blob/new.html.haml38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/views/projects/blob/new.html.haml b/app/views/projects/blob/new.html.haml
new file mode 100644
index 00000000000..57e830d5c56
--- /dev/null
+++ b/app/views/projects/blob/new.html.haml
@@ -0,0 +1,38 @@
+%h3.page-title New file
+%hr
+.file-editor
+ = form_tag(project_create_blob_path(@project, @id), method: :post, class: 'form-horizontal form-new-file') do
+ .form-group.commit_message-group
+ = label_tag 'file_name', class: 'control-label' do
+ File name
+ .col-sm-10
+ .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
+
+ .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'
+ = render 'projects/blob_editor', ref: @ref
+ = render 'shared/commit_message_container', params: params,
+ placeholder: 'Add new file'
+ = hidden_field_tag 'content', '', id: 'file-content'
+ = render 'projects/commit_button', ref: @ref,
+ cancel_path: project_tree_path(@project, @id)
+
+:javascript
+ ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict")
+ var editor = ace.edit("editor");
+
+ disableButtonIfAnyEmptyField($('.form-new-file'), '.form-control', '.btn-create')
+
+ $(".js-commit-button").click(function(){
+ $("#file-content").val(editor.getValue());
+ $(".file-editor form").submit();
+ });