Compare commits
4
Commits
689bd95ff0
...
0.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f480407927 | ||
|
|
9267786371 | ||
|
|
e24f4ff7e2 | ||
|
|
56cd6e32e9 |
@@ -603,10 +603,12 @@ async fn lists_page(
|
|||||||
user: CurrentUser,
|
user: CurrentUser,
|
||||||
) -> Result<Response, AppError> {
|
) -> Result<Response, AppError> {
|
||||||
let lists = state.lists.list_summaries().await?;
|
let lists = state.lists.list_summaries().await?;
|
||||||
|
let archived = state.lists.list_archived_summaries().await?;
|
||||||
let categories = state.lists.categories().await?;
|
let categories = state.lists.categories().await?;
|
||||||
Ok(html_response(views::lists_page(
|
Ok(html_response(views::lists_page(
|
||||||
&user.session.user,
|
&user.session.user,
|
||||||
&lists,
|
&lists,
|
||||||
|
archived.len(),
|
||||||
&categories,
|
&categories,
|
||||||
&user.session.csrf_token,
|
&user.session.csrf_token,
|
||||||
)))
|
)))
|
||||||
|
|||||||
+7
-7
@@ -173,6 +173,7 @@ pub fn account_page(
|
|||||||
pub fn lists_page(
|
pub fn lists_page(
|
||||||
user: &User,
|
user: &User,
|
||||||
lists: &[GroceryList],
|
lists: &[GroceryList],
|
||||||
|
archived_count: usize,
|
||||||
categories: &[Category],
|
categories: &[Category],
|
||||||
csrf_token: &str,
|
csrf_token: &str,
|
||||||
) -> Markup {
|
) -> Markup {
|
||||||
@@ -192,7 +193,7 @@ pub fn lists_page(
|
|||||||
div class="panel-heading" {
|
div class="panel-heading" {
|
||||||
h2 { "Lists" }
|
h2 { "Lists" }
|
||||||
span class="count-badge" { (lists.len()) }
|
span class="count-badge" { (lists.len()) }
|
||||||
a class="archive-link" href="/archive" { "Archived →" }
|
a class="archive-link" href="/archive" { "Archived " span class="count-badge" { (archived_count) } " →" }
|
||||||
}
|
}
|
||||||
@if lists.is_empty() {
|
@if lists.is_empty() {
|
||||||
div class="empty-state" {
|
div class="empty-state" {
|
||||||
@@ -1103,7 +1104,7 @@ pub fn live_list_fragments(
|
|||||||
) -> Markup {
|
) -> Markup {
|
||||||
let editable = list.archived_at.is_none();
|
let editable = list.archived_at.is_none();
|
||||||
html! {
|
html! {
|
||||||
(list_content_fragment(list, items, categories, csrf_token, true, editable))
|
(list_items_fragment(list, items, categories, csrf_token, true, editable))
|
||||||
(list_meals_panel(list_meals, list.id, csrf_token, true, editable))
|
(list_meals_panel(list_meals, list.id, csrf_token, true, editable))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1248,8 +1249,7 @@ fn format_date(timestamp: i64) -> String {
|
|||||||
let days = timestamp.div_euclid(86_400);
|
let days = timestamp.div_euclid(86_400);
|
||||||
let (y, m, d) = civil_from_days(days);
|
let (y, m, d) = civil_from_days(days);
|
||||||
const MONTHS: [&str; 12] = [
|
const MONTHS: [&str; 12] = [
|
||||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
||||||
"Dec",
|
|
||||||
];
|
];
|
||||||
format!("{} {} {}", d, MONTHS[(m - 1) as usize], y)
|
format!("{} {} {}", d, MONTHS[(m - 1) as usize], y)
|
||||||
}
|
}
|
||||||
@@ -1293,10 +1293,10 @@ fn page(title: &str, user: Option<&User>, content: Markup) -> Markup {
|
|||||||
meta name="viewport" content="width=device-width, initial-scale=1";
|
meta name="viewport" content="width=device-width, initial-scale=1";
|
||||||
title { (title) " · Sustenance" }
|
title { (title) " · Sustenance" }
|
||||||
link rel="stylesheet" href="/static/style.css";
|
link rel="stylesheet" href="/static/style.css";
|
||||||
script src="https://unpkg.com/htmx.org@2.0.4" {}
|
script src="https://unpkg.com/htmx.org@2.0.10" {}
|
||||||
script src="https://unpkg.com/htmx-ext-ws@2.0.2/ws.js" {}
|
script src="https://unpkg.com/htmx-ext-ws@2.0.4/ws.js" {}
|
||||||
}
|
}
|
||||||
body {
|
body hx-boost="true" {
|
||||||
header class="site-header" {
|
header class="site-header" {
|
||||||
a class="brand" href="/lists" { span class="brand-mark" { "S" } "Sustenance" }
|
a class="brand" href="/lists" { span class="brand-mark" { "S" } "Sustenance" }
|
||||||
@if let Some(user) = user {
|
@if let Some(user) = user {
|
||||||
|
|||||||
Reference in New Issue
Block a user