Skip to content

Commit

Permalink
restructure an if
Browse files Browse the repository at this point in the history
  • Loading branch information
enaut committed Oct 4, 2021
1 parent e98b468 commit c148e83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions app/src/pages/list_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/list_users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit c148e83

Please sign in to comment.