Share This Trip

Generate a public link to share this trip with others.

<%= form_with model: trip, url: trip_path(trip), method: :patch, data: { turbo: false } do |f| %> <% if trip.sharing_enabled? %>
<% if trip.sharing_expired? %> This share link has expired <% else %> Sharing is enabled <% end %>
<%= f.submit "Disable Sharing", name: 'sharing[enabled]', value: '0', class: "btn btn-error flex-1", data: { turbo_confirm: "Are you sure you want to disable sharing for this trip?" } %>
<% else %>
<%= f.select 'sharing[expiration]', options_for_select([ ['1 hour', '1h'], ['12 hours', '12h'], ['24 hours', '24h'], ['Never (permanent)', 'permanent'] ], '24h'), {}, class: 'select select-bordered' %>
<%= f.hidden_field 'sharing[enabled]', value: '1' %> <%= f.submit "Enable Sharing", class: "btn btn-primary w-full" %>
<% end %> <% end %>