web: always show bulk-edit checkbox, fix check logic

This commit is contained in:
Bill Thiede 2025-04-13 19:24:40 -07:00
parent d84957cc8c
commit 4a6b159ddb

View File

@ -468,38 +468,42 @@ fn search_toolbar(
if let Some(tri) = tri.get() {
tri.set_indeterminate(indeterminate);
}
let catchup = div![button![
tw_classes::button(),
attrs! {At::Title => "Catch up"},
span![i![C!["far", "fa-eye"]]],
span![C!["pl-2", "hidden", "md:inline"], "Catch-up"],
ev(Ev::Click, |_| Msg::CatchupStart)
]];
let tristate_input = div![
C!["flex", "items-center", "mr-4"],
input![
&tri,
C![&tw_classes::CHECKBOX],
attrs! {
At::Type=>"checkbox",
},
IF!(all_selected=>attrs!{At::Checked=>true})
],
ev(Ev::Input, move |_| {
if all_selected {
Msg::SelectionSetNone
} else {
Msg::SelectionSetAll
}
}),
];
nav![
C!["py-4", "flex", "w-full", "justify-between"],
div![
C!["gap-2", "flex", IF!(show_bulk_edit => "hidden")],
div![button![
tw_classes::button(),
attrs! {At::Title => "Mark as read"},
span![i![C!["far", "fa-eye"]]],
span![C!["pl-2", "hidden", "md:inline"], "Catch-up"],
ev(Ev::Click, |_| Msg::CatchupStart)
]],
&tristate_input,
&catchup
],
div![
C!["gap-2", "flex", IF!(!show_bulk_edit => "hidden")],
div![
C!["flex", "items-center", "mr-4"],
input![
tri,
C![&tw_classes::CHECKBOX],
attrs! {
At::Type=>"checkbox",
At::Checked=>all_selected,
}
],
ev(Ev::Input, move |_| {
if all_selected {
Msg::SelectionSetNone
} else {
Msg::SelectionSetAll
}
}),
],
&tristate_input,
&catchup,
div![
button![
tw_classes::button(),