analytics/lib/plausible_web/templates/site/new.html.eex

30 lines
1.8 KiB
Elixir
Raw Normal View History

2019-09-02 14:29:19 +03:00
<%= form_for @changeset, "/sites", [class: "max-w-sm w-full mx-auto bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>
<div class="flex items-center justify-between">
<h2>Your website details</h2>
</div>
<div class="my-6">
<%= label f, :domain, class: "block text-grey-darker text-sm font-bold" %>
<p class="text-grey-dark text-xs mt-1 mb-2">Just the naked domain without <code>www</code> or <code>https://</code></p>
<%= text_input f, :domain, class: "transition bg-grey-lighter appearance-none border border-transparent rounded w-full p-2 text-grey-darker leading-normal appearance-none focus:outline-none focus:bg-white focus:border-grey-light", placeholder: "example.com" %>
<%= error_tag f, :domain %>
</div>
<div class="my-6">
<%= label f, :timezone, "Reporting Timezone", class: "block text-grey-darker text-sm font-bold mb-2" %>
<p class="text-grey-dark text-xs mt-1 mb-2">To make sure we agree on what 'today' means</p>
<div class="inline-block relative w-full">
<%= select f, :timezone, Plausible.Timezones.options(), id: "tz-select", selected: "Etc/Greenwich", class: "block appearance-none w-full bg-grey-lighter text-grey-darker cursor-pointer hover:border-grey p-2 pr-8 rounded leading-normal focus:outline-none" %>
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-red">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
</div>
<script>
var offset = (new Date()).getTimezoneOffset()
var option = document.querySelector('#tz-select option[offset="' + offset + '"]')
if (option) { option.selected = "selected"}
</script>
<%= submit "Add snippet →", class: "button mt-4 w-full" %>
<% end %>