Fix some tranlations on new image page. Add missing shared specs for imageable feature.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
</figcaption>
|
||||
<% end %>
|
||||
</figure>
|
||||
|
||||
|
||||
<% if show_caption %>
|
||||
<hr>
|
||||
<% end %>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<%= 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" %>
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= label_tag :image_title, t("activerecord.attributes.image.title") %>
|
||||
<%= text_field_tag :image_title, image.title, name: "image[title]", class: "image-title" %>
|
||||
<%= text_field_tag :image_title, image.title, placeholder: t("images.new.form.title_placeholder"), name: "image[title]", class: "image-title" %>
|
||||
<% if image.errors.has_key?(:title) %>
|
||||
<small class="error"><%= image.errors[:title].join(", ") %></small>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= render_image(image, :thumb, false) if image.attachment.exists? %>
|
||||
|
||||
<%= hidden_field_tag :cached_attachment, image.cached_attachment, name: "image[cached_attachment]" %>
|
||||
<%= file_field_tag :attachment,
|
||||
accept: imageable_accepted_content_types_extensions,
|
||||
|
||||
@@ -18,6 +18,8 @@ en:
|
||||
note: 'Add an image to your investment project: %{title}'
|
||||
proposal:
|
||||
note: 'Add an image to your proposal: %{title}'
|
||||
form:
|
||||
title_placeholder: Add a descriptive title for the image
|
||||
|
||||
recommendations_title: File upload tips
|
||||
proposal:
|
||||
|
||||
@@ -15,9 +15,11 @@ es:
|
||||
new:
|
||||
title: Subir una imagen
|
||||
budget_investment:
|
||||
note: 'Añade un título a la propuesta de inversión: %{title}.'
|
||||
note: 'Añade una imagen la propuesta de inversión: %{title}.'
|
||||
proposal:
|
||||
note: 'Añade un título a la propuesta: %{title}.'
|
||||
note: 'Añade una imagen a la propuesta: %{title}.'
|
||||
form:
|
||||
title_placeholder: Añade un título descriptivo para la imagen
|
||||
|
||||
recommendations_title: Consejos para subir imágenes
|
||||
proposal:
|
||||
|
||||
@@ -112,7 +112,17 @@ shared_examples "imageable" do |imageable_factory_name, imageable_path, imageabl
|
||||
expect(page).to have_selector("h1", text: "Upload image")
|
||||
end
|
||||
|
||||
scenario "Should display file name after file selection", :js do
|
||||
scenario "Should display file name after image selection", :js do
|
||||
login_as imageable.author
|
||||
visit new_image_path(imageable_type: imageable.class.name,
|
||||
imageable_id: imageable.id)
|
||||
|
||||
attach_file :image_attachment, "spec/fixtures/files/empty.pdf", make_visible: true
|
||||
|
||||
expect(page).to have_content "empty.pdf"
|
||||
end
|
||||
|
||||
scenario "Should not display file name after invalid image upload", :js do
|
||||
login_as imageable.author
|
||||
visit new_image_path(imageable_type: imageable.class.name,
|
||||
imageable_id: imageable.id)
|
||||
@@ -120,10 +130,10 @@ shared_examples "imageable" do |imageable_factory_name, imageable_path, imageabl
|
||||
attach_file :image_attachment, "spec/fixtures/files/empty.pdf", make_visible: true
|
||||
sleep 1
|
||||
|
||||
expect(page).to have_content "empty.pdf"
|
||||
expect(page).not_to have_content "empty.pdf"
|
||||
end
|
||||
|
||||
scenario "Should not display file name after file selection", :js do
|
||||
scenario "Should display attachment validation errors after invalid image upload", :js do
|
||||
login_as imageable.author
|
||||
visit new_image_path(imageable_type: imageable.class.name,
|
||||
imageable_id: imageable.id)
|
||||
@@ -131,7 +141,19 @@ shared_examples "imageable" do |imageable_factory_name, imageable_path, imageabl
|
||||
attach_file :image_attachment, "spec/fixtures/files/logo_header.png", make_visible: true
|
||||
sleep 1
|
||||
|
||||
expect(page).not_to have_content "logo_header.jpg"
|
||||
expect(page).to have_selector "small.error"
|
||||
end
|
||||
|
||||
scenario "Should display cached image without caption after valid image upload", :js do
|
||||
login_as imageable.author
|
||||
visit new_image_path(imageable_type: imageable.class.name,
|
||||
imageable_id: imageable.id)
|
||||
|
||||
attach_file :image_attachment, "spec/fixtures/files/clippy.jpg", make_visible: true
|
||||
sleep 1
|
||||
|
||||
expect(page).to have_css("figure img")
|
||||
expect(page).not_to have_css("figure figcaption")
|
||||
end
|
||||
|
||||
scenario "Should update loading bar style after valid file upload", :js do
|
||||
|
||||
Reference in New Issue
Block a user