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