genarato alcuni partials e corretto drop down
This commit is contained in:
61
web/templates/public/_navbar.html
Normal file
61
web/templates/public/_navbar.html
Normal file
@@ -0,0 +1,61 @@
|
||||
{{define "navbar"}}
|
||||
<nav class="border-b border-gray-200 bg-white">
|
||||
<div class="mx-auto flex max-w-7xl flex-wrap items-center justify-between p-4">
|
||||
<a href="/" class="flex items-center space-x-3 rtl:space-x-reverse">
|
||||
<span class="self-center whitespace-nowrap text-xl font-semibold">Trustcontact</span>
|
||||
</a>
|
||||
|
||||
<button data-collapse-toggle="navbar-main" type="button" class="inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 md:hidden" aria-controls="navbar-main" aria-expanded="false">
|
||||
<span class="sr-only" data-i18n="nav.open_main_menu">Apri menu principale</span>
|
||||
<svg class="h-5 w-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="hidden w-full items-center justify-between md:order-1 md:flex md:w-auto" id="navbar-main">
|
||||
<ul class="mt-4 flex flex-col gap-2 rounded-lg border border-gray-100 bg-gray-50 p-4 text-sm font-medium md:mt-0 md:flex-row md:items-center md:gap-1 md:border-0 md:bg-transparent md:p-0">
|
||||
{{if eq .NavSection "home"}}
|
||||
{{if .CurrentUser}}
|
||||
<li><a href="/welcome" class="block rounded-lg px-3 py-2 text-gray-700 hover:bg-gray-100">Welcome</a></li>
|
||||
{{else}}
|
||||
<li><a href="/login" class="block rounded-lg px-3 py-2 text-gray-700 hover:bg-gray-100" data-i18n="nav.login">Login</a></li>
|
||||
{{end}}
|
||||
{{else if not .CurrentUser}}
|
||||
<li><a href="/login" class="block rounded-lg px-3 py-2 {{if eq .NavSection "login"}}bg-blue-100 text-blue-700{{else}}text-gray-700 hover:bg-gray-100{{end}}" data-i18n="nav.login">Login</a></li>
|
||||
<li><a href="/signup" class="block rounded-lg px-3 py-2 {{if eq .NavSection "signup"}}bg-blue-100 text-blue-700{{else}}text-gray-700 hover:bg-gray-100{{end}}" data-i18n="nav.signup">Signup</a></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
|
||||
<div class="mt-4 flex items-center gap-3 md:mt-0 md:ms-4">
|
||||
{{template "navbar_controls" .}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{{end}}
|
||||
|
||||
{{define "navbar_controls"}}
|
||||
{{template "language_dropdown" .}}
|
||||
|
||||
{{if .CurrentUser}}
|
||||
<div class="relative">
|
||||
<button type="button" class="flex items-center rounded-full bg-gray-800 text-sm focus:ring-4 focus:ring-gray-300" id="user-menu-button" aria-expanded="false" data-dropdown-toggle="user-dropdown" data-dropdown-placement="bottom">
|
||||
<span class="sr-only" data-i18n="nav.open_user_menu">Apri menu utente</span>
|
||||
<span class="inline-flex h-9 w-9 items-center justify-center rounded-full bg-blue-600 font-semibold text-white">
|
||||
{{if .CurrentUser.Name}}{{printf "%.1s" .CurrentUser.Name}}{{else}}{{printf "%.1s" .CurrentUser.Email}}{{end}}
|
||||
</span>
|
||||
</button>
|
||||
<div class="z-50 my-4 hidden w-56 list-none divide-y divide-gray-100 rounded-lg bg-white text-base shadow-sm" id="user-dropdown">
|
||||
<div class="px-4 py-3">
|
||||
<span class="block truncate text-sm text-gray-900">{{if .CurrentUser.Name}}{{.CurrentUser.Name}}{{else}}Utente{{end}}</span>
|
||||
<span class="block truncate text-sm text-gray-500">{{.CurrentUser.Email}}</span>
|
||||
</div>
|
||||
<div class="py-2">
|
||||
<form action="/logout" method="post" class="px-2">
|
||||
<button type="submit" class="block w-full rounded-lg px-2 py-2 text-left text-sm text-red-700 hover:bg-red-50" data-i18n="nav.logout">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
9
web/templates/public/forbidden.html
Normal file
9
web/templates/public/forbidden.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{define "content"}}
|
||||
<div class="flex min-h-screen items-center justify-center">
|
||||
<div class="w-full max-w-2xl rounded-lg border border-red-200 bg-white p-8 shadow-sm">
|
||||
<h1 class="mb-3 text-2xl font-bold text-red-700">Accesso negato</h1>
|
||||
<p class="mb-6 text-gray-700">Non hai i privilegi necessari per accedere a questa pagina.</p>
|
||||
<a href="/" class="inline-flex rounded-lg bg-blue-700 px-5 py-2.5 text-sm font-medium text-white hover:bg-blue-800">Torna alla home</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -1,18 +1,18 @@
|
||||
{{define "content"}}
|
||||
<div class="flex min-h-screen items-center justify-center">
|
||||
<div class="w-full max-w-md rounded-lg border border-gray-200 bg-white p-6 shadow-sm md:p-8">
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900">Forgot Password</h1>
|
||||
<p class="mb-6 text-sm text-gray-500">Inserisci la tua email per ricevere il link di reset.</p>
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900" data-i18n="forgot.title">Forgot Password</h1>
|
||||
<p class="mb-6 text-sm text-gray-500" data-i18n="forgot.subtitle">Inserisci la tua email per ricevere il link di reset.</p>
|
||||
|
||||
<form action="/forgot-password" method="post" class="space-y-5">
|
||||
<div>
|
||||
<label for="forgot-email" class="mb-2 block text-sm font-medium text-gray-900">Email</label>
|
||||
<label for="forgot-email" class="mb-2 block text-sm font-medium text-gray-900" data-i18n="form.email">Email</label>
|
||||
<input id="forgot-email" type="email" name="email" value="{{.Email}}" class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500" required />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300">Invia link reset</button>
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300" data-i18n="forgot.submit">Invia link reset</button>
|
||||
|
||||
<p class="text-center text-sm text-gray-600"><a href="/login" class="text-blue-700 hover:underline">Torna al login</a></p>
|
||||
<p class="text-center text-sm text-gray-600"><a href="/login" class="text-blue-700 hover:underline" data-i18n="forgot.back_login">Torna al login</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
{{define "content"}}
|
||||
<section class="rounded-lg border border-gray-200 bg-white p-8 shadow-sm">
|
||||
<h1 class="mb-2 text-3xl font-bold text-gray-900">Trustcontact</h1>
|
||||
<p class="mb-6 text-gray-600">Accedi o registrati per continuare.</p>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
<a class="rounded-lg bg-blue-700 px-5 py-2.5 text-sm font-medium text-white hover:bg-blue-800" href="/login">Accedi</a>
|
||||
<a class="rounded-lg border border-gray-300 bg-white px-5 py-2.5 text-sm font-medium text-gray-900 hover:bg-gray-100" href="/signup">Registrati</a>
|
||||
</div>
|
||||
<h1 class="text-3xl font-bold text-gray-900">Home Page</h1>
|
||||
</section>
|
||||
{{end}}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
{{define "content"}}
|
||||
<div class="flex min-h-screen items-center justify-center">
|
||||
<div class="w-full max-w-md rounded-lg border border-gray-200 bg-white p-6 shadow-sm md:p-8">
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900">Login</h1>
|
||||
<p class="mb-6 text-sm text-gray-500">Accedi al tuo account.</p>
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900" data-i18n="login.title">Login</h1>
|
||||
<p class="mb-6 text-sm text-gray-500" data-i18n="login.subtitle">Accedi al tuo account.</p>
|
||||
|
||||
<form action="/login" method="post" class="space-y-5">
|
||||
<div>
|
||||
<label for="email" class="mb-2 block text-sm font-medium text-gray-900">Email</label>
|
||||
<label for="email" class="mb-2 block text-sm font-medium text-gray-900" data-i18n="form.email">Email</label>
|
||||
<input id="email" type="text" name="email" value="{{.Email}}" class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500" required />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password" class="mb-2 block text-sm font-medium text-gray-900">Password</label>
|
||||
<label for="password" class="mb-2 block text-sm font-medium text-gray-900" data-i18n="form.password">Password</label>
|
||||
<input id="password" type="password" name="password" class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500" required />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300">Sign in</button>
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300" data-i18n="login.submit">Sign in</button>
|
||||
|
||||
<div class="flex items-center justify-between text-sm">
|
||||
<a href="/forgot-password" class="text-blue-700 hover:underline">Forgot password?</a>
|
||||
<a href="/signup" class="text-gray-600 hover:underline">Create account</a>
|
||||
<a href="/forgot-password" class="text-blue-700 hover:underline" data-i18n="login.forgot">Forgot password?</a>
|
||||
<a href="/signup" class="text-gray-600 hover:underline" data-i18n="login.create_account">Create account</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
{{define "content"}}
|
||||
<div class="flex min-h-screen items-center justify-center">
|
||||
<div class="w-full max-w-md rounded-lg border border-gray-200 bg-white p-6 shadow-sm md:p-8">
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900">Reset Password</h1>
|
||||
<p class="mb-6 text-sm text-gray-500">Imposta una nuova password.</p>
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900" data-i18n="reset.title">Reset Password</h1>
|
||||
<p class="mb-6 text-sm text-gray-500" data-i18n="reset.subtitle">Imposta una nuova password.</p>
|
||||
|
||||
{{if .Token}}
|
||||
<form action="/reset-password?token={{.Token}}" method="post" class="space-y-5">
|
||||
<div>
|
||||
<label for="reset-password" class="mb-2 block text-sm font-medium text-gray-900">Nuova password</label>
|
||||
<label for="reset-password" class="mb-2 block text-sm font-medium text-gray-900" data-i18n="reset.new_password">Nuova password</label>
|
||||
<input id="reset-password" type="password" name="password" class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500" required />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300">Aggiorna password</button>
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300" data-i18n="reset.submit">Aggiorna password</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<div class="rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-800" role="alert">Token mancante o non valido.</div>
|
||||
<div class="rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-800" role="alert" data-i18n="reset.invalid_token">Token mancante o non valido.</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
{{define "content"}}
|
||||
<div class="flex min-h-screen items-center justify-center">
|
||||
<div class="w-full max-w-md rounded-lg border border-gray-200 bg-white p-6 shadow-sm md:p-8">
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900">Signup</h1>
|
||||
<p class="mb-6 text-sm text-gray-500">Crea il tuo account.</p>
|
||||
<h1 class="mb-1 text-2xl font-bold text-gray-900" data-i18n="signup.title">Signup</h1>
|
||||
<p class="mb-6 text-sm text-gray-500" data-i18n="signup.subtitle">Crea il tuo account.</p>
|
||||
|
||||
<form action="/signup" method="post" class="space-y-5">
|
||||
<div>
|
||||
<label for="signup-email" class="mb-2 block text-sm font-medium text-gray-900">Email</label>
|
||||
<label for="signup-email" class="mb-2 block text-sm font-medium text-gray-900" data-i18n="form.email">Email</label>
|
||||
<input id="signup-email" type="email" name="email" value="{{.Email}}" class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500" required />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="signup-password" class="mb-2 block text-sm font-medium text-gray-900">Password</label>
|
||||
<label for="signup-password" class="mb-2 block text-sm font-medium text-gray-900" data-i18n="form.password">Password</label>
|
||||
<input id="signup-password" type="password" name="password" class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500" required />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300">Sign up</button>
|
||||
<button type="submit" class="w-full rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300" data-i18n="signup.submit">Sign up</button>
|
||||
|
||||
<p class="text-center text-sm text-gray-600">Hai già un account? <a href="/login" class="text-blue-700 hover:underline">Accedi</a></p>
|
||||
<p class="text-center text-sm text-gray-600"><span data-i18n="signup.has_account">Hai già un account?</span> <a href="/login" class="text-blue-700 hover:underline" data-i18n="signup.login">Accedi</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{define "content"}}
|
||||
<section class="rounded-lg border border-blue-200 bg-blue-50 p-8 shadow-sm" role="status" aria-live="polite">
|
||||
<h1 class="mb-2 text-2xl font-bold text-blue-900">Verifica email</h1>
|
||||
<p class="mb-2 text-blue-800">Controlla la casella di posta e apri il link di verifica ricevuto.</p>
|
||||
<p class="mb-4 text-blue-800">Se il link è scaduto, ripeti la registrazione o contatta supporto.</p>
|
||||
<a href="/login" class="inline-flex rounded-lg bg-blue-700 px-5 py-2.5 text-sm font-medium text-white hover:bg-blue-800">Vai al login</a>
|
||||
<h1 class="mb-2 text-2xl font-bold text-blue-900" data-i18n="verify.title">Verifica email</h1>
|
||||
<p class="mb-2 text-blue-800" data-i18n="verify.p1">Controlla la casella di posta e apri il link di verifica ricevuto.</p>
|
||||
<p class="mb-4 text-blue-800" data-i18n="verify.p2">Se il link è scaduto, ripeti la registrazione o contatta supporto.</p>
|
||||
<a href="/login" class="inline-flex rounded-lg bg-blue-700 px-5 py-2.5 text-sm font-medium text-white hover:bg-blue-800" data-i18n="verify.go_login">Vai al login</a>
|
||||
</section>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user