Separate archived items
This commit is contained in:
parent
208cfe3608
commit
91bbfbd4d4
1 changed files with 15 additions and 1 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -29,6 +29,9 @@ fn main() {
|
||||||
fn display_projects() -> rouille::Response {
|
fn display_projects() -> rouille::Response {
|
||||||
let projects = db::list_all_projects().unwrap_or_default();
|
let projects = db::list_all_projects().unwrap_or_default();
|
||||||
|
|
||||||
|
let active_projects: Vec<_> = projects.iter().filter(|p| !p.archived).collect();
|
||||||
|
let archived_projects: Vec<_> = projects.iter().filter(|p| p.archived).collect();
|
||||||
|
|
||||||
let markup = html! {
|
let markup = html! {
|
||||||
(DOCTYPE)
|
(DOCTYPE)
|
||||||
html {
|
html {
|
||||||
|
|
@ -41,7 +44,17 @@ fn display_projects() -> rouille::Response {
|
||||||
body {
|
body {
|
||||||
main {
|
main {
|
||||||
section {
|
section {
|
||||||
@for project in &projects {
|
@for project in &active_projects {
|
||||||
|
project-card
|
||||||
|
title=(project.title)
|
||||||
|
percentage=(project.percentage_completed)
|
||||||
|
archived=(project.archived) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
details {
|
||||||
|
summary { "Archived" }
|
||||||
|
section {
|
||||||
|
@for project in &archived_projects {
|
||||||
project-card
|
project-card
|
||||||
title=(project.title)
|
title=(project.title)
|
||||||
percentage=(project.percentage_completed)
|
percentage=(project.percentage_completed)
|
||||||
|
|
@ -51,6 +64,7 @@ fn display_projects() -> rouille::Response {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rouille::Response::html(markup.into_string())
|
rouille::Response::html(markup.into_string())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue