Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
refactor: add a helper function to add an H1 element
Lars Wirzenius committed 1 year ago
commit 404a8dcd979b8652d54d7ab3bb99439fe5d018e4
parent 39b5c0a2fe9c632f05f88467c4007575aa4c4534
1 file changed +7 -3
modified src/pages.rs
@@ -121,7 +121,7 @@ impl PageData {

        doc.push_to_body(Element::new(Tag::H1).with_text(&title));

-
        doc.push_to_body(Element::new(Tag::H2).with_text("Broker status"));
+
        Self::h1(&mut doc, "Broker status");
        doc.push_to_body(
            Element::new(Tag::P)
                .with_text("Last updated: ")
@@ -134,7 +134,7 @@ impl PageData {
                .with_text(")"),
        );

-
        doc.push_to_body(Element::new(Tag::H2).with_text("Repositories"));
+
        Self::h1(&mut doc, "Repositories");

        doc.push_to_body(Element::new(Tag::P).with_text("Latest CI run for each repository."));

@@ -226,7 +226,7 @@ impl PageData {
        }
        doc.push_to_body(list);

-
        doc.push_to_body(Element::new(Tag::H2).with_text("Recent status"));
+
        Self::h1(&mut doc, "Recent status");
        let status = StatusData::from(self).as_json()?;
        doc.push_to_body(
            Element::new(Tag::P)
@@ -255,6 +255,10 @@ impl PageData {
        );
    }

+
    fn h1(page: &mut HtmlPage, text: &str) {
+
        page.push_to_body(Element::new(Tag::H2).with_text(text));
+
    }
+

    fn whence_as_html(whence: &Whence) -> Element {
        match whence {
            Whence::Branch {