updates templates with new capabilities
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
<li><a class=dashboardButton href="/">
|
||||
<span class=collapse>dashboard</span>
|
||||
</a></li>
|
||||
<li><a class=profileButton href="/{{ user }}">
|
||||
<li><a class=profileButton href="/~{{ user }}">
|
||||
<span class=collapse>profile</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -94,7 +94,7 @@
|
||||
viewing
|
||||
<span class=linkedPath>
|
||||
{% block breadcrumbs %}
|
||||
<a href="/">{{ owner }}</a>/<a href="/">{{ repo }}</a>
|
||||
<a href="/~{{ owner }}">{{ owner }}</a>/<a href="/~{{ owner }}/{{ repo }}">{{ repo }}</a>
|
||||
{% endblock breadcrumbs %}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{% block page %}code{% endblock page %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<a href="/">{{ owner }}</a>/<a href="/">{{ repo }}</a>/<a href="/">{{ branch }}</a>
|
||||
<a href="/~{{ owner }}">{{ owner }}</a>/<a href="/~{{ owner }}/{{ repo }}">{{ repo }}</a>/<a href="/">{{ branch }}</a>
|
||||
{% endblock breadcrumbs %}
|
||||
|
||||
{% block content %}
|
||||
@@ -19,7 +19,7 @@
|
||||
{% block entries_list %}
|
||||
{% for entry in entries %}
|
||||
<tr>
|
||||
<td><a class={{ entry.class }} href="/">{{ entry.path }}</a></td>
|
||||
<td><a class={{ entry.class }} href="./{{ entry.path }}">{{ entry.path }}</a></td>
|
||||
<td><a class=commit href="./?commit={{ entry.last_commit }}">
|
||||
{{ entry.last_commit_message }}
|
||||
</a></td>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use std::error::Error;
|
||||
|
||||
use gix::{ Repository, traverse::tree::Recorder, prelude::* };
|
||||
use gix::{ Repository, object::tree::EntryKind };
|
||||
use serde::Serialize;
|
||||
use tera::Context;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct Entry {
|
||||
class: u16,
|
||||
class: String,
|
||||
last_commit: String,
|
||||
last_commit_message: String,
|
||||
last_commit_time: String,
|
||||
@@ -26,7 +26,6 @@ pub fn repo_to_context(r: Repository) -> Result<Context, Box<dyn Error>> {
|
||||
/* replace with configurable branch name when we have a database */
|
||||
let current_branch = r.head()?.referent_name().unwrap().to_string();
|
||||
|
||||
//tree.traverse().breadthfirst(&mut rec)?;
|
||||
for e in tree.iter() {
|
||||
let entry = e.unwrap();
|
||||
|
||||
@@ -34,8 +33,14 @@ pub fn repo_to_context(r: Repository) -> Result<Context, Box<dyn Error>> {
|
||||
let last_commit_message = "TODO".to_string();
|
||||
let last_commit_time = "1970-01-01T00:00:00".to_string();
|
||||
|
||||
let class = match entry.kind() {
|
||||
EntryKind::Tree => "directory",
|
||||
EntryKind::Blob => "file",
|
||||
_ => "",
|
||||
}.to_owned();
|
||||
|
||||
entries.push(Entry {
|
||||
class: entry.kind() as u16,
|
||||
class,
|
||||
last_commit,
|
||||
last_commit_message,
|
||||
last_commit_time,
|
||||
|
||||
Reference in New Issue
Block a user