Skip to content

Commit

Permalink
use rndeer partial in action form component for different actions
Browse files Browse the repository at this point in the history
  • Loading branch information
celuchmarek committed Jul 23, 2024
1 parent d33a342 commit 3f363d4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
14 changes: 2 additions & 12 deletions app/components/settings/rules/action_form_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
<%= tag.turbo_frame id: "action-#{@index}", class: "flex justify-between self-stretch grow" do %>
<div class="flex justify-stretch gap-2">
<%= @form.hidden_field :id %>
<% if @form.object.type.in? ['Automation::AddTagAction', 'Automation::AddMessageThreadTagAction'] %>
<%= @form.select :type, @action_type_list, {}, onchange: "this.form.requestSubmit(this.form.querySelector(\"#rerender\"))", class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %>
<%= @form.select :action_object_id, @form.object.tag_list, {}, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %>
<%= @form.hidden_field :action_object_type, value: 'Tag' %>
<% elsif @form.object.type.in? ['Automation::FireWebhookAction'] %>
<%= @form.select :type, @action_type_list, {}, onchange: "this.form.requestSubmit(this.form.querySelector(\"#rerender\"))", class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %>
<%= @form.select :action_object_id, helpers.webhook_action_select_options(Current.tenant.automation_webhooks), {}, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %>
<%= @form.hidden_field :action_object_type, value: 'Automation::Webhook' %>
<% else %>
<%= @form.select :type, @action_type_list, {}, onchange: "this.form.requestSubmit(this.form.querySelector(\"#rerender\"))", class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %>
<%= @form.text_field :value, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %>
<% end %>
<%= @form.select :type, @action_type_list, {}, onchange: "this.form.requestSubmit(this.form.querySelector(\"#rerender\"))", class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !@enabled %>
<%= render partial: "edit_form_#{@form.object.model_name.name.demodulize.underscore}", object: @form.object, locals: {form: @form, enabled: @enabled} %>
</div>
<% if @enabled %>
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= form.select :action_object_id, form.object.tag_list, {}, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !enabled %>
<%= form.hidden_field :action_object_type, value: 'Tag' %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= form.select :action_object_id, form.object.tag_list, {}, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !enabled %>
<%= form.hidden_field :action_object_type, value: 'Tag' %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= form.select :action_object_id, form.object.tag_list, {}, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !enabled %>
<%= form.hidden_field :action_object_type, value: 'Tag' %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= form.select :action_object_id, webhook_action_select_options(Current.tenant.automation_webhooks), {}, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !enabled %>
<%= form.hidden_field :action_object_type, value: 'Automation::Webhook' %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= form.select :action_object_id, form.object.tag_list, {}, class: "mt-2 block rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-400 ring-1 ring-inset ring-gray-400 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6", disabled: !enabled %>
<%= form.hidden_field :action_object_type, value: 'Tag' %>

0 comments on commit 3f363d4

Please sign in to comment.