mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-06-08 08:30:31 +00:00
132 lines
6.7 KiB
Plaintext
132 lines
6.7 KiB
Plaintext
<div>
|
|
<h2><%= @title %></h2>
|
|
|
|
<.form
|
|
let={f}
|
|
for={@changeset}
|
|
id="song-form"
|
|
class="space-y-8 divide-y divide-gray-200"
|
|
phx-target={@myself}
|
|
phx-change="validate"
|
|
phx-submit="save">
|
|
|
|
<div class="space-y-8 divide-y divide-gray-200 sm:space-y-5">
|
|
<div class="pt-8 space-y-6 sm:pt-10 sm:space-y-5">
|
|
<div class="space-y-6 sm:space-y-5">
|
|
<div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-200 sm:pt-5">
|
|
<label for="song-form_title" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">
|
|
Title
|
|
</label>
|
|
<div class="mt-1 sm:mt-0 sm:col-span-2">
|
|
<%= text_input f, :title, class: "max-w-lg block w-full shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:max-w-xs sm:text-sm border-gray-300 rounded-md" %>
|
|
</div>
|
|
</div>
|
|
<%= error_tag f, :title %>
|
|
|
|
<div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-200 sm:pt-5">
|
|
<label for="song-form_artist" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">
|
|
Artist
|
|
</label>
|
|
<div class="mt-1 sm:mt-0 sm:col-span-2">
|
|
<%= text_input f, :artist, class: "max-w-lg block w-full shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:max-w-xs sm:text-sm border-gray-300 rounded-md" %>
|
|
</div>
|
|
</div>
|
|
<%= error_tag f, :artist %>
|
|
|
|
<div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-200 sm:pt-5">
|
|
<label for="country" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">
|
|
Genre
|
|
</label>
|
|
<div class="mt-1 sm:mt-0 sm:col-span-2">
|
|
<select id="song-form_genre_id" name="genre_id" class="max-w-lg block focus:ring-indigo-500 focus:border-indigo-500 w-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-md">
|
|
<%= for genre <- @genres do %>
|
|
<option value={genre.id}><%= genre.title %></option>
|
|
<% end %>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- upload -->
|
|
<div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-200 sm:pt-5">
|
|
<label for="cover-photo" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">
|
|
MP3
|
|
</label>
|
|
<div class="mt-1 sm:mt-0 sm:col-span-2" phx-drop-target={@uploads.mp3.ref}>
|
|
|
|
<%= if Enum.any?(@uploads.mp3.errors) do %>
|
|
<div class="rounded-md bg-red-50 p-4 mb-2">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-5 w-5 text-red-400" x-description="Heroicon name: solid/x-circle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="ml-3">
|
|
<h3 class="text-sm font-medium text-red-800">
|
|
Oops!
|
|
</h3>
|
|
<div class="mt-2 text-sm text-red-700">
|
|
<ul role="list" class="list-disc pl-5 space-y-1">
|
|
<%= for {_ref, error} <- @uploads.mp3.errors do %>
|
|
<li><.file_error kind={error} /></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="max-w-lg flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
|
|
<div class="space-y-1 text-center">
|
|
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48" aria-hidden="true">
|
|
<path d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
</svg>
|
|
<div class="flex text-sm text-gray-600">
|
|
<label for="file-upload" class="relative cursor-pointer bg-white rounded-md font-medium text-indigo-600 hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500">
|
|
<span phx-click={JS.dispatch("click", to: "##{@uploads.mp3.ref}")}>Upload a file</span>
|
|
<%= live_file_input @uploads.mp3, class: "sr-only" %>
|
|
</label>
|
|
<p class="pl-1">or drag and drop</p>
|
|
</div>
|
|
<p class="text-xs text-gray-500">
|
|
MP3 up to 20MB
|
|
</p>
|
|
<%= if Enum.any?(@uploads.mp3.entries) do %>
|
|
<br/>
|
|
<%= for entry <- @uploads.mp3.entries do %>
|
|
<div class="ring-4 ring-purple-100 rounded-full">
|
|
<%= entry.client_name %>
|
|
</div>
|
|
<br/>
|
|
<div class="bg-gray-200 flex-auto rounded-full overflow-hidden">
|
|
<div id="progress"
|
|
class="bg-purple-500 dark:bg-purple-400 h-1.5 w-0"
|
|
style={"width: #{entry.progress}%;"}>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /upload -->
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pt-5">
|
|
<div class="flex justify-end">
|
|
<button type="button" class="bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
|
Cancel
|
|
</button>
|
|
<button type="submit" class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
|
Save
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</.form>
|
|
</div>
|