mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-10-04 13:52:06 +08:00
This switches Clover to use the form method for forms, which automatically handles adding the appropriate csrf tag, so you don't need to duplicate the path in a separate csrf_tag call. The form method comes from the forme_route_csrf plugin, which is what CloverAdmin already uses. While here, change some rodauth forms to use *_path instead of "/" + *_route. Also, change some "#{@project.path}#{@pg.path}" to path(@pg).
25 lines
675 B
Text
25 lines
675 B
Text
<%# locals: (url: request.path, csrf_url: url, text: "Delete", confirmation: nil, confirmation_message: nil, redirect: request.path, method: "DELETE") %>
|
|
|
|
<% button = part(
|
|
"components/button",
|
|
text: text,
|
|
icon: "hero-trash",
|
|
extra_class: "delete-btn",
|
|
type: "danger",
|
|
attributes: {
|
|
"data-url" => url,
|
|
"data-csrf" => csrf_token(csrf_url, method),
|
|
"data-confirmation" => confirmation,
|
|
"data-confirmation-message" => confirmation_message,
|
|
"data-redirect" => redirect,
|
|
"data-method" => method
|
|
}
|
|
) %>
|
|
|
|
<% if method == "POST" %>
|
|
<% form(action: url, method: :post) do %>
|
|
<%== button %>
|
|
<% end %>
|
|
<% else %>
|
|
<%== button %>
|
|
<% end %>
|