<%= form_with model: note, url: note.new_record? ? aircraft_notes_path(aircraft) : aircraft_note_path(aircraft, note), class: "card card-body space-y-4 max-w-2xl" do |f| %> <%= f.errors_summary %> <%= f.field :text, as: :textarea, label: "Note", rows: 5, autofocus: true %> <%= f.field :public, as: :checkbox, label: "Show on share links" %>
<%= f.submit "Save Note" %><%= link_to "Cancel", aircraft_notes_path(aircraft), class: "btn-secondary" %>
<% end %> <% if note.persisted? %>
<%= delete_button "Delete note", aircraft_note_path(aircraft, note) %>
<% end %>