Repositories

grarr

(mirrored on github)

Wim Looman <wim@nemo157.com>
3fdf59 Add consistent top header
Wim Looman committed at 2016-02-19 14:24:23

Modified src/render/mod.rs

@@ -30,7 +30,7 @@ pub use self::ci_status::{ CIStatus };
pub use self::analysis::{ Analysis };
pub use self::avatar::{ Avatar };
pub use self::commit::{ Commit, Commits };
pub use self::repository::{ Repository, Repositories, RepositoryHeader };
pub use self::repository::{ Repository, Repositories, RepositoryHeader, RepositoriesHeader };
pub use self::repository_wrapper::{ RepositoryWrapper };
pub use self::error::{ Error };
pub use self::tree::{ TreeEntry };

Modified src/render/repository.rs

@@ -90,11 +90,19 @@ renderers! {
}
Repositories(repos: Vec<(String, git2::Repository)>) {
h1 { "Repositories" }
^RepositoriesHeader
@for (path, repo) in repos {
^RepositoryStub(&path, &repo)
}
}
RepositoriesHeader {
div.block {
div.block-header {
h1 { a href="/" { "Repositories" } }
}
}
}
}
impl<'a> super::repository_wrapper::RepositoryTab for &'a Repository<'a> {

Modified src/render/repository_wrapper.rs

@@ -1,6 +1,5 @@
use std::fmt;
use maud::RenderOnce;
use super::fa::{ FA };
use { RepositoryContext };
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
@@ -11,17 +10,6 @@ pub enum Tab {
Reviews,
}
impl Tab {
fn css_class(&self) -> &'static str {
match *self {
Tab::Overview => "overview",
Tab::Files => "files",
Tab::Commits => "commits",
Tab::Reviews => "reviews",
}
}
}
pub trait RepositoryTab {
fn tab() -> Tab;
}
@@ -34,7 +22,7 @@ impl<'a, R: RenderOnce + RepositoryTab> RenderOnce for RepositoryWrapper<'a, R>
let RepositoryWrapper(context, content) = self;
let path = context.requested_path.to_string_lossy().into_owned();
html!(w, {
^FA::LevelUp " " a href="/" { "Repositories" }
^super::RepositoriesHeader
div.block {
^super::RepositoryHeader(&path, &context.repository)
^RepositoryWrapperTabs(tab, path, context.repository.head().unwrap().shorthand().unwrap().to_owned())

Modified src/static/css/layout.css

@@ -8,7 +8,7 @@ h1, h2, h3, h4, h5, h6 {
body {
font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 1rem auto;
margin: 0 auto;
max-width: 50rem;
line-height: 1.2;
padding: 0;