From 57a39ebb4d2fc370c6f42d2716254f1606460b98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com>
Date: Fri, 5 Nov 2021 16:37:04 +0100
Subject: [PATCH] width 800 for images in action text

---
 app/views/active_storage/blobs/_blob.html.erb               | 6 +++---
 app/views/admin/communication/website/pages/jekyll.html.erb | 3 +++
 app/views/admin/communication/website/posts/jekyll.html.erb | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/app/views/active_storage/blobs/_blob.html.erb b/app/views/active_storage/blobs/_blob.html.erb
index 6ad1c8ba6..5cf68aa5f 100644
--- a/app/views/active_storage/blobs/_blob.html.erb
+++ b/app/views/active_storage/blobs/_blob.html.erb
@@ -1,14 +1,14 @@
 <figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
   <% if blob.image? %>
-    <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
+    <%= image_tag blob.representation(resize_to_limit: '800x') %>
   <% elsif blob.video? %>
     <video>
       <source src="<%= rails_blob_path(blob) %>" type="<%= blob.content_type %>">
     </video>
   <% else %>
-    <%= link_to blob, target: :blank do %>
+    <%= link_to polymorphic_url(blob), target: :blank do %>
       <% if blob.representable? %>
-        <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
+        <%= image_tag blob.representation(resize_to_limit: '800x') %>
       <% else %>
         <p>
           <span class="attachment__name"><%= blob.filename %></span>
diff --git a/app/views/admin/communication/website/pages/jekyll.html.erb b/app/views/admin/communication/website/pages/jekyll.html.erb
index 8d5582b04..c7ee6dace 100644
--- a/app/views/admin/communication/website/pages/jekyll.html.erb
+++ b/app/views/admin/communication/website/pages/jekyll.html.erb
@@ -3,6 +3,9 @@ title: "<%= @page.title %>"
 permalink: "<%= @page.path %>"
 identifier: "<%= @page.id %>"
 parent: "<%= @page.parent_id %>"
+<% if @page.featured_image.attached? %>
+image: "<%= @page.featured_image.blob.id %>"
+<% end %>
 description: >
   <%= prepare_for_github @page.description %>
 text: >
diff --git a/app/views/admin/communication/website/posts/jekyll.html.erb b/app/views/admin/communication/website/posts/jekyll.html.erb
index 72ba13921..054bc8988 100644
--- a/app/views/admin/communication/website/posts/jekyll.html.erb
+++ b/app/views/admin/communication/website/posts/jekyll.html.erb
@@ -3,7 +3,7 @@ title: "<%= @post.title %>"
 date: <%= @post.published_at %> UTC
 slug: "<%= @post.slug %>"
 <% if @post.featured_image.attached? %>
-image: "<%= @post.featured_image.blob.url %>"
+image: "<%= @post.featured_image.blob.id %>"
 <% end %>
 description: >
   <%= prepare_for_github @post.description %>
-- 
GitLab