4 Commits
Author SHA1 Message Date
sbstp f480407927 update htmx to latest in 2.x branch
ci/woodpecker/push/e2e Pipeline was successful
ci/woodpecker/push/fmt Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
2026-08-07 22:53:42 -04:00
sbstp 9267786371 cargo fmt
ci/woodpecker/push/fmt Pipeline is pending
ci/woodpecker/push/test Pipeline is pending
ci/woodpecker/push/e2e Pipeline was canceled
2026-08-07 22:49:50 -04:00
sbstp e24f4ff7e2 archived list count 2026-08-07 22:49:31 -04:00
sbstp 56cd6e32e9 hx boost + bug fix 2026-08-07 22:46:53 -04:00
2 changed files with 9 additions and 7 deletions
+2
View File
@@ -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
View File
@@ -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 {