export const wizardMachine = {
initial: 'account',
states: {
account: {
next: 'profile',
canLeave: (data) => Boolean(data.email && data.password),
<h1>Create your account</h1>
<%= render "error_summary", record: @user %>
<%= form_with model: @user, url: signups_path do |f| %>
<div class="field">
class ArticlesController < ApplicationController
before_action :set_article, only: %i[edit update]
def new
@article = Article.new
end
<%= form_with model: @profile do |form| %>
<div
class="field"
data-controller="character-count"
data-character-count-max-value="280"
>
from django.forms import modelformset_factory
from django.shortcuts import render, redirect
from .models import Product
def bulk_edit_products(request):
package validate
import (
"regexp"
"unicode/utf8"
)
class WizardsController < ApplicationController
STEPS = %w[account profile confirm].freeze
before_action :set_step
def show
<%= turbo_stream.prepend 'items' do %>
<%= render @item %>
<% end %>
<turbo-stream action="reset_form" target="new_item_form"></turbo-stream>
from django.core.cache import cache
class RateLimiter:
def __init__(self, scope, limit, window_seconds):
self.scope = scope
<%= form_with url: bulk_update_orders_path, method: :patch, data: { turbo_confirm: "Update selected orders?" } do %>
<div class="batch-toolbar">
<%= select_tag :status,
options_for_select(Order.statuses.keys.map { |s| [s.humanize, s] }),
prompt: "Set status to\u2026" %>
<%= submit_tag "Apply to selected", class: "btn" %>
import { z } from 'zod';
export const signupSchema = z
.object({
email: z.string().min(1, 'Email is required').email('Enter a valid email'),
username: z
class CommentsController < ApplicationController
before_action :set_post
def new
@comment = @post.comments.build
end