b05ecb7809
User flows when editing a card look like: - Click "Edit" → the closure buttons are replaced by "Save changes" - Submit card form → Saves and restores closure buttons - Press ESC while editing → Cancels and restores closure buttons Also, renamed for clarity: - _title.html.erb → _content.html.erb Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
1.6 KiB
Plaintext
30 lines
1.6 KiB
Plaintext
<% if card.published? %>
|
|
<div data-turbo-permanent>
|
|
<%= turbo_frame_tag card, :edit do %>
|
|
<%# When canceling an edit (with the ESC key), restore the button area to show "Edit" instead of "Save changes". %>
|
|
<%= turbo_stream.update dom_id(card, :card_closure_toggle) do %>
|
|
<%= render "cards/container/closure_buttons", card: card %>
|
|
<% end %>
|
|
|
|
<%= render "cards/container/content_display", card: card %>
|
|
<% end %>
|
|
</div>
|
|
<% else %>
|
|
<%= form_with model: card, id: "card_form", data: { controller: "autoresize auto-save" } do |form| %>
|
|
<h1 class="card__title">
|
|
<%= form.label :title, class: "flex flex-column align-center autoresize__wrapper", data: { autoresize_target: "wrapper", autoresize_clone_value: "" } do %>
|
|
<%= form.text_area :title, placeholder: "Name it…",
|
|
class: "card-field__title autoresize__textarea input input--textarea full-width borderless txt-align-start hide-focus-ring hide-scrollbar",
|
|
autofocus: card.title.blank?, rows: 1, dir: "auto", maxlength: 255,
|
|
data: { autoresize_target: "textarea", action: "input->autoresize#resize auto-save#change blur->auto-save#submit keydown.enter->auto-save#submit:prevent" } %>
|
|
<% end %>
|
|
</h1>
|
|
|
|
<%= form.rich_textarea :description, class: "card__description rich-text-content",
|
|
placeholder: "Add some notes, context, pictures, or video about this…",
|
|
data: { action: "lexxy:change->auto-save#change focusout->auto-save#submit" } do %>
|
|
<%= general_prompts(card.board) %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|