Remove old goals form

pull/3310/head
Adam Rutkowski 3 years ago
parent 9976df1f37
commit e1f8287481

@ -1,124 +0,0 @@
<%= form_for @changeset, "/#{URI.encode_www_form(@site.domain)}/goals", [class: "max-w-md w-full mx-auto bg-white dark:bg-gray-800 shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>
<h2 class="text-xl font-black dark:text-gray-100">Add goal for <%= @site.domain %></h2>
<div class="mt-6 font-medium dark:text-gray-100">Goal trigger</div>
<div class="my-3 w-full flex rounded border border-gray-300 dark:border-gray-500">
<div
class="w-1/2 text-center py-2 border-r border-gray-300 dark:border-gray-500 shadow-inner font-bold cursor-pointer text-white dark:text-gray-100 bg-indigo-600"
id="event-tab"
>
Custom event
</div>
<div class="w-1/2 text-center py-2 cursor-pointer dark:text-gray-100" id="pageview-tab">
Pageview
</div>
</div>
<div class="my-6">
<div id="event-fields">
<div class="pb-6 text-xs text-gray-700 dark:text-gray-200 text-justify rounded-md">
Custom events are not tracked by default - you have to configure them on your site to be sent to Plausible. See examples and learn more in <a
class="text-indigo-500 hover:underline"
target="_blank"
rel="noreferrer"
href="https://plausible.io/docs/custom-event-goals"
> our docs</a>.
</div>
<div>
<%= label(f, :event_name, class: "block font-medium dark:text-gray-100") %>
<%= text_input(f, :event_name,
class:
"transition mt-3 bg-gray-100 dark:bg-gray-900 outline-none appearance-none border border-transparent rounded w-full p-2 text-gray-700 dark:text-gray-300 leading-normal focus:outline-none focus:bg-white dark:focus:bg-gray-800 focus:border-gray-300 dark:focus:border-gray-500",
placeholder: "Signup"
) %>
<%= error_tag(f, :event_name) %>
</div>
<div
class="mt-6 space-y-3"
x-data={
Jason.encode!(%{
active: !!Ecto.Changeset.get_field(@changeset, :currency),
currency: Ecto.Changeset.get_field(@changeset, :currency)
})
}
>
<div
class="flex items-center w-max cursor-pointer"
x-on:click="active = !active; currency = ''"
>
<button
class="relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
x-bind:class="active ? 'bg-indigo-600' : 'bg-gray-200'"
x-bind:aria-checked="active"
aria-labelledby="enable-revenue-tracking"
role="switch"
type="button"
>
<span
aria-hidden="true"
class="pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
x-bind:class="active ? 'translate-x-5' : 'translate-x-0'"
/>
</button>
<span
class="ml-3 font-medium text-gray-900 dark:text-gray-200"
id="enable-revenue-tracking"
>
Enable revenue tracking
</span>
</div>
<div class="rounded-md bg-yellow-50 dark:bg-yellow-900 p-4" x-show="active">
<p class="text-xs text-yellow-700 dark:text-yellow-50 text-justify">
Revenue tracking is an upcoming premium feature that's free-to-use
during the private preview. Pricing will be announced soon. See
examples and learn more in <a
class="font-medium text-yellow underline hover:text-yellow-600"
href="https://plausible.io/docs/ecommerce-revenue-tracking"
>our docs</a>.
</p>
</div>
<div x-show="active">
<%= select(f, :currency, Plausible.Goal.currency_options(),
class:
"transition bg-gray-100 dark:bg-gray-900 outline-none appearance-none border border-transparent rounded w-full p-2 text-gray-700 dark:text-gray-300 leading-normal focus:outline-none focus:bg-white dark:focus:bg-gray-800 focus:border-gray-300 dark:focus:border-gray-500",
"aria-label": "Reporting currency",
"x-model": "currency",
"x-bind:required": "active"
) %>
<%= error_tag(f, :currency) %>
</div>
</div>
</div>
<div id="pageview-fields" class="hidden">
<%= label(f, :page_path, class: "block font-medium dark:text-gray-100") %>
<%= text_input(f, :page_path,
class:
"transition mt-3 bg-gray-100 dark:bg-gray-900 outline-none appearance-none border border-transparent rounded w-full p-2 text-gray-700 dark:text-gray-300 leading-normal focus:outline-none focus:bg-white dark:focus:bg-gray-800 focus:border-gray-300 dark:focus:border-gray-500",
placeholder: "/success"
) %>
<%= error_tag(f, :page_path) %>
</div>
</div>
<%= submit("Add goal →", class: "button text-base font-bold w-full") %>
<% end %>
<script>
document.getElementById('pageview-tab').onclick = function() {
document.getElementById('pageview-fields').classList.remove('hidden')
document.getElementById('pageview-tab').classList.add('shadow-inner', 'font-bold', 'bg-indigo-600', 'text-white')
document.getElementById('event-fields').classList.add('hidden')
document.getElementById('event-tab').classList.remove('shadow-inner', 'font-bold', 'bg-indigo-600', 'text-white')
document.getElementById('event-tab').classList.add('dark:text-gray-100')
}
document.getElementById('event-tab').onclick = function() {
document.getElementById('event-fields').classList.remove('hidden')
document.getElementById('event-tab').classList.add('shadow-inner', 'font-bold', 'bg-indigo-600', 'text-white')
document.getElementById('pageview-fields').classList.add('hidden')
document.getElementById('pageview-tab').classList.remove('shadow-inner', 'font-bold', 'bg-indigo-600', 'text-white')
document.getElementById('pageview-tab').classList.add('dark:text-gray-100')
document.getElementById('goal_page_path').value = ''
}
</script>
Loading…
Cancel
Save