mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
UI: Move sharing controls to DaisyUI modal
- Add Share Trip button under trip dates - Button displays 'Share Trip' or 'Manage Sharing' based on state - Convert sharing partial to use DaisyUI 4 modal dialog - Modal can be closed via X button, backdrop click, or ESC key - All sharing functionality remains intact within modal
This commit is contained in:
parent
b1cbb5555f
commit
9a060c14dd
2 changed files with 26 additions and 7 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
<div class="card bg-base-100 shadow-lg mt-6">
|
<dialog id="sharing_modal_<%= trip.id %>" class="modal">
|
||||||
<div class="card-body">
|
<div class="modal-box max-w-2xl">
|
||||||
<h3 class="card-title">Share This Trip</h3>
|
<form method="dialog">
|
||||||
|
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<h3 class="font-bold text-lg mb-4">Share This Trip</h3>
|
||||||
<p class="text-sm text-base-content/70 mb-4">
|
<p class="text-sm text-base-content/70 mb-4">
|
||||||
Generate a public link to share this trip with others.
|
Generate a public link to share this trip with others.
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -35,6 +39,7 @@
|
||||||
class="input input-bordered flex-1"
|
class="input input-bordered flex-1"
|
||||||
id="sharing-url-<%= trip.id %>">
|
id="sharing-url-<%= trip.id %>">
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
class="btn btn-square"
|
class="btn btn-square"
|
||||||
onclick="navigator.clipboard.writeText(document.getElementById('sharing-url-<%= trip.id %>').value).then(() => {
|
onclick="navigator.clipboard.writeText(document.getElementById('sharing-url-<%= trip.id %>').value).then(() => {
|
||||||
const btn = this;
|
const btn = this;
|
||||||
|
|
@ -95,7 +100,7 @@
|
||||||
['Never (permanent)', 'permanent']
|
['Never (permanent)', 'permanent']
|
||||||
], '24h'),
|
], '24h'),
|
||||||
{},
|
{},
|
||||||
class: 'select select-bordered' %>
|
class: 'select select-bordered w-full' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
|
|
@ -123,4 +128,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<form method="dialog" class="modal-backdrop">
|
||||||
|
<button>close</button>
|
||||||
|
</form>
|
||||||
|
</dialog>
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,21 @@
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="text-center mb-8">
|
<div class="text-center mb-8">
|
||||||
<h1 class="text-4xl font-bold mb-2"><%= @trip.name %></h1>
|
<h1 class="text-4xl font-bold mb-2"><%= @trip.name %></h1>
|
||||||
<p class="text-md text-base-content/60 mb-4">
|
<p class="text-md text-base-content/60 mb-2">
|
||||||
<%= human_date(@trip.started_at) %> - <%= human_date(@trip.ended_at) %>
|
<%= human_date(@trip.started_at) %> - <%= human_date(@trip.ended_at) %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<button onclick="sharing_modal_<%= @trip.id %>.showModal()" class="btn btn-sm btn-ghost gap-2 mb-4">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z" />
|
||||||
|
</svg>
|
||||||
|
<% if @trip.sharing_enabled? %>
|
||||||
|
<span>Manage Sharing</span>
|
||||||
|
<% else %>
|
||||||
|
<span>Share Trip</span>
|
||||||
|
<% end %>
|
||||||
|
</button>
|
||||||
|
|
||||||
<%= render "trips/countries", trip: @trip, current_user: current_user, distance_unit: current_user.safe_settings.distance_unit %>
|
<%= render "trips/countries", trip: @trip, current_user: current_user, distance_unit: current_user.safe_settings.distance_unit %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -65,6 +76,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Sharing Section -->
|
<!-- Sharing Modal -->
|
||||||
<%= render "trips/sharing", trip: @trip %>
|
<%= render "trips/sharing", trip: @trip %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue