forked from phc/website
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeba6356af
|
||
|
|
23757ad9b0
|
||
|
|
9d518dd4f8
|
||
|
|
3ca159e809
|
||
|
|
855bc8fa25
|
||
|
|
f7350bc6a8
|
||
|
|
4b12c3d59d
|
||
|
|
47a9d32670
|
||
|
|
6f308377ef
|
||
|
|
d7f9f2935d
|
||
|
|
ddbf06d7d0
|
||
|
|
cd0383245b
|
||
|
|
cff45dc92f
|
@@ -4,7 +4,7 @@ Backend e frontend del nuovo sito per il PHC.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
To setup the project
|
To setup the project
|
||||||
|
|
||||||
```bash shell
|
```bash shell
|
||||||
# Clone the repo
|
# Clone the repo
|
||||||
@@ -78,7 +78,7 @@ The `config/` package is just a singleton loaded when the application is started
|
|||||||
|
|
||||||
#### Services
|
#### Services
|
||||||
|
|
||||||
All other Go packages are services used by the `handler/` packages that provide authentication (`auth/`), template rendering (`templates/`), articles loading (`articles/`).
|
All other Go packages are services used by the `handler/` packages that provide authentication (`auth/`), template rendering (`templates/`), articles loading (`articles/`).
|
||||||
|
|
||||||
Some very small services for now just have a single file and are `storia.go` and `utenti.go` (each provides a `-Service` interface and a default concrete implementation).
|
Some very small services for now just have a single file and are `storia.go` and `utenti.go` (each provides a `-Service` interface and a default concrete implementation).
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ These files a processed by RollupJS into `out/`
|
|||||||
|
|
||||||
- `HOST`
|
- `HOST`
|
||||||
|
|
||||||
Indirizzo sul quale servire il sito, di default è `localhost:8000`.
|
Indirizzo sul quale servire il sito, di default è `:8080`.
|
||||||
|
|
||||||
- `EMAIL`
|
- `EMAIL`
|
||||||
|
|
||||||
@@ -177,4 +177,4 @@ These files a processed by RollupJS into `out/`
|
|||||||
|
|
||||||
Questo progetto dipende dal servizio `phc/auth-service` che permettere agli utenti di autenticarsi usando vari meccanismi.
|
Questo progetto dipende dal servizio `phc/auth-service` che permettere agli utenti di autenticarsi usando vari meccanismi.
|
||||||
|
|
||||||
Il servizio di autenticazione di default girerà su `localhost:3535` ed è documentato [sulla repo auth-service](https://git.phc.dm.unipi.it/phc/auth-service/)
|
Il servizio di autenticazione di default girerà su `http://localhost:3535` ed è documentato [sulla repo auth-service](https://git.phc.dm.unipi.it/phc/auth-service/)
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
["berni", "budacuferrari", "delucreziis", "butori", "cecchi", "diprisa", "gambicchia", "lamanna", "morganti", "numero", "piazza", "pignatelli", "pratali", "talluri", "tanzini"]
|
||||||
@@ -8,6 +8,9 @@ macchinisti:
|
|||||||
- uid: delucreziis
|
- uid: delucreziis
|
||||||
fullName: Antonio De Lucreziis
|
fullName: Antonio De Lucreziis
|
||||||
entryDate: 2019/09
|
entryDate: 2019/09
|
||||||
|
- uid: serdyuk
|
||||||
|
fullName: Illya Serdyuk
|
||||||
|
entryDate: 2019/12
|
||||||
- uid: caporali
|
- uid: caporali
|
||||||
fullName: Francesco Caporali
|
fullName: Francesco Caporali
|
||||||
entryDate: 2018/09
|
entryDate: 2018/09
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ body.dark-mode {
|
|||||||
--bg-dark: hsl(10, 10%, 20%);
|
--bg-dark: hsl(10, 10%, 20%);
|
||||||
--bg-darker: hsl(10, 10%, 17%);
|
--bg-darker: hsl(10, 10%, 17%);
|
||||||
--bg-darker-2: #1d2021;
|
--bg-darker-2: #1d2021;
|
||||||
|
--bg-darker-2-1: #1d5021;
|
||||||
--bg-darker-3: #101111;
|
--bg-darker-3: #101111;
|
||||||
|
|
||||||
--accent-1: #154d24;
|
--accent-1: #154d24;
|
||||||
@@ -28,7 +29,6 @@ body.dark-mode {
|
|||||||
--text-input-readonly-bg: hsl(10, 10%, 22%);
|
--text-input-readonly-bg: hsl(10, 10%, 22%);
|
||||||
--text-input-readonly-fg: hsl(10, 10%, 40%);
|
--text-input-readonly-fg: hsl(10, 10%, 40%);
|
||||||
|
|
||||||
--bg-darker-2-1: #c8c8c8;
|
|
||||||
--accent-2-lighter: #5cc969;
|
--accent-2-lighter: #5cc969;
|
||||||
--accent-2: #4eaa59;
|
--accent-2: #4eaa59;
|
||||||
--accent-2-darker: #2e974c;
|
--accent-2-darker: #2e974c;
|
||||||
|
|||||||
+18
-7
@@ -14,8 +14,18 @@
|
|||||||
<h1>
|
<h1>
|
||||||
Cos'è il PHC?
|
Cos'è il PHC?
|
||||||
</h1>
|
</h1>
|
||||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum vel maiores dolorum dicta, repellat nulla repellendus amet fuga voluptas molestiae, magni</p>
|
<p>
|
||||||
<p>Voluptatibus sequi praesentium similique, quos ex illo autem quidem!</p>
|
Il PHC è un progetto di sperimentazione tecnologica di alcuni studenti di Matematica di Pisa che va avanti fin dal 1994.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Fisicamente, occupa la stanza 106 del Dipartimento, mentre questo sito ne è la sede virtuale. Qui si trovano vari servizi offerti agli studenti, e ne si documenta lo sviluppo nella pagina <a href="/news">Notizie</a>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Nella sezione <b>Progetti</b> si trovano alcune delle attività e dei servizi del PHC, mentre <a href="/utenti">Utenti</a> contiene l'indice delle pagine personali degli studenti, che sono storicamente uno dei progetti più importanti del PHC.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Per più informazioni sul PHC, si consulti la sezione <a href="/storia">Storia</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -90,14 +100,15 @@
|
|||||||
</section>
|
</section>
|
||||||
<hr>
|
<hr>
|
||||||
<section>
|
<section>
|
||||||
<!-- <h2>Altro...</h2> -->
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="title">Vuoi diventare un macchinista?</div>
|
<div class="title">
|
||||||
<!-- <h3 style="font-weight: 500;">Vuoi diventare un macchinista?</h3> -->
|
Vuoi diventare un macchinista?
|
||||||
|
<i class="fas fa-wrench"></i>
|
||||||
|
</div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<p>
|
<p>
|
||||||
Ti interessa (o interesserebbe) smanettare al PC, montare e smontare i cose? Stai spesso in dipartimento? Allora
|
Ti piace (o piacerebbe saper) smanettare al PC e (s)montare aggeggi tecnologici?
|
||||||
puoi venire a parlare con noi per diventare un apprendista macchinista per poi entrare nel PHC.
|
Stai spesso in dipartimento? Allora fai pure un salto in PHC a parlare con noi, per diventare apprendista (e magari un giorno macchinista) o semplicemente per imparare.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,14 +12,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="nav-item dropdown">
|
<div class="nav-item dropdown">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<a class="nav-element" href="/progetti">
|
<div class="nav-element">
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fas fa-chevron-down"></i>
|
<i class="fas fa-chevron-down"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="label">
|
<div class="label">
|
||||||
Progetti
|
Progetti
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-items">
|
<div class="nav-items">
|
||||||
<div class="nav-item">
|
<div class="nav-item">
|
||||||
@@ -35,14 +35,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="nav-item dropdown">
|
<div class="nav-item dropdown">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<a class="nav-element" href="/risorse">
|
<div class="nav-element">
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fas fa-chevron-down"></i>
|
<i class="fas fa-chevron-down"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="label">
|
<div class="label">
|
||||||
Risorse
|
Risorse
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-items">
|
<div class="nav-items">
|
||||||
<div class="nav-item">
|
<div class="nav-item">
|
||||||
@@ -85,4 +85,4 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
<script src="/public/profilo.min.js"></script>
|
<script src="/public/profilo.min.js"></script>
|
||||||
<section x-data="profilo">
|
<section x-data="profilo">
|
||||||
<h1>Profilo di <strong>@{{ .User.Username }}</strong></h1>
|
<h1>Profilo di <strong>{{ .User.Name }} {{ .User.Surname }}</strong></h1>
|
||||||
<p class="center">
|
<p class="center">
|
||||||
<a class="button" href="/logout">Logout</a>
|
<a class="button" href="/logout">Logout</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
+8
-3
@@ -1,4 +1,4 @@
|
|||||||
{{template "base" .}}
|
{{template "base" .}}
|
||||||
{{define "title"}}Utenti • PHC{{end}}
|
{{define "title"}}Utenti • PHC{{end}}
|
||||||
{{define "body"}}
|
{{define "body"}}
|
||||||
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
<template x-for="entry in searchResults" :key="entry.item.uid">
|
<template x-for="entry in searchResults" :key="entry.item.uid">
|
||||||
<div class="user-item card">
|
<div class="user-item card">
|
||||||
<a class="full-name" :href="'{{ $.Config.UserPagesBaseUrl }}' + entry.item.uid" x-text="
|
<a class="full-name" :href="'{{ $.Config.UserPagesBaseUrl }}' + entry.item.uid" x-text="
|
||||||
sortMode === 'surname' ?
|
sortMode === 'surname' ?
|
||||||
entry.item.cognome + ' ' + entry.item.nome :
|
entry.item.cognome + ' ' + entry.item.nome :
|
||||||
entry.item.nome + ' ' + entry.item.cognome
|
entry.item.nome + ' ' + entry.item.cognome
|
||||||
"></a>
|
"></a>
|
||||||
<template x-if="entry.item.tags?.includes('macchinista')">
|
<template x-if="entry.item.tags?.includes('macchinista')">
|
||||||
@@ -46,6 +46,11 @@
|
|||||||
<i class="fas fa-wrench"></i>
|
<i class="fas fa-wrench"></i>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template x-if="entry.item.tags?.includes('rappresentante')">
|
||||||
|
<div class="icon" title="Rappresentante">
|
||||||
|
<i class="fas fa-landmark"></i>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<!-- <template x-if="entry.score">
|
<!-- <template x-if="entry.score">
|
||||||
<span x-text="entry.score"></span>
|
<span x-text="entry.score"></span>
|
||||||
</template> -->
|
</template> -->
|
||||||
|
|||||||
+13
-3
@@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
urlpkg "net/url"
|
||||||
|
|
||||||
"git.phc.dm.unipi.it/phc/website/model"
|
"git.phc.dm.unipi.it/phc/website/model"
|
||||||
)
|
)
|
||||||
@@ -44,8 +44,13 @@ func newLDAPAuthService(host string) Service {
|
|||||||
|
|
||||||
// doGetRequest is a utility to make HTTP GET requests
|
// doGetRequest is a utility to make HTTP GET requests
|
||||||
func (a *ldapAuthService) doGetRequest(url string, response interface{}) error {
|
func (a *ldapAuthService) doGetRequest(url string, response interface{}) error {
|
||||||
|
u, err := urlpkg.JoinPath(a.Host, "poisson-ldap", url)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest(
|
req, err := http.NewRequest(
|
||||||
"GET", path.Join(a.Host, "poisson-ldap", url), bytes.NewBuffer([]byte("")),
|
"GET", u, bytes.NewBuffer([]byte("")),
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -74,7 +79,12 @@ func (a *ldapAuthService) doPostRequest(url string, request interface{}, respons
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", path.Join(a.Host, "ldap", url), bytes.NewBuffer(jsonStr))
|
u, err := urlpkg.JoinPath(a.Host, "poisson-ldap", url)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := http.NewRequest("POST", u, bytes.NewBuffer(jsonStr))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import (
|
|||||||
type authListaUtenti struct {
|
type authListaUtenti struct {
|
||||||
AuthService auth.Service
|
AuthService auth.Service
|
||||||
|
|
||||||
Macchinisti util.Set[string]
|
Macchinisti util.Set[string]
|
||||||
|
Rappresentanti util.Set[string]
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAuthListaUtenti(authService auth.Service) (Service, error) {
|
func newAuthListaUtenti(authService auth.Service) (Service, error) {
|
||||||
@@ -18,7 +19,12 @@ func newAuthListaUtenti(authService auth.Service) (Service, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &authListaUtenti{authService, macchinisti}, nil
|
rappresentanti, err := loadRappresentanti()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &authListaUtenti{authService, macchinisti, rappresentanti}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *authListaUtenti) GetUtenti() ([]*model.ListUser, error) {
|
func (a *authListaUtenti) GetUtenti() ([]*model.ListUser, error) {
|
||||||
@@ -38,6 +44,7 @@ func (a *authListaUtenti) GetUtenti() ([]*model.ListUser, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mergeMacchinisti(users, a.Macchinisti)
|
mergeMacchinisti(users, a.Macchinisti)
|
||||||
|
mergeRappresentanti(users, a.Rappresentanti)
|
||||||
|
|
||||||
return users, nil
|
return users, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import (
|
|||||||
type jsonListaUtenti struct {
|
type jsonListaUtenti struct {
|
||||||
Path string
|
Path string
|
||||||
|
|
||||||
Macchinisti util.Set[string]
|
Macchinisti util.Set[string]
|
||||||
|
Rappresentanti util.Set[string]
|
||||||
}
|
}
|
||||||
|
|
||||||
func newJsonListaUtenti(path string) (Service, error) {
|
func newJsonListaUtenti(path string) (Service, error) {
|
||||||
@@ -21,7 +22,12 @@ func newJsonListaUtenti(path string) (Service, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &jsonListaUtenti{path, macchinisti}, nil
|
rappresentanti, err := loadRappresentanti()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &jsonListaUtenti{path, macchinisti, rappresentanti}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *jsonListaUtenti) GetUtenti() ([]*model.ListUser, error) {
|
func (j *jsonListaUtenti) GetUtenti() ([]*model.ListUser, error) {
|
||||||
@@ -37,6 +43,7 @@ func (j *jsonListaUtenti) GetUtenti() ([]*model.ListUser, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mergeMacchinisti(users, j.Macchinisti)
|
mergeMacchinisti(users, j.Macchinisti)
|
||||||
|
mergeRappresentanti(users, j.Rappresentanti)
|
||||||
|
|
||||||
log.Printf("Caricata lista di %d utenti", len(users))
|
log.Printf("Caricata lista di %d utenti", len(users))
|
||||||
|
|
||||||
|
|||||||
@@ -44,3 +44,26 @@ func mergeMacchinisti(users []*model.ListUser, macchinisti util.Set[string]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func loadRappresentanti() (util.Set[string], error) {
|
||||||
|
f, err := os.Open("_content/rappresentanti.json")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rappresentanti := []string{}
|
||||||
|
|
||||||
|
if err := json.NewDecoder(f).Decode(&rappresentanti); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return util.NewSet(rappresentanti...), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func mergeRappresentanti(users []*model.ListUser, rappresentanti util.Set[string]) {
|
||||||
|
for _, user := range users {
|
||||||
|
if _, found := rappresentanti[user.Uid]; found {
|
||||||
|
user.Tags = append(user.Tags, "rappresentante")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ func withSpacers(events []*GenericEvent) []*GenericEvent {
|
|||||||
func getDateYear(date string) int {
|
func getDateYear(date string) int {
|
||||||
year, err := strconv.Atoi(strings.Split(date, "/")[0])
|
year, err := strconv.Atoi(strings.Split(date, "/")[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err) // Tanto nel caso si nota in fase di sviluppo visto che "_content/storia.json" è statico
|
panic(err) // Tanto nel caso si nota in fase di sviluppo visto che "_content/storia.yaml" è statico
|
||||||
}
|
}
|
||||||
|
|
||||||
return year
|
return year
|
||||||
|
|||||||
Reference in New Issue
Block a user