Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
refactor: add helper to add the usual stuff to the HEAD element
Lars Wirzenius committed 1 year ago
commit a34df9980facec6d4cd302a96bc879aa9e5ecdff
parent 54029ae3e7e630065c805a8385cfd498b1da0497
1 file changed +13 -12
modified src/pages.rs
@@ -116,18 +116,9 @@ impl PageData {
    fn status_page_as_html(&self) -> Result<HtmlPage, PageError> {
        let mut doc = HtmlPage::default();

-
        doc.push_to_head(
-
            Element::new(Tag::Title)
-
                .with_text("CI for Radicle node ")
-
                .with_text(&self.node_alias),
-
        );
-

-
        doc.push_to_head(Element::new(Tag::Style).with_text(CSS));
-

-
        doc.push_to_head(
-
            Element::new(Tag::Meta)
-
                .with_attribute("http-equiv", "refresh")
-
                .with_attribute("content", REFERESH_INTERVAL),
+
        Self::head(
+
            &mut doc,
+
            &format!("CI for Radicle node {}", self.node_alias),
        );

        doc.push_to_body(
@@ -260,6 +251,16 @@ impl PageData {
        Ok(doc)
    }

+
    fn head(page: &mut HtmlPage, title: &str) {
+
        page.push_to_head(Element::new(Tag::Title).with_text(title));
+
        page.push_to_head(Element::new(Tag::Style).with_text(CSS));
+
        page.push_to_head(
+
            Element::new(Tag::Meta)
+
                .with_attribute("http-equiv", "refresh")
+
                .with_attribute("content", REFERESH_INTERVAL),
+
        );
+
    }
+

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