Pulizia di vecchio codice e qualche miglioria
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
# Server config
|
||||||
MODE=development
|
MODE=development
|
||||||
HOST=localhost:8000
|
HOST=localhost:8000
|
||||||
|
|
||||||
|
# Separate services
|
||||||
|
GIT_URL=https://git.example.org
|
||||||
|
FORUM_URL=https://forum.example.org
|
||||||
|
|
||||||
|
# Other
|
||||||
|
EMAIL=mail@example.org
|
||||||
|
|||||||
+12
-1
@@ -110,6 +110,12 @@ nav .nav-logo {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
border: 1px solid var(--bg-darker-2);
|
border: 1px solid var(--bg-darker-2);
|
||||||
box-shadow: var(--shadow-1);
|
box-shadow: var(--shadow-1);
|
||||||
|
|
||||||
|
transition: transform 150ms ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav .nav-logo:hover {
|
||||||
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
nav .nav-logo img {
|
nav .nav-logo img {
|
||||||
@@ -180,6 +186,11 @@ nav .nav-main .nav-item.dropdown {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav .nav-main .nav-item.dropdown .nav-items .nav-item:last-child {
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
nav .nav-main .nav-item.dropdown .name {
|
nav .nav-main .nav-item.dropdown .name {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -209,7 +220,6 @@ nav .nav-main .nav-item.dropdown .nav-items {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
border: 1px solid var(--bg-darker-2);
|
border: 1px solid var(--bg-darker-2);
|
||||||
box-shadow: var(--shadow-1);
|
box-shadow: var(--shadow-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
nav .nav-main .nav-item.dropdown .nav-items::before {
|
nav .nav-main .nav-item.dropdown .nav-items::before {
|
||||||
@@ -330,6 +340,7 @@ p {
|
|||||||
|
|
||||||
a {
|
a {
|
||||||
color: var(--accent-1-fg);
|
color: var(--accent-1-fg);
|
||||||
|
font-weight: var(--font-weight-medium);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-15
@@ -14,13 +14,16 @@ var Host string
|
|||||||
|
|
||||||
var GitUrl string
|
var GitUrl string
|
||||||
var ForumUrl string
|
var ForumUrl string
|
||||||
|
var Email string
|
||||||
|
|
||||||
func stringOrDefault(value, defaultValue string) string {
|
func loadEnv(target *string, name, defaultValue string) {
|
||||||
|
value := os.Getenv(name)
|
||||||
if len(strings.TrimSpace(value)) == 0 {
|
if len(strings.TrimSpace(value)) == 0 {
|
||||||
return defaultValue
|
*target = defaultValue
|
||||||
|
} else {
|
||||||
|
*target = value
|
||||||
}
|
}
|
||||||
|
log.Printf("%s = %v", name, *target)
|
||||||
return value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Load() {
|
func Load() {
|
||||||
@@ -28,17 +31,11 @@ func Load() {
|
|||||||
|
|
||||||
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
|
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
|
||||||
|
|
||||||
Mode = stringOrDefault(os.Getenv("MODE"), "production")
|
loadEnv(&Mode, "MODE", "production")
|
||||||
log.Printf("MODE = %v", Mode)
|
loadEnv(&Host, "HOST", "localhost:8080")
|
||||||
|
loadEnv(&GitUrl, "GIT_URL", "https://git.example.org")
|
||||||
Host = stringOrDefault(os.Getenv("HOST"), "localhost:8080")
|
loadEnv(&ForumUrl, "FORUM_URL", "https://forum.example.org")
|
||||||
log.Printf("HOST = %v", Host)
|
loadEnv(&Email, "EMAIL", "mail@example.org")
|
||||||
|
|
||||||
GitUrl = stringOrDefault(os.Getenv("GIT_URL"), "https://git.phc.dm.unipi.it")
|
|
||||||
log.Printf("GIT_URL = %v", GitUrl)
|
|
||||||
|
|
||||||
ForumUrl = stringOrDefault(os.Getenv("FORUM_URL"), "https://forum.phc.dm.unipi.it")
|
|
||||||
log.Printf("FORUM_URL = %v", ForumUrl)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Object() util.H {
|
func Object() util.H {
|
||||||
@@ -47,5 +44,6 @@ func Object() util.H {
|
|||||||
"Host": Host,
|
"Host": Host,
|
||||||
"GitUrl": GitUrl,
|
"GitUrl": GitUrl,
|
||||||
"ForumUrl": ForumUrl,
|
"ForumUrl": ForumUrl,
|
||||||
|
"Email": Email,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -135,7 +135,7 @@
|
|||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<div class="footer-item">
|
<div class="footer-item">
|
||||||
macchinisti@poisson.phc.dm.xxxxx.xx
|
{{ .Config.Email }}
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+2
-7
@@ -5,20 +5,16 @@
|
|||||||
{{define "body"}}
|
{{define "body"}}
|
||||||
|
|
||||||
<form action="/login" method="post">
|
<form action="/login" method="post">
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
<img class="icons8" src="https://img.icons8.com/ios-filled/50/000000/lock.png"/>
|
<i class="fas fa-sign-in-alt"></i>
|
||||||
Accedi
|
Accedi
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Inserisci le tue credenziali di Poisson per accedere.
|
Inserisci le tue credenziali di Poisson per accedere.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Per il recupero credenziali vieni direttamente al PHC per parlarne con calma o inviaci una mail.
|
Per il recupero credenziali vieni direttamente al PHC a parlarne con calma con noi altrimenti puoi inviaci una email all'indirizzo <a href="mailto:{{ .Config.Email }}">{{ .Config.Email }}</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="login-username">Username:</label>
|
<label for="login-username">Username:</label>
|
||||||
<input type="text" name="username" id="login-username">
|
<input type="text" name="username" id="login-username">
|
||||||
@@ -32,7 +28,6 @@
|
|||||||
<input type="submit" value="Accedi">
|
<input type="submit" value="Accedi">
|
||||||
<!-- <div class="hfill"></div> -->
|
<!-- <div class="hfill"></div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
+6
-39
@@ -5,18 +5,17 @@
|
|||||||
{{define "body"}}
|
{{define "body"}}
|
||||||
<section>
|
<section>
|
||||||
<h2>
|
<h2>
|
||||||
<img class="icons8" src="https://img.icons8.com/ios-filled/50/000000/find-user-male.png" />
|
<i class="fas fa-users"></i>
|
||||||
Utenti
|
Utenti
|
||||||
</h2>
|
</h2>
|
||||||
|
<!-- TODO: Codice temporaneo -->
|
||||||
<p>
|
<p style="text-align: center;">
|
||||||
Questa è la lista di tutti gli utenti con un account su Poisson. Scrivi nome, cognome o username di un utente
|
Questa è la lista di tutti gli utenti con un account su Poisson. Scrivi nome, cognome o username di un utente per filtrare la lista in tempo reale.
|
||||||
per filtrare la lista in tempo reale.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<input type="text" id="search-field" placeholder="Cerca...">
|
<input type="text" id="search-field" placeholder="Cerca...">
|
||||||
<img class="icons8" src="https://img.icons8.com/ios-filled/50/000000/search.png" />
|
<i class="fas fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="user-list">
|
<div class="user-list">
|
||||||
@@ -24,39 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', ({ }) => {
|
|
||||||
const $userList = document.querySelector('.user-list');
|
|
||||||
const $user = document.createElement('div');
|
|
||||||
$user.innerHTML = `
|
|
||||||
<div class="user">
|
|
||||||
<div class="contact">
|
|
||||||
<h3 class="fullname"></h3>
|
|
||||||
<h4 class="username"></h4>
|
|
||||||
</div>
|
|
||||||
<div class="links">
|
|
||||||
<a href="#">
|
|
||||||
<img class="icons8" src="https://img.icons8.com/ios-filled/50/000000/web.png" />
|
|
||||||
</a>
|
|
||||||
<a href="#">
|
|
||||||
<img class="icons8" src="https://img.icons8.com/ios-filled/50/000000/git.png" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Per mostrare che la pagina regge molti utenti senza laggare troppo
|
|
||||||
Array(1400).fill(0).map(({ }, i) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
// Pare che questa riga sia la più dispendiosa
|
|
||||||
const $newUser = $user.cloneNode(true);
|
|
||||||
|
|
||||||
$newUser.querySelector('.fullname').innerHTML = `Persona ${i + 1}`;
|
|
||||||
$newUser.querySelector('.username').innerHTML = `persona${i + 1}`;
|
|
||||||
|
|
||||||
$userList.appendChild($newUser.firstElementChild);
|
|
||||||
}, 0)
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
Reference in New Issue
Block a user