diff --git a/app/views/admin/communication/blocks/templates/files/_preview.html.erb b/app/views/admin/communication/blocks/templates/files/_preview.html.erb index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..48e6bad1ff4411e5e3f139abddedd493eaa25213 100644 --- a/app/views/admin/communication/blocks/templates/files/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_preview.html.erb @@ -0,0 +1,19 @@ +<ul> + <% @block.template.files.each do |file| %> + <% file.title ||= file.blob.filename if file.blob %> + <% if file.title + title = file.title + elsif file.blob + title = file.blob.filename + else + title = '' + end %> + <li> + <% if file.blob %> + <a href="<%= file.blob.url %>" download><%= title %> <small>(<%= file.blob.filename %>)</small></a> + <% else %> + <%= title %> <small>(<%= t 'admin.communication.blocks.components.file.not_linked' %>)</small> + <% end %> + </li> + <% end %> +</ul> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/files/_static.html.erb b/app/views/admin/communication/blocks/templates/files/_static.html.erb index bf2a453f5ae34a6ef7bd69fde13a505c65483729..cbfb04c22cc65b327b433099652b03f2e2f74168 100644 --- a/app/views/admin/communication/blocks/templates/files/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_static.html.erb @@ -1,5 +1,5 @@ files: <% block.template.files.each do |file| %> - title: "<%= file.title %>" - id: "<%= file.blob.id %>" + id: "<%= file.blob.id if file.blob %>" <% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 1a6257f0f3a4286308f7c229f43c4f08cb7b6d4b..03e75b9218918a6e371f90e67593e5f78ad7bb54 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -137,6 +137,8 @@ en: credit: label: Credit placeholder: Enter credit + file: + not_linked: Pas de fichier lié template_kinds: call_to_action: edit: @@ -179,10 +181,10 @@ en: files: edit: add_file: Add a file - remove_file: Remove a file file_label: File title_label: Title title_placeholder: Enter title here + remove_file: Remove a file gallery: edit: add_image: Add image diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 5d7f1a2cb15556d0cc88d3996e09923069230c43..a406c0e00ede63134167eae90abb283944c11348 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -137,6 +137,9 @@ fr: credit: label: Crédit placeholder: Entrer le crédit + file: + not_linked: Pas de fichier lié + templates: call_to_action: edit: @@ -179,10 +182,10 @@ fr: files: edit: add_file: Ajouter un fichier - remove_file: Supprimer le fichier file_label: Fichier title_label: Titre - title_placeholder: Entrer le titre du fichier + title_placeholder: Entrer le titre du fichier + remove_file: Supprimer le fichier gallery: edit: add_image: Ajouter une image