1.3.0 • Published 3 years ago

@foxglovetech/turbo-form v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

CircleCI

Turbo Form

This library helps port some functionality from rails-ujs to Turbo.

If you've ever used link_to with remote: true and are thinking about using Turbo as a replacement to UJS - you'll need to do some extra work. However, Turbo give us everything we need to port over this functionality.

Thus, this library.

With this library, you just need to make some slight changes. For example,

Before

<%= link_to "Delete article", @article, remote: true, method: :delete %>

After

<%= link_to "Delete article", @article, data: { controller: "link-method", method: "delete" } %>

The idea is to continue moving forward with Turbo with minimal changes to existing app code.

Installation

yarn add @foxglovetech/turbo-form

Usage

Setup

The first you'll want to do is register the controllers:

import {
  ConfirmController,
  LinkMethodController,
} from "@foxglovetech/turbo-form";

const application = Application.start();
application.register("confirm", ConfirmController);
application.register("link-method", LinkMethodController);

ConfirmController

If you're looking for a confirmation dialog:

<%= button_to "Delete This", some_path(resource_name), data: { controller: "confirm", confirm_message: "Are you sure?" }, method: :delete %>

LinkMethodController

If you need a link to make a request:

<%= link_to "Duplicate", some_path(resource_name), data: { controller: "link-method", method: "post" } %>

Development

Checkout the CONTRIBUTING for info on how to help out with contributions/development.

License

This project is licensed under the MIT License

1.2.0

3 years ago

1.3.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.9.0

3 years ago

0.9.1

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago