This library builds on top of turbo-form by providing template helpers specifically for Ruby on Rails.
gem "turbo_form", git: "https://github.com/alvincrespo/turbo-form-rails.git"
Note: I know, this isn't great - but I'll be implementing versioning soon.
<%= turbo_confirm "Delete", delete_path(@resource) %>
If you provide the as: :button
option, you'll get the following:
<%= turbo_confirm "Cancel Account", registration_path(resource_name), as: "button" %>
<form class="button_to" method="post" action="/users">
<input type="hidden" name="_method" value="delete" />
<input
data-controller="confirm"
data-confirm-message="Are you sure?"
type="submit"
value="Delete"
/>
<input type="hidden" name="authenticity_token" value="[REDACTED]" />
</form>
<%= turbo_link "Add", add_path(@resource) %>
This will generate the following:
<a
data-controller="link-method"
rel="nofollow"
data-method="post"
href="/some/path"
>Add</a
>
Checkout the CONTRIBUTING for info on how to help out with contributions/development.
This project is licensed under the MIT License