summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-09-14 17:57:41 -0700
committerStan Hu <stanhu@gmail.com>2015-09-14 17:57:41 -0700
commit81e741af2445f1e403c02dc172a47ade641eed60 (patch)
treee7d6a3e60c219716041f01bd69e01aea2b514bf6 /app/views
parentc99473e57ca90f95c4e31fc1582fb94731257442 (diff)
parente2ece2bc350bf881e9716e51c01a59eecac65fc9 (diff)
downloadgitlab-ce-81e741af2445f1e403c02dc172a47ade641eed60.tar.gz
Merge pull request #9138 from liyakun/master
add "replace" and "upload" functionality
Diffstat (limited to 'app/views')
-rw-r--r--app/views/projects/blob/_actions.html.haml6
-rw-r--r--app/views/projects/blob/_replace.html.haml28
-rw-r--r--app/views/projects/blob/_upload.html.haml28
-rw-r--r--app/views/projects/blob/new.html.haml10
-rw-r--r--app/views/projects/blob/show.html.haml1
5 files changed, 68 insertions, 5 deletions
diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml
index 13f8271b979..5b61846fe6d 100644
--- a/app/views/projects/blob/_actions.html.haml
+++ b/app/views/projects/blob/_actions.html.haml
@@ -17,6 +17,6 @@
tree_join(@commit.sha, @path)), class: 'btn btn-sm'
- if allowed_tree_edit?
- = button_tag class: 'remove-blob btn btn-sm btn-remove',
- 'data-toggle' => 'modal', 'data-target' => '#modal-remove-blob' do
- Remove
+ .btn-group{:role => "group"}
+ %button.btn.btn-default{class: 'btn-primary', href: '#modal-replace-blob', 'data-target' => '#modal-replace-blob', 'data-toggle' => 'modal'} Replace
+ %button.btn.btn-default{class: 'btn-remove', href: '#modal-remove-blob', 'data-target' => '#modal-remove-blob', 'data-toggle' => 'modal'} Remove
diff --git a/app/views/projects/blob/_replace.html.haml b/app/views/projects/blob/_replace.html.haml
new file mode 100644
index 00000000000..84abf0303d0
--- /dev/null
+++ b/app/views/projects/blob/_replace.html.haml
@@ -0,0 +1,28 @@
+#modal-replace-blob.modal
+ .modal-dialog
+ .modal-content
+ .modal-header
+ %a.close{href: "#", "data-dismiss" => "modal"} ×
+ %h3.page-title Replace #{@blob.name}
+ %p.light
+ From branch
+ %strong= @ref
+ .modal-body
+ = form_tag namespace_project_update_blob_path(@project.namespace, @project, @id), method: :put, class: 'blob-file-upload-form-js form-horizontal' do
+ .dropzone
+ .dropzone-previews{class: "blob-upload-dropzone-previews"}
+ %p.dz-message{class: "hint"}<
+ Attach files by dragging & dropping or&nbsp;
+ %a{href: '#', class: "markdown-selector"}>click to upload
+ %br
+ .dropzone-alerts{class: "alert alert-danger data", "data-dismiss" => "alert", style: "display:none"}
+ = render 'shared/commit_message_container', params: params,
+ placeholder: 'Replace this file because...'
+ .form-group
+ .col-sm-offset-2.col-sm-10
+ = button_tag 'Replace file', class: 'btn btn-small btn-primary btn-replace-file', id: 'submit-all'
+ = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
+
+:coffeescript
+ disableButtonIfEmptyField $('.blob-file-upload-form-js').find('#commit_message'), '.btn-replace-file'
+ new BlobFileDropzone($('.blob-file-upload-form-js'), 'put')
diff --git a/app/views/projects/blob/_upload.html.haml b/app/views/projects/blob/_upload.html.haml
new file mode 100644
index 00000000000..5a6a3358a17
--- /dev/null
+++ b/app/views/projects/blob/_upload.html.haml
@@ -0,0 +1,28 @@
+#modal-upload-blob.modal
+ .modal-dialog
+ .modal-content
+ .modal-header
+ %a.close{href: "#", "data-dismiss" => "modal"} ×
+ %h3.page-title Upload
+ %p.light
+ From branch
+ %strong= @ref
+ .modal-body
+ = form_tag namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'blob-file-upload-form-js form-horizontal' do
+ .dropzone
+ .dropzone-previews{class: "blob-upload-dropzone-previews"}
+ %p.dz-message{class: "hint"}<
+ Attach files by dragging & dropping or&nbsp;
+ %a{href: '#', class: "markdown-selector"}>click to upload
+ %br
+ .dropzone-alerts{class: "alert alert-danger data", "data-dismiss" => "alert", style: "display:none"}
+ = render 'shared/commit_message_container', params: params,
+ placeholder: 'Upload this file because...'
+ .form-group
+ .col-sm-offset-2.col-sm-10
+ = button_tag 'Upload file', class: 'btn btn-small btn-primary btn-upload-file', id: 'submit-all'
+ = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
+
+:coffeescript
+ disableButtonIfEmptyField $('.blob-file-upload-form-js').find('#commit_message'), '.btn-upload-file'
+ new BlobFileDropzone($('.blob-file-upload-form-js'), 'post')
diff --git a/app/views/projects/blob/new.html.haml b/app/views/projects/blob/new.html.haml
index 7c2a4fece94..6fb46ea2040 100644
--- a/app/views/projects/blob/new.html.haml
+++ b/app/views/projects/blob/new.html.haml
@@ -1,5 +1,11 @@
-- page_title "New File", @ref
-%h3.page-title New file
+%h3.page-title<
+ Create new file or&nbsp;
+ %a.upload-link{href: '#modal-upload-blob', 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal'}>upload existing one
+
+.file-title
+ = render 'projects/blob/upload'
+ %br
+
.file-editor
= form_tag(namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'form-horizontal form-new-file js-requires-input') do
= render 'projects/blob/editor', ref: @ref
diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml
index bd2fc43633c..19e876ec34c 100644
--- a/app/views/projects/blob/show.html.haml
+++ b/app/views/projects/blob/show.html.haml
@@ -10,3 +10,4 @@
- if allowed_tree_edit?
= render 'projects/blob/remove'
+ = render 'projects/blob/replace'