diff --git a/Cargo.lock b/Cargo.lock index 599eafe..9e82fa2 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -1395,9 +1395,9 @@ dependencies = [ [[package]] name = "html-minifier" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f74036e4be1b97eaf78bcf795d55002eccf613d5c4705bf78d3b92649ab00f" +checksum = "cb8f62e1c8ee7bbdda853aebbbfb78b75a549a45ab031665a5da07a1579a1ad8" dependencies = [ "cow-utils", "educe", @@ -1753,9 +1753,9 @@ dependencies = [ [[package]] name = "minifier" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb022374af2f446981254e6bf9efb6e2c9e1a53176d395fca02792fd4435729" +checksum = "95bbbf96b9ac3482c2a25450b67a15ed851319bc5fabf3b40742ea9066e84282" [[package]] name = "minimal-lexical" diff --git a/Cargo.toml b/Cargo.toml index 658d361..f92aa63 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ toml = "0.8.6" [build-dependencies] anyhow = "1.0.74" glob = "0.3.1" -html-minifier = "4.0.0" +html-minifier = "5.0.0" [profile.dev] opt-level = 1 diff --git a/src/web/index.rs b/src/web/index.rs index e3339d2..9b3a2fe 100755 --- a/src/web/index.rs +++ b/src/web/index.rs @@ -2,12 +2,20 @@ use actix_web::{get, web::Data, HttpRequest, HttpResponse}; use askama::Template; use super::tcx::TemplateCtx; -use crate::{ctx::Ctx, db::models::Post, error::NekrochanError, filters, web::template_response}; +use crate::{ + ctx::Ctx, + db::models::{Board, Post}, + error::NekrochanError, + filters, + web::template_response, +}; #[derive(Template)] #[template(path = "index.html")] + struct IndexTemplate { tcx: TemplateCtx, + boards: Vec, posts: Vec, files: Vec, } @@ -15,10 +23,12 @@ struct IndexTemplate { #[get("/")] pub async fn index(ctx: Data, req: HttpRequest) -> Result { let tcx = TemplateCtx::new(&ctx, &req).await?; + + let boards = Board::read_all(&ctx).await?; let posts = Post::read_latest(&ctx).await.unwrap_or_else(|_| Vec::new()); let files = Post::read_files(&ctx).await.unwrap_or_else(|_| Vec::new()); - let template = IndexTemplate { tcx, posts, files }; + let template = IndexTemplate { tcx, boards, posts, files }; template_response(&template) } diff --git a/static/style.css b/static/style.css index 5b276ab..5c44231 100755 --- a/static/style.css +++ b/static/style.css @@ -20,7 +20,7 @@ details { margin-bottom: 8px; } -details:last-child { +details:last-of-type { margin-bottom: 0; } @@ -228,7 +228,6 @@ summary { .board-links { padding: 2px; - border-bottom: 1px solid var(--box-border); } .link-separator::after { @@ -249,6 +248,11 @@ summary { clear: both; } +.footer { + text-align: center; + font-size: 8pt; +} + .post { margin-bottom: 8px; padding: 8px; @@ -420,7 +424,7 @@ summary { margin-bottom: 8px; } -.recent-posts { +.infobox-list { list-style-type: none; margin: 0; padding: 0; diff --git a/templates/base.html b/templates/base.html index ed59932..900ee83 100755 --- a/templates/base.html +++ b/templates/base.html @@ -29,6 +29,14 @@ {% endif %} -
{% block content %}{% endblock %}
+
+ {% block content %}{% endblock %} +
+ +
diff --git a/templates/edit-posts.html b/templates/edit-posts.html index ef95c7e..789e7a9 100644 --- a/templates/edit-posts.html +++ b/templates/edit-posts.html @@ -17,4 +17,4 @@ -{% endblock content %} +{% endblock %} diff --git a/templates/index.html b/templates/index.html index d355599..1dd435a 100755 --- a/templates/index.html +++ b/templates/index.html @@ -8,13 +8,27 @@

{{ tcx.cfg.site.name }}

{{ tcx.cfg.site.description }}

+ {% if !boards.is_empty() %} +
+
+ Nástěnky +
+
+ +
+
+ {% endif %} {% if !posts.is_empty() %}
Nejnovější příspěvky
-
    +
      {% for post in posts %}
    • /{{ post.board }}/: {{ post.content_nomarkup|inline_post }}
    • {% endfor %} diff --git a/templates/staff/account.html b/templates/staff/account.html index a81f9ad..2f91988 100755 --- a/templates/staff/account.html +++ b/templates/staff/account.html @@ -64,5 +64,4 @@ -
      {% endblock %} diff --git a/templates/staff/accounts.html b/templates/staff/accounts.html index aa178fe..074dcc7 100755 --- a/templates/staff/accounts.html +++ b/templates/staff/accounts.html @@ -34,8 +34,8 @@ {% endif %} -
      {% if tcx.perms.owner() %} +

      Vytvořit účet

      @@ -52,6 +52,5 @@
      -
      {% endif %} {% endblock %} diff --git a/templates/staff/banners.html b/templates/staff/banners.html index e2ac3ee..2c2a92d 100755 --- a/templates/staff/banners.html +++ b/templates/staff/banners.html @@ -42,5 +42,4 @@ -
      {% endblock %} diff --git a/templates/staff/bans.html b/templates/staff/bans.html index 2878e13..1daa012 100755 --- a/templates/staff/bans.html +++ b/templates/staff/bans.html @@ -41,5 +41,4 @@ -
      {% endblock %} diff --git a/templates/staff/board-config.html b/templates/staff/board-config.html index 8e6e76b..22b0e20 100755 --- a/templates/staff/board-config.html +++ b/templates/staff/board-config.html @@ -174,5 +174,4 @@ -
      {% endblock %} diff --git a/templates/staff/boards.html b/templates/staff/boards.html index 53be523..d6c355d 100755 --- a/templates/staff/boards.html +++ b/templates/staff/boards.html @@ -76,5 +76,4 @@ -
      {% endblock %} diff --git a/templates/staff/logs.html b/templates/staff/logs.html index 986a422..7d32781 100755 --- a/templates/staff/logs.html +++ b/templates/staff/logs.html @@ -26,5 +26,4 @@

{% call pagination::pagination("/staff/logs", pages, page) %} -
{% endblock %} diff --git a/templates/staff/permissions.html b/templates/staff/permissions.html index ff45d70..e8937a6 100755 --- a/templates/staff/permissions.html +++ b/templates/staff/permissions.html @@ -131,5 +131,4 @@ {% endif %} -
{% endblock %} diff --git a/templates/staff/reports.html b/templates/staff/reports.html index 37c63e6..fb4cab5 100755 --- a/templates/staff/reports.html +++ b/templates/staff/reports.html @@ -10,5 +10,4 @@ {% call staff_nav::staff_nav(tcx.perms) %}

Dočasně nedostupné

-
{% endblock %}