diff options
author | Tuomas Siipola | 2020-01-12 21:58:58 +0200 |
---|---|---|
committer | Tuomas Siipola | 2020-01-12 21:58:58 +0200 |
commit | 09ed14b1c25590bc838532c4ea54c91bef9329b5 (patch) | |
tree | a4f1ebfb40f84cdde62358b7fbfebb2e7a15b4f3 | |
parent | aa7af6de4c2e57a76accf3fd6cac9300356e412b (diff) |
Set title page
-rw-r--r-- | src/main.rs | 8 | ||||
-rw-r--r-- | templates/blob.html | 10 | ||||
-rw-r--r-- | templates/commit.html | 10 | ||||
-rw-r--r-- | templates/log.html | 2 | ||||
-rw-r--r-- | templates/repo.html | 2 | ||||
-rw-r--r-- | templates/summary.html | 9 | ||||
-rw-r--r-- | templates/tags.html | 2 | ||||
-rw-r--r-- | templates/tree.html | 11 |
8 files changed, 50 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 7f6dc3c..e9649c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,6 +139,10 @@ impl<'a> Commit<'a> { } } + fn message(&self) -> Option<&str> { + self.commit.message() + } + fn summary(&self) -> Option<&str> { self.commit.summary() } @@ -364,7 +368,7 @@ async fn blob(name: &str, parts: &[&str]) -> MyResponse { struct CommitTemplate<'a> { tab: Tab, repo: &'a RepoMetadata, - commit: git2::Commit<'a>, + commit: Commit<'a>, diff: &'a [(char, String)], } @@ -387,7 +391,7 @@ async fn commit(name: &str, id: &str) -> MyResponse { let tmpl = CommitTemplate { tab: Tab::Log, repo: &meta, - commit, + commit: Commit::new(commit), diff: &diff_output, }; Ok(Response::builder() diff --git a/templates/blob.html b/templates/blob.html index 34c7b30..647bef4 100644 --- a/templates/blob.html +++ b/templates/blob.html @@ -5,6 +5,16 @@ {% extends "repo.html" %} +{% block title %} + {% for entry in breadcrumb[1..] %} + {{- entry.1 -}} + {%- if !loop.last -%} + / + {%- endif -%} + {% endfor %} + | {{ repo.name }} +{% endblock %} + {% block tab %} <ul class="breadcrumb"> {% for entry in breadcrumb %} diff --git a/templates/commit.html b/templates/commit.html index 752f8da..251de92 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -5,6 +5,16 @@ {% extends "repo.html" %} +{% block title %} + {% match commit.summary() %} + {% when Some with (summary) %} + {{ summary }} ({{ commit.id[..8] }}) + {% when None %} + {{ commit.id[..8] }} + {% endmatch %} + | {{ repo.name }} +{% endblock %} + {% block tab %} {% match commit.message() %} {% when Some with (message) %} diff --git a/templates/log.html b/templates/log.html index 1d39fbb..ff53610 100644 --- a/templates/log.html +++ b/templates/log.html @@ -5,6 +5,8 @@ {% extends "repo.html" %} +{% block title %}log | {{ repo.name }}{% endblock %} + {% block tab %} <ul class="commits"> {% for commit in commits %} diff --git a/templates/repo.html b/templates/repo.html index 87ec040..dc8c78c 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -5,8 +5,6 @@ {% extends "base.html" %} -{% block title %}{{ repo.name }}{% endblock %} - {% block content %} <h1> <a href="/">index</a><span>/</span><a href="/{{ repo.name }}">{{ repo.name }}</a> diff --git a/templates/summary.html b/templates/summary.html index 97cba0c..f0ea1b6 100644 --- a/templates/summary.html +++ b/templates/summary.html @@ -5,6 +5,15 @@ {% extends "repo.html" %} +{% block title %} + {{ repo.name }} + {% match repo.desc %} + {% when Some with (desc) %} + - {{ desc }} + {% when None %} + {% endmatch %} +{% endblock %} + {% block tab %} <h2>Latests commits</h2> <ul class="commits"> diff --git a/templates/tags.html b/templates/tags.html index 59c5f73..5657672 100644 --- a/templates/tags.html +++ b/templates/tags.html @@ -5,6 +5,8 @@ {% extends "repo.html" %} +{% block title %}tags | {{ repo.name }}{% endblock %} + {% block tab %} {% if tags.is_empty() %} <p class="placeholder">no tags yet</p> diff --git a/templates/tree.html b/templates/tree.html index 4f8ad9b..ba8312e 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -5,6 +5,17 @@ {% extends "repo.html" %} +{% block title %} + {% if breadcrumb.len() > 1 %} + {% for entry in breadcrumb[1..] -%} + {{ entry.1 }}/ + {%- endfor %} + {% else %} + tree + {% endif %} + | {{ repo.name }} +{% endblock %} + {% block tab %} <ul class="breadcrumb"> {% for entry in breadcrumb %} |