mirror of
https://seed.radicle.dev/rad:zwTxygwuz5LDGBq255RA2CbNGrz8.git
synced 2026-11-22 03:10:37 +08:00
refactor: add helper to add the usual stuff to the HEAD element
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
+13
-12
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user