From 2086ade1a7d4acf92b5a7df4e3fca9867c25aa3d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:21:33 -0300 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20solo=20permitir=20subir=20im=C3=A1ge?= =?UTF-8?q?nes=20para=20web=20#13009?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/posts/attributes/_image.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index f4d9bb3d..84fe56fd 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -22,7 +22,7 @@ = file_field(*field_name_for(base, attribute, :path), **field_options(attribute, metadata, required: (metadata.required && !metadata.path?)), class: "custom-file-input #{invalid(post, attribute)}", - accept: 'image/*', data: { preview: "#{attribute}-preview" }) + accept: ActiveStorage.web_image_content_types.join(','), data: { preview: "#{attribute}-preview" }) = label_tag "#{base}_#{attribute}_path", post_label_t(attribute, :path, post: post), class: 'custom-file-label' = render 'posts/attribute_feedback', From 563060e1132df7db6aa3e13a8323ed9144a80e8a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:22:49 -0300 Subject: [PATCH 2/3] feat: permitir subir webp --- config/application.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/application.rb b/config/application.rb index 97ab244c..941caa68 100644 --- a/config/application.rb +++ b/config/application.rb @@ -37,6 +37,7 @@ module Sutty .rescue_responses['Pundit::NotAuthorizedError'] = :forbidden config.active_storage.variant_processor = :vips + config.active_storage.web_image_content_types << 'image/webp' config.to_prepare do # Load application's model / class decorators From f2b6e2929c317c9ad1b216e7d3ae59fdba85c747 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:29:13 -0300 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20informar=20cu=C3=A1les=20formatos=20?= =?UTF-8?q?aceptamos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..50392ed3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -50,7 +50,7 @@ en: cant_be_empty: 'This field cannot be empty' image: site_invalid: 'The image cannot be stored if the site configuration is not valid' - not_an_image: 'Not an image' + not_an_image: 'Not a web image. Accepted formats: PNG, JPEG, GIF, WEBP' path_required: 'Missing image for upload' no_file_for_description: "Description with no associated image" attachment_missing: "I couldn't save the image :(" diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..340e3d6a 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -50,7 +50,7 @@ es: cant_be_empty: 'El campo no puede estar vacío' image: site_invalid: 'La imagen no se puede almacenar si la configuración del sitio no es válida' - not_an_image: 'No es una imagen' + not_an_image: 'No es una imagen en formato web. Formatos aceptados: PNG, JPEG, GIF, WEBP' path_required: 'Se necesita una imagen' no_file_for_description: 'Se envió una descripción sin imagen asociada' attachment_missing: 'no pude guardar el archivo :('