Delete epic
This commit is contained in:
parent
ce6205f61d
commit
10fc8d81c9
@ -1,10 +1,32 @@
|
||||
use {
|
||||
crate::{shared::go_to_board, Msg},
|
||||
crate::{shared::go_to_board, ws::send_ws_msg, ModalType, Msg, OperationKind, ResourceKind},
|
||||
jirs_data::WsMsg,
|
||||
seed::prelude::*,
|
||||
};
|
||||
|
||||
pub fn update(msg: &Msg, _model: &mut crate::model::Model, orders: &mut impl Orders<Msg>) {
|
||||
if let Msg::ModalDropped = msg {
|
||||
go_to_board(orders);
|
||||
pub fn update(msg: &Msg, model: &mut crate::model::Model, orders: &mut impl Orders<Msg>) {
|
||||
let modal = match model.modals.iter_mut().find_map(|modal| {
|
||||
if let ModalType::DeleteEpic(modal) = modal {
|
||||
Some(modal)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}) {
|
||||
Some(modal) => modal,
|
||||
_ => return,
|
||||
};
|
||||
|
||||
match msg {
|
||||
Msg::ModalDropped => {
|
||||
go_to_board(orders);
|
||||
}
|
||||
Msg::DeleteEpic => {
|
||||
send_ws_msg(WsMsg::EpicDelete(modal.epic_id), model.ws.as_ref(), orders);
|
||||
}
|
||||
Msg::ResourceChanged(ResourceKind::Epic, OperationKind::SingleRemoved, Some(_)) => {
|
||||
go_to_board(orders);
|
||||
orders.skip().send_msg(Msg::ModalDropped);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
}
|
||||
|
@ -15,6 +15,11 @@ pub fn view(model: &model::Model, modal: &Model) -> Node<Msg> {
|
||||
.title("Delete empty epic")
|
||||
.cancel_text("Cancel")
|
||||
.confirm_text("Delete epic")
|
||||
.on_confirm(mouse_ev("click", move |ev| {
|
||||
ev.stop_propagation();
|
||||
ev.prevent_default();
|
||||
Msg::DeleteEpic
|
||||
}))
|
||||
.build()
|
||||
.into_node()
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user