diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index d50774fa..8482ede0 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -15,10 +15,17 @@ $colors: ( $custom-file-text: ( en: "Browse", es: "Buscar archivo", - pt: "Buscar arquivo", + pt: "Buscar ficheiro", pt-BR: "Buscar arquivo" ); +$custom-file-text-replace: ( + en: "Replace file", + es: "Reemplazar archivo", + pt: "substituir ficheiro", + pt-BR: "substituir arquivo" +); + // Redefinir variables de Bootstrap $primary: $magenta; $secondary: $black; @@ -53,6 +60,16 @@ $sizes: ( @import "bootstrap"; @import "editor"; +.custom-file-input { + &.replace-image { + @each $lang, $value in $custom-file-text-replace { + &:lang(#{$lang}) ~ .custom-file-label::after { + content: $value; + } + } + } +} + @each $color, $rgb in $theme-colors { .#{$color} { color: var(--#{$color}); diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index 010a53aa..69e99847 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -22,7 +22,7 @@ .custom-file = file_field(*field_name_for(base, attribute, :path), **field_options(attribute, metadata, required: (metadata.required && !metadata.path?)), - class: "custom-file-input #{invalid(post, attribute)}", + class: ['custom-file-input', invalid(post, attribute), ('replace-image' if metadata.static_file)].compact.join(' '), accept: ActiveStorage.web_image_content_types.join(','), lang: locale, data: { 'file-preview-target': 'input', action: 'file-preview#update' })