summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/projects/blob_controller.rb11
-rw-r--r--app/views/projects/blob/_upload.html.haml10
-rw-r--r--app/views/projects/blob/new.html.haml2
-rw-r--r--app/views/projects/blob/show.html.haml6
4 files changed, 11 insertions, 18 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index d7be212c33a..8776721d243 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -18,12 +18,6 @@ class Projects::BlobController < Projects::ApplicationController
before_action :after_edit_path, only: [:edit, :update]
def new
- @title = 'Upload'
- @placeholder = 'Upload new file'
- @button_title = 'Upload file'
- @form_path = namespace_project_create_blob_path(@project.namespace, @project, @id)
- @method = :post
-
commit unless @repository.empty?
end
@@ -46,11 +40,6 @@ class Projects::BlobController < Projects::ApplicationController
end
def show
- @title = "Replace #{@blob.name}"
- @placeholder = @title
- @button_title = 'Replace file'
- @form_path = namespace_project_update_blob_path(@project.namespace, @project, @id)
- @method = :put
end
def edit
diff --git a/app/views/projects/blob/_upload.html.haml b/app/views/projects/blob/_upload.html.haml
index 2cfb79486dc..1a1df127703 100644
--- a/app/views/projects/blob/_upload.html.haml
+++ b/app/views/projects/blob/_upload.html.haml
@@ -3,12 +3,12 @@
.modal-content
.modal-header
%a.close{href: "#", "data-dismiss" => "modal"} ×
- %h3.page-title #{@title}
+ %h3.page-title #{title}
%p.light
From branch
%strong= @ref
.modal-body
- = form_tag @form_path, method: @method, class: 'blob-file-upload-form-js form-horizontal' do
+ = form_tag form_path, method: method, class: 'blob-file-upload-form-js form-horizontal' do
.dropzone
.dropzone-previews.blob-upload-dropzone-previews
%p.dz-message.light
@@ -17,12 +17,12 @@
%br
.dropzone-alerts{class: "alert alert-danger data", style: "display:none"}
= render 'shared/commit_message_container', params: params,
- placeholder: @placeholder
+ placeholder: placeholder
.form-group
.col-sm-offset-2.col-sm-10
- = button_tag @button_title, class: 'btn btn-small btn-primary btn-upload-file', id: 'submit-all'
+ = button_tag button_title, 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'), '#{@method}')
+ new BlobFileDropzone($('.blob-file-upload-form-js'), '#{method}')
diff --git a/app/views/projects/blob/new.html.haml b/app/views/projects/blob/new.html.haml
index 68c9ec7f802..071c3bb7da8 100644
--- a/app/views/projects/blob/new.html.haml
+++ b/app/views/projects/blob/new.html.haml
@@ -4,7 +4,7 @@
{ class: 'upload-link', 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal'}
an existing one
-= render 'projects/blob/upload'
+= render 'projects/blob/upload', title: 'Upload', placeholder: 'Upload new file', button_title: 'Upload file', form_path: namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post
.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
diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml
index 4e66a43bbd5..a536d1cf272 100644
--- a/app/views/projects/blob/show.html.haml
+++ b/app/views/projects/blob/show.html.haml
@@ -10,4 +10,8 @@
- if allowed_tree_edit?
= render 'projects/blob/remove'
- = render 'projects/blob/upload'
+
+ - title = "Replace #{@blob.name}"
+ = render 'projects/blob/upload', title: title, placeholder: title,
+ button_title: 'Replace file', form_path: namespace_project_update_blob_path(@project.namespace, @project, @id),
+ method: :put