diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 32530ce5..d8fe8c9f 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -11,6 +11,14 @@ $colors: ( "magenta": $magenta ); +// TODO: Encontrar la forma de generar esto desde los locales de Rails +$custom-file-text: ( + en: "Browse", + es: "Buscar archivo", + pt: "Buscar arquivo", + pt-BR: "Buscar arquivo" +); + // Redefinir variables de Bootstrap $primary: $magenta; $secondary: $black; @@ -111,12 +119,6 @@ $sizes: ( } } -// TODO: Encontrar la forma de generar esto desde los locales de Rails -$custom-file-text: ( - en: 'Browse', - es: 'Buscar archivo' -); - @font-face { font-family: 'Saira'; font-style: normal; diff --git a/app/views/posts/attributes/_file.haml b/app/views/posts/attributes/_file.haml index 20c27399..007f6b9f 100644 --- a/app/views/posts/attributes/_file.haml +++ b/app/views/posts/attributes/_file.haml @@ -26,6 +26,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)}", + lang: locale, data: { target: 'file-preview.input', action: 'file-preview#update' }) = label_tag "#{base}_#{attribute}_path", post_label_t(attribute, :path, post: post), class: 'custom-file-label' diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index 241a78e8..03d9d15f 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -23,6 +23,7 @@ **field_options(attribute, metadata, required: (metadata.required && !metadata.path?)), class: "custom-file-input #{invalid(post, attribute)}", accept: ActiveStorage.web_image_content_types.join(','), + lang: locale, data: { target: 'file-preview.input', action: 'file-preview#update' }) = label_tag "#{base}_#{attribute}_path", post_label_t(attribute, :path, post: post), class: 'custom-file-label'