Files
sure/app/views/rule/actions/_action.html.erb
Zach Gollwitzer 5da4bb6dc3 Subscription tests and domain (#2209)
* Save work

* Subscriptions and trials domain

* Store family ID on customer

* Remove indirection of stripe calls

* Test simplifications

* Update brakeman

* Fix stripe tests in CI

* Update billing page to show subscription details

* Remove legacy columns

* Complete billing settings page

* Fix hardcoded plan name

* Handle subscriptions for self hosting mode

* Lint fixes
2025-05-06 14:05:21 -04:00

43 lines
1.8 KiB
Plaintext

<%# locals: (form:) %>
<% action = form.object %>
<% rule = action.rule %>
<li data-controller="rule--actions" data-rule--actions-action-executors-value="<%= rule.action_executors.to_json %>" class="flex items-center gap-3">
<%= form.hidden_field :_destroy, value: false, data: { rule__actions_target: "destroyField" } %>
<div class="grow flex gap-2 items-center h-full">
<div class="grow">
<%= form.select :action_type, rule.action_executors.map { |executor| [ executor.label, executor.key ] }, {}, data: { action: "rule--actions#handleActionTypeChange" } %>
</div>
<%= tag.div class: class_names("min-w-1/2 flex items-center gap-2"),
data: { rule__actions_target: "actionValue" } do %>
<%# Initial rendering based on rule.action_executors.first from the rule form. %>
<%# This is currently always SetTransactionCategory from transaction_resource.rb, which is a select type. %>
<%# Subsequent renders are injected by the Stimulus controller, which uses the templates from below. %>
<span class="font-medium uppercase text-xs">to</span>
<%= form.select :value, action.options || [], {} %>
<% end %>
</div>
<%= icon(
"trash-2",
size: "sm",
as_button: true,
data: { action: "rule--actions#remove", rule__actions_destroy_param: action.persisted? }) %>
<%# Templates for different input types - these will be cloned and used by the Stimulus controller %>
<template data-rule--actions-target="selectTemplate">
<span class="font-medium uppercase text-xs">to</span>
<%= form.select :value, [], {} %>
</template>
<template data-rule--actions-target="textTemplate">
<span class="font-medium uppercase text-xs">to</span>
<%= form.text_field :value, placeholder: "Enter a value" %>
</template>
<%# The function type doesn't need an input, so no template is required.%>
</li>