Dependency rows open their task; cards list both directions as keys
Browse files at this commita3f3384c30305bdea689336abc9895e8f16fd7faParent: 3faf6a34 changed files +84 -8
- crates/izlek-web/src/board.rs +2 -2
- crates/izlek-web/src/detail.rs +12 -6
- crates/izlek-web/tests/http.rs +54 -0
- style/main.scss +16 -0
crates/izlek-web/src/board.rsmodified+2 -2
| @@ -367,7 +367,7 @@ async fn render_card( | |||
| 367 | default_tag_id: Option<&str>, | 367 | default_tag_id: Option<&str>, |
| 368 | lang: Lang, | 368 | lang: Lang, |
| 369 | ) -> Result { | 369 | ) -> Result { |
| 370 | - let blocks = card.blocks.len(); | 370 | + let blocks = card.blocks.join(", "); |
| 371 | let blocked_by = card.blocked_by.join(", "); | 371 | let blocked_by = card.blocked_by.join(", "); |
| 372 | let overdue = card.is_overdue(today); | 372 | let overdue = card.is_overdue(today); |
| 373 | let deadline_parts = card.deadline_parts(today); | 373 | let deadline_parts = card.deadline_parts(today); |
| @@ -423,7 +423,7 @@ async fn render_card( | |||
| 423 | > | 423 | > |
| 424 | <div class="card-keys"> | 424 | <div class="card-keys"> |
| 425 | <span class="card-key">(card.task_key.clone())</span> | 425 | <span class="card-key">(card.task_key.clone())</span> |
| 426 | - if blocks > 0 { <span class="card-blocks">(format!("{} {blocks}", t(lang, Key::Blocks)))</span> } | 426 | + if !blocks.is_empty() { <span class="card-blocks">(format!("{} {blocks}", t(lang, Key::Blocks)))</span> } |
| 427 | if !blocked_by.is_empty() { | 427 | if !blocked_by.is_empty() { |
| 428 | <span class="card-blocked-by">(format!("{} {blocked_by}", t(lang, Key::BlockedBy)))</span> | 428 | <span class="card-blocked-by">(format!("{} {blocked_by}", t(lang, Key::BlockedBy)))</span> |
| 429 | } | 429 | } |
crates/izlek-web/src/detail.rsmodified+12 -6
| @@ -1755,15 +1755,21 @@ async fn dep_row( | |||
| 1755 | Direction::Blocks => t(lang, Key::Blocks).to_uppercase(), | 1755 | Direction::Blocks => t(lang, Key::Blocks).to_uppercase(), |
| 1756 | }; | 1756 | }; |
| 1757 | let remove_title = t(lang, Key::RemoveThisLink); | 1757 | let remove_title = t(lang, Key::RemoveThisLink); |
| 1758 | + let href = format!("/?task={}", edge.task_id); | ||
| 1758 | view! { | 1759 | view! { |
| 1759 | cx => | 1760 | cx => |
| 1760 | <div class=(class!("dep-row", "dep-row-waiting" if waiting))> | 1761 | <div class=(class!("dep-row", "dep-row-waiting" if waiting))> |
| 1761 | - <span class="dep-tag">(tag)</span> | 1762 | + // One link, not two, the subtask row's own shape: tag, key, |
| 1762 | - if cleared { (glyph::tick(cx).await?) } else { (glyph::lock(cx).await?) } | 1763 | + // title and note are the same target, so the whole stretch |
| 1763 | - <span class="dep-key">(edge.task_key.clone())</span> | 1764 | + // between the row's edges and the X is the way in. |
| 1764 | - <span class="dep-title">(edge.title.clone())</span> | 1765 | + <a class="dep-link" href=(href)> |
| 1765 | - <div class="spacer"></div> | 1766 | + <span class="dep-tag">(tag)</span> |
| 1766 | - <span class="dep-note">(note)</span> | 1767 | + if cleared { (glyph::tick(cx).await?) } else { (glyph::lock(cx).await?) } |
| 1768 | + <span class="dep-key">(edge.task_key.clone())</span> | ||
| 1769 | + <span class="dep-title">(edge.title.clone())</span> | ||
| 1770 | + <div class="spacer"></div> | ||
| 1771 | + <span class="dep-note">(note)</span> | ||
| 1772 | + </a> | ||
| 1767 | if may_write { | 1773 | if may_write { |
| 1768 | <form class="dep-unlink-form" method="post" action="/api/unlink_tasks"> | 1774 | <form class="dep-unlink-form" method="post" action="/api/unlink_tasks"> |
| 1769 | <input type="hidden" name="task_id" value=(task_id.to_string())> | 1775 | <input type="hidden" name="task_id" value=(task_id.to_string())> |
crates/izlek-web/tests/http.rsmodified+54 -0
| @@ -9520,3 +9520,57 @@ async fn the_password_pane_names_each_failure() { | |||
| 9520 | let tr_html = String::from_utf8_lossy(&tr.bytes); | 9520 | let tr_html = String::from_utf8_lossy(&tr.bytes); |
| 9521 | assert!(tr_html.contains("Bu zaten mevcut parolan."), "{tr_html}"); | 9521 | assert!(tr_html.contains("Bu zaten mevcut parolan."), "{tr_html}"); |
| 9522 | } | 9522 | } |
| 9523 | + | ||
| 9524 | +/// A card's dependency summary names both directions with keys: what the card | ||
| 9525 | +/// blocks and what blocks it, the same list shape either way. | ||
| 9526 | +#[tokio::test] | ||
| 9527 | +async fn a_card_lists_both_dependency_directions_as_keys() { | ||
| 9528 | + let app = App::open().await; | ||
| 9529 | + let admin = admin(&app).await; | ||
| 9530 | + let column = first_column(&app).await; | ||
| 9531 | + let first = a_task(&app, &admin, &column, "Lay the cable").await; | ||
| 9532 | + let second = a_task(&app, &admin, &column, "Light the cable").await; | ||
| 9533 | + let first_key = app | ||
| 9534 | + .store | ||
| 9535 | + .task(&first) | ||
| 9536 | + .await | ||
| 9537 | + .unwrap() | ||
| 9538 | + .expect("first task gone") | ||
| 9539 | + .row | ||
| 9540 | + .task_key; | ||
| 9541 | + let second_key = app | ||
| 9542 | + .store | ||
| 9543 | + .task(&second) | ||
| 9544 | + .await | ||
| 9545 | + .unwrap() | ||
| 9546 | + .expect("second task gone") | ||
| 9547 | + .row | ||
| 9548 | + .task_key; | ||
| 9549 | + | ||
| 9550 | + // `second` is blocked by `first`, so `first` blocks `second`. | ||
| 9551 | + let answer = app | ||
| 9552 | + .post( | ||
| 9553 | + "/api/link_tasks", | ||
| 9554 | + Some(&admin), | ||
| 9555 | + &[ | ||
| 9556 | + ("task_id", &second), | ||
| 9557 | + ("other_id", &first), | ||
| 9558 | + ("direction", "blocked_by"), | ||
| 9559 | + ], | ||
| 9560 | + ) | ||
| 9561 | + .await; | ||
| 9562 | + assert_eq!(answer.body, "null", "the link was refused: {}", answer.body); | ||
| 9563 | + | ||
| 9564 | + let page = app.get("/", Some(&admin)).await; | ||
| 9565 | + let html = String::from_utf8_lossy(&page.bytes); | ||
| 9566 | + assert!( | ||
| 9567 | + html.contains(&format!(r#"class="card-blocks">blocks {second_key}</span>"#)), | ||
| 9568 | + "the blocker's card did not name what it blocks: {html}" | ||
| 9569 | + ); | ||
| 9570 | + assert!( | ||
| 9571 | + html.contains(&format!( | ||
| 9572 | + r#"class="card-blocked-by">blocked by {first_key}</span>"# | ||
| 9573 | + )), | ||
| 9574 | + "the blocked card did not name its blocker: {html}" | ||
| 9575 | + ); | ||
| 9576 | +} | ||
style/main.scssmodified+16 -0
| @@ -2392,6 +2392,22 @@ img.avatar { | |||
| 2392 | color: var(--muted-soft); | 2392 | color: var(--muted-soft); |
| 2393 | } | 2393 | } |
| 2394 | 2394 | ||
| 2395 | +// The dependency row's way in, the subtask row's own shape (`subtask-open`): | ||
| 2396 | +// tag, key, title and note are one target, so the whole stretch between the | ||
| 2397 | +// row's edges and the X is one anchor — `flex: 1` keeps the note at the row's | ||
| 2398 | +// right edge where it stood before the row learned to open its task. | ||
| 2399 | +.dep-link { | ||
| 2400 | + display: flex; | ||
| 2401 | + flex: 1; | ||
| 2402 | + align-items: center; | ||
| 2403 | + gap: 10px; | ||
| 2404 | + min-width: 0; | ||
| 2405 | + color: inherit; | ||
| 2406 | + text-decoration: none; | ||
| 2407 | + | ||
| 2408 | + &:hover .dep-title { text-decoration: underline; } | ||
| 2409 | +} | ||
| 2410 | + | ||
| 2395 | .dep-unlink-form { display: inline-flex; } | 2411 | .dep-unlink-form { display: inline-flex; } |
| 2396 | 2412 | ||
| 2397 | .dep-unlink { | 2413 | .dep-unlink { |