mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-17 01:42:53 +00:00
Moving to github
This commit is contained in:
32
app/views/collections/_form.html.erb
Normal file
32
app/views/collections/_form.html.erb
Normal file
@@ -0,0 +1,32 @@
|
||||
<%= form_with model: collection, class: "space-y-6" do |f| %>
|
||||
<% if collection.errors.any? %>
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
||||
<ul>
|
||||
<% collection.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= f.label :name, class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= f.text_field :name, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= f.label :description, class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= f.text_area :description, rows: 4, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= f.label :parent_collection_id, "Parent Collection (optional)", class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= f.collection_select :parent_collection_id, @collections, :id, :name, { include_blank: "None (Root Collection)" }, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
|
||||
<p class="mt-1 text-sm text-gray-500">Subcollections can only be one level deep</p>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between">
|
||||
<%= f.submit class: "px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700" %>
|
||||
<%= link_to "Cancel", collection.persisted? ? collection : collections_path, class: "px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300" %>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user