2024-11-27 14:14:17 -05:00
|
|
|
<% content_for :title, @trip.name %>
|
|
|
|
|
|
2025-05-15 15:33:01 -04:00
|
|
|
<%= turbo_stream_from "trip_#{@trip.id}" %>
|
|
|
|
|
|
2024-11-28 11:13:04 -05:00
|
|
|
<div class="container mx-auto px-4 max-w-4xl my-5">
|
2024-11-27 14:14:17 -05:00
|
|
|
<div class="text-center mb-8">
|
|
|
|
|
<h1 class="text-4xl font-bold mb-2"><%= @trip.name %></h1>
|
2024-11-27 15:37:21 -05:00
|
|
|
<p class="text-md text-base-content/60">
|
|
|
|
|
<%= human_date(@trip.started_at) %> - <%= human_date(@trip.ended_at) %>
|
|
|
|
|
</p>
|
2025-05-15 15:33:01 -04:00
|
|
|
<% if @trip.countries.any? || @trip.visited_countries.present? %>
|
|
|
|
|
<div id="trip_countries">
|
|
|
|
|
<%= render "trips/countries", trip: @trip %>
|
|
|
|
|
</div>
|
|
|
|
|
<% else %>
|
|
|
|
|
<div id="trip_countries">
|
|
|
|
|
<p class="text-lg text-base-content/60">
|
|
|
|
|
<span>Countries are being calculated...</span>
|
|
|
|
|
<span class="loading loading-dots loading-sm"></span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2024-11-27 15:37:21 -05:00
|
|
|
<% end %>
|
2024-11-27 14:14:17 -05:00
|
|
|
</div>
|
|
|
|
|
|
2024-11-28 11:13:04 -05:00
|
|
|
<div class="bg-base-100 my-8 p-4">
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
2025-05-15 15:33:01 -04:00
|
|
|
<div class="w-full" id="trip_path">
|
|
|
|
|
<%= render "trips/path", trip: @trip, current_user: current_user %>
|
2024-11-27 14:14:17 -05:00
|
|
|
</div>
|
|
|
|
|
<div class="w-full">
|
2024-11-28 07:50:21 -05:00
|
|
|
<div>
|
2024-11-28 09:29:17 -05:00
|
|
|
<%= @trip.notes.body %>
|
2024-11-27 14:14:17 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Photos Grid Section -->
|
2024-12-10 13:31:52 -05:00
|
|
|
<% if @photo_previews.any? %>
|
|
|
|
|
<% @photo_previews.each_slice(4) do |slice| %>
|
2024-11-28 04:40:08 -05:00
|
|
|
<div class="h-32 flex gap-4 mt-4 justify-center">
|
|
|
|
|
<% slice.each do |photo| %>
|
|
|
|
|
<div class="flex-1 h-full overflow-hidden rounded-lg transition-transform duration-300 hover:scale-105 hover:shadow-lg">
|
|
|
|
|
<img
|
|
|
|
|
src="<%= photo[:url] %>"
|
|
|
|
|
loading='lazy'
|
|
|
|
|
class="h-full w-full object-cover"
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
2024-11-27 14:14:17 -05:00
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
2024-12-10 13:31:52 -05:00
|
|
|
<% if @photo_sources.any? %>
|
2024-12-10 12:49:37 -05:00
|
|
|
<div class="text-center mt-6">
|
2024-12-10 13:31:52 -05:00
|
|
|
<% @photo_sources.each do |source| %>
|
2024-12-10 12:49:37 -05:00
|
|
|
<%= link_to "More photos on #{source}", photo_search_url(source, current_user.settings, @trip.started_at, @trip.ended_at), class: "btn btn-primary mt-2", target: '_blank' %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
2024-11-27 14:14:17 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Action Buttons Section -->
|
|
|
|
|
<div class="bg-base-100 items-center">
|
|
|
|
|
<div class="flex flex-wrap gap-2 justify-center">
|
|
|
|
|
<%= link_to "Edit this trip", edit_trip_path(@trip), class: "btn" %>
|
|
|
|
|
<%= link_to "Destroy this trip",
|
|
|
|
|
trip_path(@trip),
|
|
|
|
|
data: {
|
2024-11-27 15:37:21 -05:00
|
|
|
turbo_confirm: "Are you sure?",
|
2024-11-27 14:14:17 -05:00
|
|
|
turbo_method: :delete
|
|
|
|
|
},
|
|
|
|
|
class: "btn" %>
|
|
|
|
|
<%= link_to "Back to trips", trips_path, class: "btn" %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|