mirror of
https://github.com/plausible/analytics.git
synced 2024-12-25 18:48:06 +03:00
0d07476e32
Fixes #796
41 lines
2.9 KiB
Elixir
41 lines
2.9 KiB
Elixir
<%= 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 text-sm font-bold 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="pageview-tab">Pageview</div>
|
|
<div class="w-1/2 text-center py-2 cursor-pointer dark:text-gray-100" id="event-tab">Custom event</div>
|
|
</div>
|
|
<div class="my-6">
|
|
<div id="pageview-fields">
|
|
<%= label f, :page_path, class: "block text-sm font-bold 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 id="event-fields" class="hidden">
|
|
<%= label f, :event_name, class: "block text-sm font-bold 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>
|
|
|
|
<%= submit "Add goal →", class: "button mt-4 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>
|