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 @@ + +