74 lines
3.6 KiB
Plaintext
74 lines
3.6 KiB
Plaintext
<%= form_with(model: todo, class: "space-y-6") do |form| %>
|
|
<% if todo.errors.any? %>
|
|
<div class="bg-red-50 border-l-4 border-red-400 p-4 mb-6">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
|
<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" />
|
|
</svg>
|
|
</div>
|
|
<div class="ml-3">
|
|
<h3 class="text-sm font-medium text-red-800">
|
|
<%= pluralize(todo.errors.count, "error") %> prohibited this todo from being saved:
|
|
</h3>
|
|
<div class="mt-2 text-sm text-red-700">
|
|
<ul class="list-disc pl-5 space-y-1">
|
|
<% todo.errors.each do |error| %>
|
|
<li><%= error.full_message %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div>
|
|
<%= form.label :name, class: "block text-sm font-medium text-gray-700" %>
|
|
<div class="mt-1">
|
|
<%= form.text_field :name, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<%= form.label :description, class: "block text-sm font-medium text-gray-700" %>
|
|
<div class="mt-1">
|
|
<%= form.text_area :description, rows: 4, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
|
|
<p class="mt-2 text-sm text-gray-500">Brief description of what needs to be done.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-start">
|
|
<div class="flex items-center h-5">
|
|
<%= form.check_box :completed, class: "focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" %>
|
|
</div>
|
|
<div class="ml-3 text-sm">
|
|
<%= form.label :completed, class: "font-medium text-gray-700" %>
|
|
<p class="text-gray-500">Mark as completed if the task is done.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<%= form.label :priority, class: "block text-sm font-medium text-gray-700" %>
|
|
<div class="mt-1">
|
|
<%= form.number_field :priority, in: 0..5, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
|
|
<p class="mt-2 text-sm text-gray-500">Set a priority from 0 (lowest) to 5 (highest).</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<%= form.label :project_id, class: "block text-sm font-medium text-gray-700" %>
|
|
<div class="mt-1">
|
|
<%= form.collection_select :project_id, Project.all, :id, :name,
|
|
{ prompt: "Select a project" },
|
|
{ class: "mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md" } %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pt-5">
|
|
<div class="flex justify-end">
|
|
<%= link_to "Cancel", todos_path, 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" %>
|
|
<%= form.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" %>
|
|
</div>
|
|
</div>
|
|
<% end %> |