From e42baf3ca9abec7405578bbe1659966370d5c7c1 Mon Sep 17 00:00:00 2001 From: emma Date: Fri, 6 Mar 2026 19:04:02 -0700 Subject: [PATCH] updates templates with new capabilities --- assets/templates/repo/base.html | 4 ++-- assets/templates/repo/code.html | 4 ++-- src/backend/git.rs | 13 +++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/assets/templates/repo/base.html b/assets/templates/repo/base.html index 635f8d3..a9bc702 100644 --- a/assets/templates/repo/base.html +++ b/assets/templates/repo/base.html @@ -66,7 +66,7 @@
  • dashboard
  • -
  • +
  • profile
  • @@ -94,7 +94,7 @@ viewing {% block breadcrumbs %} - {{ owner }}/{{ repo }} + {{ owner }}/{{ repo }} {% endblock breadcrumbs %} diff --git a/assets/templates/repo/code.html b/assets/templates/repo/code.html index f58307f..adc04a8 100644 --- a/assets/templates/repo/code.html +++ b/assets/templates/repo/code.html @@ -3,7 +3,7 @@ {% block page %}code{% endblock page %} {% block breadcrumbs %} - {{ owner }}/{{ repo }}/{{ branch }} +{{ owner }}/{{ repo }}/{{ branch }} {% endblock breadcrumbs %} {% block content %} @@ -19,7 +19,7 @@ {% block entries_list %} {% for entry in entries %} - {{ entry.path }} + {{ entry.path }} {{ entry.last_commit_message }} diff --git a/src/backend/git.rs b/src/backend/git.rs index 9e269ab..7636b4a 100644 --- a/src/backend/git.rs +++ b/src/backend/git.rs @@ -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> { /* 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> { 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,