Basic cours support #44
4 changed files with 59 additions and 8 deletions
|
@ -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")]
|
||||
async fn page() -> impl Responder {
|
||||
// Page de notes de cours
|
||||
// Cf. https://univ.mylloon.fr/
|
||||
// Cf. https://github.com/xy2z/PineDocs
|
||||
actix_web::web::Redirect::to("/")
|
||||
async fn page(config: web::Data<Config>) -> impl Responder {
|
||||
Html(build_page(config.get_ref().to_owned()))
|
||||
}
|
||||
|
||||
#[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
0
static/css/cours.css
Normal file
17
templates/cours.html
Normal file
17
templates/cours.html
Normal 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>
|
|
@ -45,9 +45,8 @@
|
|||
|
||||
<p><a
|
||||
class="_ {{#cours}}bold{{/cours}}"
|
||||
href="https://univ.mylloon.fr"
|
||||
href="/cours"
|
||||
title="Page des notes de cours"
|
||||
target="_blank"
|
||||
>Cours</a
|
||||
></p>
|
||||
|
||||
|
|
Loading…
Reference in a new issue