Basic cours support #44

Merged
Anri merged 67 commits from cours into main 2024-04-01 18:11:49 +02:00
4 changed files with 59 additions and 8 deletions
Showing only changes of commit 21cb50e5fd - Show all commits

View file

@ -1,9 +1,44 @@
use actix_web::{get, Responder}; use actix_web::{get, web, Responder};
use ramhorns::Content;
use crate::{
config::Config,
misc::utils::{make_kw, Html},
template::{Infos, NavBar},
};
#[get("/cours")] #[get("/cours")]
async fn page() -> impl Responder { async fn page(config: web::Data<Config>) -> impl Responder {
// Page de notes de cours Html(build_page(config.get_ref().to_owned()))
// Cf. https://univ.mylloon.fr/ }
// Cf. https://github.com/xy2z/PineDocs
actix_web::web::Redirect::to("/") #[derive(Content, Debug)]
struct CoursTemplate {
navbar: NavBar,
}
// #[once(time = 60)]
fn build_page(config: Config) -> String {
config.tmpl.render(
"cours.html",
CoursTemplate {
navbar: NavBar {
cours: true,
..NavBar::default()
},
},
Infos {
page_title: Some("Cours".into()),
page_desc: Some("Cours à l'univ".into()),
page_kw: make_kw(&[
"cours",
"études",
"université",
"licence",
"master",
"notes",
"digital garden",
]),
},
)
} }

0
static/css/cours.css Normal file
View file

17
templates/cours.html Normal file
View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="fr">
<head dir="ltr">
{{>head.html}}
<link rel="stylesheet" href="/css/cours.css" />
</head>
<body>
<header>{{>navbar.html}}</header>
<main>
{{#data}}
<p>Coucou</p>
{{/data}}
</main>
</body>
</html>

View file

@ -45,9 +45,8 @@
<p><a <p><a
class="_ {{#cours}}bold{{/cours}}" class="_ {{#cours}}bold{{/cours}}"
href="https://univ.mylloon.fr" href="/cours"
title="Page des notes de cours" title="Page des notes de cours"
target="_blank"
>Cours</a >Cours</a
></p> ></p>