Files
ubicloud/views/components/inline_edit_buttons.erb
Burak Yucesoy 9c4124ba80 Add edit inline button components
This commits adds a components for inline editing functionality. It has three
buttons. The first one starts inline editing. When clicked, it converts the
text into an editable input field, allowing users to modify the content
directly on the page. The second button is for saving the changes made
to the inline edit. It captures the modified content and updates the
server with the new value. The third button is for canceling the inline edit,
discarding any changes made during the editing process and reverting the
content back to its original state.
2025-05-29 02:44:27 +03:00

35 lines
746 B
Plaintext

<%# locals: (url: request.path, csrf_url: url, confirmation_message: nil) %>
<div class="group-[.active]/inline-editable:hidden block">
<%== part(
"components/button",
text: "",
icon: "hero-pencil",
extra_class: "edit-inline-btn",
type: "warning"
) %>
</div>
<div class="group-[.active]/inline-editable:block hidden">
<%== part(
"components/button",
text: "",
icon: "hero-check-circle",
extra_class: "save-inline-btn",
type: "safe",
attributes: {
"data-url" => url,
"data-csrf" => csrf_token(csrf_url, "PATCH"),
"data-confirmation-message" => confirmation_message
}
) %>
<%== part(
"components/button",
text: "",
icon: "hero-x-circle",
extra_class: "cancel-inline-btn",
type: "danger"
) %>
</div>