Repositories

grarr

(mirrored on github)

Added src/handler/about.rs

@@ -0,0 +1,25 @@
use super::base::*;
#[derive(Clone)]
pub struct About;
impl Handler for About {
fn handle(&self, req: &mut Request) -> IronResult<Response> {
Html {
render: &render::About,
etag: None,
req: req,
}.into()
}
}
impl Route for About {
fn method() -> Method {
Method::Get
}
fn route() -> Cow<'static, str> {
"/-/about".into()
}
}

Modified src/handler/mod.rs

@@ -17,6 +17,7 @@ mod base;
pub mod error;
mod tree_entry;
mod settings;
mod about;
pub use self::avatar::Avatars;
pub use self::review::Review;
@@ -30,3 +31,4 @@ pub use self::tree_entry::TreeEntry;
pub use self::register::Register;
pub use self::statics::Static;
pub use self::settings::{ Settings, SettingsPost };
pub use self::about::About;

Modified src/main.rs

@@ -68,6 +68,7 @@ fn main() {
.register(handler::Repositories { root: root.clone().into() })
.register(handler::Settings)
.register(handler::SettingsPost)
.register(handler::About)
// .register(inject_repository_context(Path::new(&root), handler::Tree))
.register(inject_repository_context(Path::new(&root), handler::TreeEntry))
.register(statics![

Added src/render/about.rs

@@ -0,0 +1,12 @@
use maud_pulldown_cmark::Markdown;
renderers! {
About {
div.block {
div.block-header h3 "About"
div.block-details {
^Markdown::from_string(include_str!("../../README.md"))
}
}
}
}

Modified src/render/mod.rs

@@ -21,6 +21,7 @@ mod diff;
mod utils;
mod highlight;
mod settings;
mod about;
pub use self::style::Style;
pub use self::event::{ Event, Events };
@@ -41,3 +42,4 @@ pub use self::diff::DiffCommit;
pub use self::utils::MaybeLink;
pub use self::highlight::HighlightJS;
pub use self::settings::Settings;
pub use self::about::About;