restructure an if
This commit is contained in:
parent
952e2ca296
commit
1b014841ab
@ -821,14 +821,7 @@ fn edit_or_create_link<F: Fn(&str) -> String>(
|
||||
],
|
||||
tr![
|
||||
th![t("qr-code")],
|
||||
if let Loadable::Data(Some(qr)) = qr {
|
||||
td![a![
|
||||
span![C!["qrdownload"], "Download", raw!(&qr.svg),],
|
||||
attrs!(At::Href => qr.url, At::Download => "qr-code.png")
|
||||
]]
|
||||
} else {
|
||||
td!["Loading..."]
|
||||
}
|
||||
qr.as_ref().map_or_else(|| td!["Loading..."], render_qr),
|
||||
]
|
||||
],
|
||||
a![
|
||||
@ -842,6 +835,13 @@ fn edit_or_create_link<F: Fn(&str) -> String>(
|
||||
]
|
||||
}
|
||||
|
||||
fn render_qr(qr: &QrGuard) -> Node<Msg> {
|
||||
td![a![
|
||||
span![C!["qrdownload"], "Download", raw!(&qr.svg),],
|
||||
attrs!(At::Href => qr.url, At::Download => "qr-code.png")
|
||||
]]
|
||||
}
|
||||
|
||||
/// generate a qr-code for a code
|
||||
fn generate_qr_from_code(code: &str) -> String {
|
||||
generate_qr_from_link(&format!("https://{}/{}", get_host(), code))
|
||||
|
@ -393,7 +393,7 @@ fn view_user_table_head<F: Fn(&str) -> String>(t: F) -> Node<Msg> {
|
||||
]
|
||||
}
|
||||
|
||||
/// Display the filterboxes below the headlines
|
||||
/// Display the filter-boxes below the headlines
|
||||
fn view_user_table_filter_input<F: Fn(&str) -> String>(model: &Model, t: F) -> Node<Msg> {
|
||||
tr![
|
||||
C!["filters"],
|
||||
|
Loading…
Reference in New Issue
Block a user