Repositories

grarr

(mirrored on github)

Wim Looman <wim@nemo157.com>
2c1482 Add link to pages
Wim Looman committed at 2016-03-11 13:40:26

Modified src/render/fa.rs

@@ -1,49 +1,48 @@
use std::fmt;
use maud::RenderOnce;
#[allow(dead_code)]
pub enum FA {
LevelUp,
GitSquare,
Sitemap,
Tag,
File,
Question,
CodeFork,
Home,
Info,
Cog,
macro_rules! fa {
($($e:ident => $v:expr,)*) => {
#[allow(dead_code)]
pub enum FA { $($e,)* }
impl FA {
fn class(self) -> &'static str {
match self {
$(FA::$e => concat!("fa fa-", $v),)*
}
}
}
};
}
fa! {
Book => "book",
CodeFork => "code-fork",
Cog => "cog",
File => "file",
GitSquare => "git-square",
Home => "home",
Info => "info",
LevelUp => "level-up",
Question => "question",
Sitemap => "sitemap",
Tag => "tag",
}
#[allow(dead_code)]
pub enum FAM {
Li(FA),
FixedWidth(FA),
Lg(FA),
Li(FA),
X(u8, FA),
}
impl FA {
fn class(self) -> &'static str {
match self {
FA::LevelUp => "fa fa-level-up",
FA::GitSquare => "fa fa-git-square",
FA::Sitemap => "fa fa-sitemap",
FA::Tag => "fa fa-tag",
FA::File => "fa fa-file",
FA::Question => "fa fa-question",
FA::CodeFork => "fa fa-code-fork",
FA::Home => "fa fa-home",
FA::Info => "fa fa-info",
FA::Cog => "fa fa-cog",
}
}
}
impl FAM {
fn class(self) -> String {
match self {
FAM::Li(fa) => format!("fa-li {}", fa.class()),
FAM::FixedWidth(fa) => format!("fa-fw {}", fa.class()),
FAM::Lg(fa) => format!("fa-fw fa-lg {}", fa.class()),
FAM::Li(fa) => format!("fa-li {}", fa.class()),
FAM::X(mul, fa) => format!("fa-fw fa-{}x {}", mul, fa.class()),
}
}

Modified src/render/repository.rs

@@ -73,6 +73,16 @@ renderers! {
}
}
}
@if repo.find_branch("gh-pages", git2::BranchType::Local).is_ok() {
div.column.fixed {
h3 {
a href={ "/" ^path "/pages/" } {
^FAM::Lg(FA::Book)
" Pages"
}
}
}
}
}
}
}

Modified src/static/css/layout.css

@@ -261,4 +261,5 @@ pre.block-details {
.row { display: flex; flex-direction: row; }
.column { display: flex; flex-direction: column; flex-grow: 1; }
.column.fixed { flex-grow: 0; flex-shrink: 0; }
.column.align-top { align-self: flex-start; }
.center { align-items: center; }