From 372a3d6c44b84b9ba74a26fa4ccb953c64e67ee8 Mon Sep 17 00:00:00 2001 From: Akito Omura Date: Thu, 28 Aug 2025 02:01:12 +0000 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=83=8F=E6=8B=A1=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/image_modal_controller.js | 1 + app/views/photo_spots/show.html.erb | 46 +++++++++++++++---- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/app/javascript/controllers/image_modal_controller.js b/app/javascript/controllers/image_modal_controller.js index 0b11fa7..c79e392 100644 --- a/app/javascript/controllers/image_modal_controller.js +++ b/app/javascript/controllers/image_modal_controller.js @@ -18,6 +18,7 @@ export default class extends Controller { this.showImage(this.indexValue); this.modalTarget.classList.remove("hidden"); this.updateNavigationButtons(); + console.log("image-modal#openが呼ばれた"); } // モーダルを閉じる diff --git a/app/views/photo_spots/show.html.erb b/app/views/photo_spots/show.html.erb index 3943395..8880f23 100644 --- a/app/views/photo_spots/show.html.erb +++ b/app/views/photo_spots/show.html.erb @@ -1,5 +1,6 @@ <% content_for :title, @photo_spot.name %> -
+
+
<% if notice.present? %>
<%= notice %> @@ -32,17 +33,20 @@ <% if @photo_spot.images.attached? %>
<% @photo_spot.images.limit(6).each_with_index do |image, index| %> -
- <%= image_tag image.variant(resize_to_fill: [400, 225]), - class: "w-full h-full object-cover group-hover:shadow-md transition-shadow duration-200", - alt: "#{@photo_spot.name}の画像#{index + 1}" %> - <% if index == 5 && @photo_spot.images.count > 6 %> -
- +
+ <%= image_tag image.variant(resize_to_fill: [400, 225]), + class: "w-full h-full object-cover group-hover:shadow-md transition-shadow duration-200", + alt: "#{@photo_spot.name}の画像#{index + 1}" %> + <% if index == 5 && @photo_spot.images.count > 6 %> +
+ +<%= @photo_spot.images.count - 6 %>枚 -
- <% end %> +
+ <% end %>
<% end %>
@@ -56,6 +60,26 @@ + +