Commit ac855e5e authored by Stan Hu's avatar Stan Hu

Move partial locals out of controller

parent b75e4d71
...@@ -18,12 +18,6 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -18,12 +18,6 @@ class Projects::BlobController < Projects::ApplicationController
before_action :after_edit_path, only: [:edit, :update] before_action :after_edit_path, only: [:edit, :update]
def new 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? commit unless @repository.empty?
end end
...@@ -46,11 +40,6 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -46,11 +40,6 @@ class Projects::BlobController < Projects::ApplicationController
end end
def show 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 end
def edit def edit
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
.modal-content .modal-content
.modal-header .modal-header
%a.close{href: "#", "data-dismiss" => "modal"} × %a.close{href: "#", "data-dismiss" => "modal"} ×
%h3.page-title #{@title} %h3.page-title #{title}
%p.light %p.light
From branch From branch
%strong= @ref %strong= @ref
.modal-body .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
.dropzone-previews.blob-upload-dropzone-previews .dropzone-previews.blob-upload-dropzone-previews
%p.dz-message.light %p.dz-message.light
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
%br %br
.dropzone-alerts{class: "alert alert-danger data", style: "display:none"} .dropzone-alerts{class: "alert alert-danger data", style: "display:none"}
= render 'shared/commit_message_container', params: params, = render 'shared/commit_message_container', params: params,
placeholder: @placeholder placeholder: placeholder
.form-group .form-group
.col-sm-offset-2.col-sm-10 .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" = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
:coffeescript :coffeescript
disableButtonIfEmptyField $('.blob-file-upload-form-js').find('#commit_message'), '.btn-upload-file' 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}')
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{ class: 'upload-link', 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal'} { class: 'upload-link', 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal'}
an existing one 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 .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 = form_tag(namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'form-horizontal form-new-file js-requires-input') do
......
...@@ -10,4 +10,8 @@ ...@@ -10,4 +10,8 @@
- if allowed_tree_edit? - if allowed_tree_edit?
= render 'projects/blob/remove' = 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment