From e64b5500beb42b88a10d398edbbf9d01b299b521 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Wed, 1 Feb 2023 19:34:22 +0100
Subject: [PATCH] pexels selector

---
 .../communication/photo_import/pexels.json.jbuilder | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/app/views/admin/communication/photo_import/pexels.json.jbuilder b/app/views/admin/communication/photo_import/pexels.json.jbuilder
index ad0ef5a83..86990843f 100644
--- a/app/views/admin/communication/photo_import/pexels.json.jbuilder
+++ b/app/views/admin/communication/photo_import/pexels.json.jbuilder
@@ -1,10 +1,9 @@
 json.total @total
 json.total_pages @total_pages
-json.results @search do |photo|
-  json.id photo['id']
-  json.filename "#{photo['id']}.jpg"
-  json.alt photo['alt_description']
-  json.credit "Photo by <a href=\"https://www.pexels.com/@daria\">Daria</a> on <a href=\"https://www.pexels.com\">Pexels</a>"
-  json.thumb photo['urls']['small']
-  json.preview photo['urls']['regular']
+json.results @search.photos do |photo|
+  json.id photo.id
+  json.filename "#{photo.id}.png"
+  json.credit "Photo by <a href=\"#{photo.user.url}\">#{photo.user.name}</a> on <a href=\"https://www.pexels.com\">Pexels</a>"
+  json.thumb photo.src['medium']
+  json.preview photo.src['large']
 end
-- 
GitLab