summaryrefslogtreecommitdiffstats
path: root/src/view/branch.rs
blob: ccfe8e15c571dbd3f8d57cd9ff5c89468f9bcb4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub const NAME: &'static str = "branch";

#[derive(serde::Serialize)]
pub struct Data<'a> {
    pub name: &'a str,
    pub branch_names: &'a [String],
    pub tag_names: &'a [String],

    pub branch_name: &'a str,
    pub tree_elements: &'a [crate::tree::TreeElement],
}

pub fn render<'a, 'r>(hb: &handlebars::Handlebars<'r>, data: Data<'a>) -> Result<String, handlebars::RenderError> {
    log::debug!("Rendering repo {}, branch {}", data.name, data.branch_name);
    log::trace!("Rendering with tree data: {:#?}", data.tree_elements);
    hb.render(self::NAME, &super::RenderData { parent: "base", data })
}