User new direct uploads controllers action on documentable. Skipped spec.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<%= f.text_field :external_url %>
|
||||
</div>
|
||||
|
||||
<div class="images small-12 column" data-max-images="1">
|
||||
<div class="images small-12 column">
|
||||
<%= render 'images/nested_images', imageable: @investment %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
} %>
|
||||
|
||||
</div>
|
||||
<div class="small-6 column action-remove">
|
||||
<div class="small-6 column action-remove text-right">
|
||||
<% if @document.cached_attachment.present? %>
|
||||
<%= link_to t('documents.form.delete_button'),
|
||||
direct_upload_destroy_url("direct_upload[resource_type]": @document.documentable_type,
|
||||
@@ -41,7 +41,7 @@
|
||||
"direct_upload[cached_attachment]": @document.cached_attachment),
|
||||
method: :delete,
|
||||
remote: true,
|
||||
class: "delete float-right" %>
|
||||
class: "delete remove-cached-attachment" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div id="<%= document_nested_field_wrapper_id(index) %>" class="document">
|
||||
<div id="<%= document_nested_field_wrapper_id(index) %>" class="document direct-upload">
|
||||
<%= hidden_field_tag :id,
|
||||
document.id,
|
||||
name: document_nested_field_name(document, index, :id),
|
||||
@@ -12,21 +12,37 @@
|
||||
name: document_nested_field_name(document, index, :cached_attachment),
|
||||
id: document_nested_field_id(document, index, :cached_attachment) %>
|
||||
|
||||
<%= label_tag :title, t("activerecord.attributes.document.title") %>
|
||||
<div class="small-12 column">
|
||||
<%= label_tag :title, t("activerecord.attributes.document.title") %>
|
||||
|
||||
<%= text_field_tag :title,
|
||||
document.errors.has_key?(:attachment) ? "" : document.title,
|
||||
name: document_nested_field_name(document, index, :title),
|
||||
id: document_nested_field_id(document, index, :title),
|
||||
class: "document-title" %>
|
||||
<% if document.errors[:title].any? %>
|
||||
<small class="error"><%= document.errors[:title].join(", ") %></small>
|
||||
<% end %>
|
||||
<%= text_field_tag :title,
|
||||
document.errors.has_key?(:attachment) ? "" : document.title,
|
||||
name: document_nested_field_name(document, index, :title),
|
||||
id: document_nested_field_id(document, index, :title),
|
||||
class: "document-title" %>
|
||||
<% if document.errors[:title].any? %>
|
||||
<small class="error"><%= document.errors[:title].join(", ") %></small>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render_attachment(document, index) %>
|
||||
<div class="small-12 column attachment-actions">
|
||||
<div class="small-6 column action-add attachment-errors">
|
||||
<%= render_attachment(document, index) %>
|
||||
</div>
|
||||
<div class="small-6 column action-remove text-right">
|
||||
<%= render_destroy_document_link(document, index) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<p class="file-name">
|
||||
<%= document_attachment_file_name(document) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
|
||||
</div>
|
||||
|
||||
<%= render_destroy_document_link(document, index) %>
|
||||
<p class="file-name"><%= document_attachment_file_name(document) %></p>
|
||||
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
<% if params[:nested_document] == "true" %>
|
||||
|
||||
App.Documentable.destroyNestedDocument("<%= document_nested_field_wrapper_id(params[:index]) %>", "<%= j render('layouts/flash') %>")
|
||||
<% new_document_link = link_to t("documents.form.add_new_document"),
|
||||
new_nested_documents_path(documentable_type: @document.documentable_type, index: params[:index]),
|
||||
remote: true,
|
||||
id: "new_document_link",
|
||||
class: "button hollow" %>
|
||||
App.Documentable.updateNewDocumentButton("<%= j new_document_link %>")
|
||||
|
||||
<% else %>
|
||||
|
||||
App.Documentable.replacePlainDocument("plain_document_fields",
|
||||
"<%= j render('layouts/flash') %>",
|
||||
"<%= j render('plain_fields', document: @document) %>")
|
||||
|
||||
<% end %>
|
||||
App.Documentable.destroyNestedDocument("<%= document_nested_field_wrapper_id(params[:index]) %>")
|
||||
<% new_document_link = link_to t("documents.form.add_new_document"),
|
||||
new_nested_documents_path(documentable_type: @document.documentable_type, index: params[:index]),
|
||||
remote: true,
|
||||
id: "new_document_link",
|
||||
class: "button hollow" %>
|
||||
App.Documentable.updateNewDocumentButton("<%= j new_document_link %>")
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<%= t "documents.recommendation_three_html",
|
||||
max_file_size: max_file_size(@document.documentable) %>
|
||||
max_file_size: max_file_size(@document.documentable.class) %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<% if params[:nested_document] == "true" %>
|
||||
|
||||
App.Documentable.uploadNestedDocument("<%= document_nested_field_wrapper_id(params[:index]) %>",
|
||||
"<%= j render('documents/nested_fields', document: @document, index: params[:index]) %>",
|
||||
<%= @document.cached_attachment.present? %>)
|
||||
<% else %>
|
||||
|
||||
App.Documentable.uploadPlainDocument("plain_document_fields",
|
||||
"<%= j render('documents/plain_fields', document: @document) %>",
|
||||
<%= @document.cached_attachment.present? %>)
|
||||
|
||||
<% end %>
|
||||
@@ -24,7 +24,7 @@
|
||||
<%= f.file_field :attachment,
|
||||
accept: imageable_accepted_content_types_extensions,
|
||||
label: false,
|
||||
class: 'direct_upload_attachment',
|
||||
class: 'direct_upload_image_attachment',
|
||||
data: {
|
||||
url: direct_uploads_url("direct_upload[resource_type]": @image.imageable_type,
|
||||
"direct_upload[resource_id]": @image.imageable_id,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div id="<%= image_nested_field_wrapper_id %>" class="image">
|
||||
<div id="<%= image_nested_field_wrapper_id %>" class="image direct-upload">
|
||||
<%= hidden_field_tag :id,
|
||||
image.id,
|
||||
name: image_nested_field_name(image, :id),
|
||||
@@ -12,22 +12,37 @@
|
||||
name: image_nested_field_name(image, :cached_attachment),
|
||||
id: image_nested_field_id(image, :cached_attachment) %>
|
||||
|
||||
<%= label_tag :title, t("activerecord.attributes.image.title") %>
|
||||
<%= text_field_tag :title,
|
||||
image.title,
|
||||
placeholder: t("images.new.form.title_placeholder"),
|
||||
name: image_nested_field_name(image, :title),
|
||||
id: image_nested_field_id(image, :title),
|
||||
class: "image-title" %>
|
||||
<% if image.errors[:title].any? %>
|
||||
<small class="error"><%= image.errors[:title].join(", ") %></small>
|
||||
<% end %>
|
||||
<div class="small-12 column">
|
||||
<%= label_tag :title, t("activerecord.attributes.image.title") %>
|
||||
<%= text_field_tag :title,
|
||||
image.title,
|
||||
placeholder: t("images.new.form.title_placeholder"),
|
||||
name: image_nested_field_name(image, :title),
|
||||
id: image_nested_field_id(image, :title),
|
||||
class: "image-title" %>
|
||||
<% if image.errors[:title].any? %>
|
||||
<small class="error"><%= image.errors[:title].join(", ") %></small>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render_image(image, :thumb, false) if image.attachment.exists? %>
|
||||
|
||||
<%= render_image_attachment(image) %>
|
||||
<div class="small-12 column attachment-actions">
|
||||
<div class="small-6 column action-add attachment-errors">
|
||||
<%= render_image_attachment(image) %>
|
||||
</div>
|
||||
<div class="small-6 column action-remove">
|
||||
<%= render_destroy_image_link(image) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render_destroy_image_link(image) %>
|
||||
<p class="file-name"><%= image_attachment_file_name(image) %></p>
|
||||
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
|
||||
<div class="small-12 column">
|
||||
<p class="file-name">
|
||||
<%= image_attachment_file_name(image) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,2 @@
|
||||
<%
|
||||
new_image_link = link_to t("images.form.add_new_image"),
|
||||
new_nested_images_path(imageable_type: params[:imageable_type]),
|
||||
remote: true,
|
||||
id: "new_image_link",
|
||||
class: "button hollow"
|
||||
%>
|
||||
App.Imageable.new("<%= j render('images/nested_fields', image: @image) %>")
|
||||
App.Imageable.updateNewImageButton("<%= j new_image_link %>")
|
||||
App.DirectUploads.initializeDirectUpload($('#nested_image input.direct_upload_attachment[type=file]'))
|
||||
@@ -46,7 +46,7 @@
|
||||
<%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %>
|
||||
</div>
|
||||
|
||||
<div class="images small-12 column" data-max-images="1">
|
||||
<div class="images small-12 column">
|
||||
<%= render 'images/nested_images', imageable: @proposal %>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user