From 5e416836e656e8e4a2099833e7b4edd77599a1ef Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Tue, 2 Jan 2024 14:28:43 +1100 Subject: [PATCH] Lazy load images on photo admin page --- slices/admin/templates/photos/index.html.slim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slices/admin/templates/photos/index.html.slim b/slices/admin/templates/photos/index.html.slim index 1b998ad..63f804c 100644 --- a/slices/admin/templates/photos/index.html.slim +++ b/slices/admin/templates/photos/index.html.slim @@ -14,9 +14,9 @@ div class="mb-4 max-w-prose mx-auto prose dark:prose-invert" - photos.each_with_index do |photo, idx| - next if photo.match(/small/) div class="rounded max-w-xs" x-data="" id="photo-#{idx}" - img class="rounded object-cover hover:opacity-80 h-48 w-48 mb-2" src="/#{photo.gsub("public/", "")}" + img loading="lazy" class="rounded object-cover hover:opacity-80 h-48 w-48 mb-2" src="/#{photo.gsub("public/", "")}" div class="grid grid-cols-2 gap-2" button class="hover:text-blue-400 p-1 bg-blue-100 rounded text-blue-600 no-underline" @click="$clipboard('#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")}')" Copy URL button class="hover:text-blue-400 p-1 bg-blue-100 rounded text-blue-600 no-underline" @click="$clipboard('![](#{Hanami.app.settings.micropub_site_url}/#{photo.gsub("public/", "")})')" Copy .md div class="grid grid-cols-1" - button class="text-red-600 p-1 bg-red-50 rounded hover:text-red-400 mt-2" hx-delete="/admin/media/#{photo}" hx-target="#photo-#{idx}" Delete \ No newline at end of file + button class="text-red-600 p-1 bg-red-50 rounded hover:text-red-400 mt-2" hx-delete="/admin/media/#{photo}" hx-target="#photo-#{idx}" Delete