index : sparkle-git.git

ascending towards madness

author holly sparkles <sparkles@holly.sh> 2023-12-08 17:05:23.0 +00:00:00
committer holly sparkles <sparkles@holly.sh> 2024-05-14 6:40:09.0 +00:00:00
commit
000c5dca60170c4efee0ecf91cac956211c48ead [patch]
tree
af921ac93ab6032ef4658e8f22ac2fad2c80cc86
parent
2220d69ccc3db78e32d11d0e24baec99a975dee8
download
000c5dca60170c4efee0ecf91cac956211c48ead.tar.gz

feat: add displaying custom root title



Diff

 src/methods/index.rs | 8 +++++++-
 templates/base.html  | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/methods/index.rs b/src/methods/index.rs
index ed10048..2964a40 100644
--- a/src/methods/index.rs
+++ b/src/methods/index.rs
@@ -6,6 +6,7 @@ use axum::{response::IntoResponse, Extension};

use super::filters;
use crate::{
    configuration::AppConfig,
    database::schema::repository::{Repository, YokedRepository},
    into_response,
};
@@ -14,10 +15,12 @@ use crate::{
#[template(path = "index.html")]
pub struct View {
    pub repositories: BTreeMap<Option<String>, Vec<YokedRepository>>,
    pub config: AppConfig,
}

pub async fn handle(
    Extension(db): Extension<Arc<rocksdb::DB>>,
    Extension(config): Extension<AppConfig>,
) -> Result<impl IntoResponse, super::repo::Error> {
    let mut repositories: BTreeMap<Option<String>, Vec<YokedRepository>> = BTreeMap::new();

@@ -34,5 +37,8 @@ pub async fn handle(
        k.push(v);
    }

    Ok(into_response(View { repositories }))
    Ok(into_response(View {
        repositories,
        config,
    }))
}
diff --git a/templates/base.html b/templates/base.html
index 74340ed..d573141 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -12,7 +12,7 @@
<header>
    <h1>
        <a href="/" class="no-hover">🏡</a>
        {% block header -%}Git repository browser{%- endblock %}
        {% block header -%}{{ config.root_title }}{%- endblock %}
    </h1>
</header>