Carica oggetto e corpo dell'email appena si sceglie un template A/B.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
<%= f.check_box :ab_test, { data: { ab_test_target: "checkbox", action: "ab-test#toggle" } } %>
|
||||
<span>
|
||||
<span class="font-medium">Test A/B su questa comunicazione</span>
|
||||
<span class="mt-1 block text-xs text-zinc-500">Due versioni di oggetto e HTML. Ogni destinatario riceve A o B.</span>
|
||||
<span class="mt-1 block text-xs text-zinc-500">Due versioni della stessa email. Carica un template A e un template B nelle colonne: ogni destinatario ne riceve una.</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
@@ -48,48 +48,43 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% templates_payload = mail_templates_picker_payload(@mail_templates) %>
|
||||
<div class="grid gap-6 <%= "lg:grid-cols-2" if mailing.ab_test? %>" data-ab-test-target="grid">
|
||||
<div class="space-y-4">
|
||||
<%= tag.div class: "space-y-4", data: { controller: "template-picker", template_picker_templates_value: templates_payload } do %>
|
||||
<h2 class="text-sm font-semibold uppercase tracking-wide text-zinc-500">Variante A</h2>
|
||||
<div>
|
||||
<label class="mb-1 block text-sm font-medium">Template A (opzionale)</label>
|
||||
<%= f.collection_select :mail_template_id, @mail_templates, :id, :name, { include_blank: "Nessuno" }, { class: input_class } %>
|
||||
<label class="mb-1 block text-sm font-medium">Template A</label>
|
||||
<%= f.collection_select :mail_template_id, @mail_templates, :id, :name,
|
||||
{ include_blank: "Nessuno — scrivi a mano" },
|
||||
{ class: input_class, data: { template_picker_target: "select", action: "change->template-picker#apply" } } %>
|
||||
<p class="mt-1 text-xs text-zinc-500">Scegliendo un template, oggetto e testo si copiano qui sotto. Poi puoi modificarli solo per questo invio.</p>
|
||||
</div>
|
||||
<% unless mailing.new_record? %>
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<%= check_box_tag :use_template_content, "1", false %>
|
||||
Sostituisci oggetto e HTML A dal template
|
||||
</label>
|
||||
<% end %>
|
||||
<div>
|
||||
<label class="mb-1 block text-sm font-medium">Oggetto A</label>
|
||||
<%= f.text_field :subject, required: true, class: input_class %>
|
||||
<%= f.text_field :subject, required: true, class: input_class, data: { template_picker_target: "subject" } %>
|
||||
</div>
|
||||
<div>
|
||||
<%= render "shared/wysiwyg_field", form: f, method: :body_html, label: "Corpo HTML A" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="space-y-4 <%= "hidden" unless mailing.ab_test? %>" data-ab-test-target="panel">
|
||||
<%= tag.div class: "space-y-4 #{'hidden' unless mailing.ab_test?}", data: { controller: "template-picker", template_picker_templates_value: templates_payload, ab_test_target: "panel" } do %>
|
||||
<h2 class="text-sm font-semibold uppercase tracking-wide text-zinc-500">Variante B</h2>
|
||||
<div>
|
||||
<label class="mb-1 block text-sm font-medium">Template B (opzionale)</label>
|
||||
<%= f.collection_select :mail_template_b_id, @mail_templates, :id, :name, { include_blank: "Nessuno" }, { class: input_class } %>
|
||||
<label class="mb-1 block text-sm font-medium">Template B</label>
|
||||
<%= f.collection_select :mail_template_b_id, @mail_templates, :id, :name,
|
||||
{ include_blank: "Nessuno — scrivi a mano" },
|
||||
{ class: input_class, data: { template_picker_target: "select", action: "change->template-picker#apply" } } %>
|
||||
<p class="mt-1 text-xs text-zinc-500">Stesso meccanismo della variante A: il template riempie oggetto e corpo B.</p>
|
||||
</div>
|
||||
<% unless mailing.new_record? %>
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<%= check_box_tag :use_template_b_content, "1", false %>
|
||||
Sostituisci oggetto e HTML B dal template
|
||||
</label>
|
||||
<% end %>
|
||||
<div>
|
||||
<label class="mb-1 block text-sm font-medium">Oggetto B</label>
|
||||
<%= f.text_field :subject_b, class: input_class %>
|
||||
<%= f.text_field :subject_b, class: input_class, data: { template_picker_target: "subject" } %>
|
||||
</div>
|
||||
<div>
|
||||
<%= render "shared/wysiwyg_field", form: f, method: :body_html_b, label: "Corpo HTML B" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user