import { Application } from "@hotwired/stimulus"
import FormSubmitController from "./controllers/form_submit_controller"
const application = Application.start()
application.debug = false
<h1>Products</h1>
<%= form_with url: products_path, method: :get,
data: { turbo_frame: "products_list", turbo_action: "advance" } do |f| %>
<div class="filters">
<%= f.text_field :q, value: params[:q], placeholder: "Search products" %>
class ProductsController < ApplicationController
before_action :set_product, only: %i[edit update]
def index
@products = Product.order(:name)
end
class Recipe < ApplicationRecord
has_many :ingredients, inverse_of: :recipe, dependent: :destroy
accepts_nested_attributes_for :ingredients,
allow_destroy: true,
reject_if: :all_blank
<h1>Products</h1>
<%= link_to "New product", new_product_path, data: { turbo_frame: "modal" }, class: "btn" %>
<table id="products">
<tbody>
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["input"]
static values = { wait: { type: Number, default: 300 }, url: String }
<div class="orders-layout" data-controller="drawer">
<table class="orders">
<tbody>
<% @orders.each do |order| %>
<tr>
<td><%= order.reference %></td>
import { useCallback, useEffect, useRef, useState } from 'react';
export type CopyStatus = 'idle' | 'copied' | 'error';
function fallbackCopy(text: string): boolean {
const textarea = document.createElement('textarea');
class SignupsController < ApplicationController
def new
@user = User.new
end
def create
<%= turbo_frame_tag dom_id(contact) do %>
<tr class="contact-row">
<td><%= contact.name %></td>
<td><%= contact.email %></td>
<td><%= contact.role.titleize %></td>
<td class="actions">
Rails.application.routes.draw do
concern :tabs do
get :profile, on: :collection
get :billing, on: :collection
get :security, on: :collection
end
class CommentsController < ApplicationController
before_action :set_post
def create
@comment = @post.comments.build(comment_params)