diff --git a/app/assets/images/apercu-indisponible.png b/app/assets/images/apercu-indisponible.png index 83ed22706..6bebd9f59 100644 Binary files a/app/assets/images/apercu-indisponible.png and b/app/assets/images/apercu-indisponible.png differ diff --git a/app/assets/stylesheets/gallery.scss b/app/assets/stylesheets/gallery.scss index 55580c607..eb2bec9ee 100644 --- a/app/assets/stylesheets/gallery.scss +++ b/app/assets/stylesheets/gallery.scss @@ -33,16 +33,18 @@ color: var(--text-active-blue-france); border: 1px solid var(--border-active-blue-france); padding: 0.25rem 0.75rem; - - &:hover { - background-color: var(--hover-tint); - } - - &:active { - background-color: var(--active-tint); - } + display: none; } } + + a.gallery-link:hover .fr-btn, + a.gallery-link:active .fr-btn { + display: flex; + } + + a.gallery-link:active .fr-btn { + background-color: var(--hover-tint); + } } .gallery-pieces-jointes { @@ -52,17 +54,16 @@ .gallery-item { margin: 0 2rem 1.5rem 0; } - - img { - height: 200px; - width: 200px; - } } .gallery-demande { - img { - height: 150px; - width: 150px; + .gallery-items-list { + display: flex; + flex-wrap: wrap; + } + + .gallery-item { + margin: 0.5rem 2rem 1rem 0; } .fr-download { @@ -71,7 +72,7 @@ .thumbnail { width: fit-content; - margin-bottom: 1rem; + margin-bottom: 0.5rem; } } diff --git a/app/views/shared/champs/piece_justificative/_show.html.haml b/app/views/shared/champs/piece_justificative/_show.html.haml index 525546d8f..50218e54b 100644 --- a/app/views/shared/champs/piece_justificative/_show.html.haml +++ b/app/views/shared/champs/piece_justificative/_show.html.haml @@ -4,21 +4,24 @@ - champ.piece_justificative_file.attachments.each do |attachment| %li= render Attachment::ShowComponent.new(attachment:, new_tab: true) - else - - champ.piece_justificative_file.attachments.each do |attachment| - %ul - %li= render Attachment::ShowComponent.new(attachment:, new_tab: true, truncate: true) - .gallery-item - - blob = attachment.blob - - if blob.content_type.in?(AUTHORIZED_PDF_TYPES) - = link_to blob.url, id: blob.id, data: { iframe: true, src: blob.url }, class: 'gallery-link', type: blob.content_type, title: "#{champ.libelle} -- #{blob.filename}" do - .thumbnail - = image_tag("pdf-placeholder.png") - .fr-btn.fr-btn--tertiary.fr-btn--icon-left.fr-icon-eye{ role: :button } - = 'Visualiser' + .gallery-items-list + - champ.piece_justificative_file.attachments.each do |attachment| + .gallery-item + - blob = attachment.blob + - if blob.content_type.in?(AUTHORIZED_PDF_TYPES) + = link_to blob.url, id: blob.id, data: { iframe: true, src: blob.url }, class: 'gallery-link', type: blob.content_type, title: "#{champ.libelle} -- #{blob.filename}" do + .thumbnail + = image_tag("pdf-placeholder.png") + .fr-btn.fr-btn--tertiary.fr-btn--icon-left.fr-icon-eye{ role: :button } + = 'Visualiser' - - elsif blob.content_type.in?(AUTHORIZED_IMAGE_TYPES) - = link_to image_url(blob.url), title: "#{champ.libelle} -- #{blob.filename}", data: { src: blob.url }, class: 'gallery-link' do + - elsif blob.content_type.in?(AUTHORIZED_IMAGE_TYPES) + = link_to image_url(blob.url), title: "#{champ.libelle} -- #{blob.filename}", data: { src: blob.url }, class: 'gallery-link' do + .thumbnail + = image_tag(attachment.variant(:medium), loading: :lazy) + .fr-btn.fr-btn--tertiary.fr-btn--icon-left.fr-icon-eye{ role: :button } + = 'Visualiser' + - else .thumbnail - = image_tag(attachment.variant(:small), loading: :lazy) - .fr-btn.fr-btn--tertiary.fr-btn--icon-left.fr-icon-eye{ role: :button } - = 'Visualiser' + = image_tag('apercu-indisponible.png') + = render Attachment::ShowComponent.new(attachment:, new_tab: true, truncate: true)