tabulka na novinky or samfink
Tento commit je obsažen v:
rodič
4faa8e94cd
revize
6f4403e376
@ -1,6 +1,6 @@
|
||||
use chrono::{DateTime, Locale, Utc};
|
||||
use regex::{Captures, Regex};
|
||||
use lazy_static::lazy_static;
|
||||
use regex::{Captures, Regex};
|
||||
use std::{collections::HashSet, fmt::Display};
|
||||
|
||||
use crate::markup::SPOILER_REGEX;
|
||||
|
@ -2,38 +2,21 @@ use actix_web::{get, web::Data, HttpRequest, HttpResponse};
|
||||
use askama::Template;
|
||||
|
||||
use super::tcx::TemplateCtx;
|
||||
use crate::{
|
||||
ctx::Ctx,
|
||||
db::models::{Board, Post},
|
||||
error::NekrochanError,
|
||||
filters,
|
||||
web::template_response,
|
||||
};
|
||||
use crate::{ctx::Ctx, db::models::NewsPost, error::NekrochanError, web::template_response};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "index.html")]
|
||||
|
||||
struct IndexTemplate {
|
||||
tcx: TemplateCtx,
|
||||
boards: Vec<Board>,
|
||||
posts: Vec<Post>,
|
||||
files: Vec<Post>,
|
||||
_news: Vec<NewsPost>,
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
pub async fn index(ctx: Data<Ctx>, req: HttpRequest) -> Result<HttpResponse, NekrochanError> {
|
||||
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,
|
||||
boards,
|
||||
posts,
|
||||
files,
|
||||
};
|
||||
let _news = NewsPost::read_all(&ctx).await?;
|
||||
let template = IndexTemplate { tcx, _news };
|
||||
|
||||
template_response(&template)
|
||||
}
|
||||
|
binární
static/favicon.ico
Spustitelný soubor → Normální soubor
binární
static/favicon.ico
Spustitelný soubor → Normální soubor
Binární soubor nebyl zobrazen.
Před Šířka: | Výška: | Velikost: 15 KiB Za Šířka: | Výška: | Velikost: 4.2 KiB |
binární
static/icons/download.png
binární
static/icons/download.png
Binární soubor nebyl zobrazen.
Před Šířka: | Výška: | Velikost: 1.1 KiB |
@ -207,10 +207,14 @@ summary {
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: 8pt;
|
||||
font-size: 0.8rem;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.big {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
@ -228,6 +232,7 @@ summary {
|
||||
}
|
||||
|
||||
.board-links {
|
||||
color: var(--board-links-color);
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
@ -412,8 +417,7 @@ summary {
|
||||
|
||||
.icon {
|
||||
height: 1em;
|
||||
vertical-align: middle;
|
||||
image-rendering: pixelated;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
.posts-omitted {
|
||||
|
@ -1,6 +1,6 @@
|
||||
:root {
|
||||
/* General */
|
||||
--bg: linear-gradient(#d6daf0 3rem, #eef2ff 230px);
|
||||
--bg: linear-gradient(#d1d5ee 3rem, #eef2ff 230px);
|
||||
--text: #000000;
|
||||
--font: Arial, Helvetica, sans-serif;
|
||||
/* Text */
|
||||
@ -8,6 +8,7 @@
|
||||
--link-hover: #dd0000;
|
||||
--post-link-color: #34345c;
|
||||
--post-link-hover: #dd0000;
|
||||
--board-links-color: #8899aa;
|
||||
--title-color: #af0a0f;
|
||||
--title-font: tahoma;
|
||||
--hr-color: #d3d3d3;
|
||||
|
@ -1,6 +1,6 @@
|
||||
:root {
|
||||
/* General */
|
||||
--bg: linear-gradient(#fed6af90 3rem, #ffe 230px);
|
||||
--bg: linear-gradient(#fed6af 3rem, #ffffee 230px);
|
||||
--text: #800000;
|
||||
--font: Arial, Helvetica, sans-serif;
|
||||
/* Text */
|
||||
@ -8,6 +8,7 @@
|
||||
--link-hover: #dd0000;
|
||||
--post-link-color: #000080;
|
||||
--post-link-hover: #dd0000;
|
||||
--board-links-color: #bb8866;
|
||||
--title-color: #af0a0f;
|
||||
--title-font: tahoma;
|
||||
--hr-color: #d9bfb7;
|
||||
|
@ -1,3 +1,5 @@
|
||||
{% import "./macros/board-links.html" as board_links %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="cs">
|
||||
<head>
|
||||
@ -13,12 +15,7 @@
|
||||
<body>
|
||||
<div class="board-links">
|
||||
<span class="link-group"><a href="/">domov</a></span>
|
||||
<span class="link-group">
|
||||
{% for board_link in tcx.boards %}
|
||||
<a href="/boards/{{ board_link }}">{{ board_link }}</a>
|
||||
{% if !loop.last %}<span class="link-separator"></span>{% endif %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% call board_links::board_links() %}
|
||||
<span class="link-group"><a href="/overboard">nadnástěnka</a></span>
|
||||
<span style="float: right;">
|
||||
{% if tcx.logged_in %}
|
||||
|
@ -22,6 +22,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
<hr>
|
||||
{% call post_actions::post_actions(tcx.perms) %}
|
||||
{% call post_actions::post_actions() %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<p class="description">{{ board.description }}</p>
|
||||
<a href="/boards/{{ board.id }}/catalog">Katalog</a>
|
||||
</div>
|
||||
{% call post_form::post_form(board, tcx.perms, false, 0) %}
|
||||
{% call post_form::post_form(board, false, 0) %}
|
||||
</div>
|
||||
<hr>
|
||||
<form method="post">
|
||||
|
@ -1,52 +1,12 @@
|
||||
{% import "./macros/board-links.html" as board_links %}
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ tcx.cfg.site.name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="center">
|
||||
<div class="center">
|
||||
<h1 class="title">{{ tcx.cfg.site.name }}</h1>
|
||||
<p class="description">{{ tcx.cfg.site.description }}</p>
|
||||
</div>
|
||||
{% if !boards.is_empty() %}
|
||||
<div class="infobox">
|
||||
<div class="infobox-head">Nástěnky</div>
|
||||
<div class="infobox-content">
|
||||
<ul class="infobox-list">
|
||||
{% for board in boards %}
|
||||
<li><a href="/boards/{{ board.id }}">/{{ board.id }}/ - {{ board.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if !posts.is_empty() %}
|
||||
<div class="infobox">
|
||||
<div class="infobox-head">Nejnovější příspěvky</div>
|
||||
<div class="infobox-content">
|
||||
<ul class="infobox-list">
|
||||
{% for post in posts %}
|
||||
<li><b>/{{ post.board }}/</b>: <a href="{{ post.post_url() }}">{{ post.content_nomarkup|inline_post }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if !files.is_empty() %}
|
||||
<div class="infobox">
|
||||
<div class="infobox-head">Nejnovější soubory</div>
|
||||
<div class="infobox-content">
|
||||
<div class="post-files multi-files">
|
||||
{% for post in files %}
|
||||
<div class="post-file">
|
||||
<a href="{{ post.post_url() }}">
|
||||
<img class="thumb" src="{{ post.files.0[0].thumb_url() }}">
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
8
templates/macros/board-links.html
Normální soubor
8
templates/macros/board-links.html
Normální soubor
@ -0,0 +1,8 @@
|
||||
{% macro board_links() %}
|
||||
<span class="link-group">
|
||||
{% for board_link in tcx.boards %}
|
||||
<a href="/boards/{{ board_link }}">{{ board_link }}</a>
|
||||
{% if !loop.last %}<span class="link-separator"></span>{% endif %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endmacro %}
|
@ -1,4 +1,4 @@
|
||||
{% macro post_actions(perms) %}
|
||||
{% macro post_actions() %}
|
||||
<details>
|
||||
<summary class="box">Uživatelské akce</summary>
|
||||
<table class="form-table">
|
||||
@ -68,11 +68,11 @@
|
||||
</table>
|
||||
</details>
|
||||
<br>
|
||||
{% if perms.owner() || perms.manage_posts() || perms.bans() || perms.edit_posts() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.manage_posts() || tcx.perms.bans() || tcx.perms.edit_posts() %}
|
||||
<details>
|
||||
<summary class="box">Uklízečské akce</summary>
|
||||
<table class="form-table">
|
||||
{% if perms.owner() || perms.manage_posts() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.manage_posts() %}
|
||||
<tr>
|
||||
<td class="label">Odstranit příspěvky</td>
|
||||
<td>
|
||||
@ -114,7 +114,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if perms.owner() || perms.bans() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.bans() %}
|
||||
<tr>
|
||||
<td class="label">Zabanovat uživatele</td>
|
||||
<td>
|
||||
@ -169,7 +169,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% if perms.owner() || perms.edit_posts() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.edit_posts() %}
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<td class="submit">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% macro post_form(board, perms, reply, reply_to) %}
|
||||
{% macro post_form(board, reply, reply_to) %}
|
||||
<form method="post" enctype="multipart/form-data" action="/actions/create-post">
|
||||
<input name="board" type="hidden" value="{{ board.id }}">
|
||||
{% if reply %}
|
||||
@ -50,7 +50,7 @@
|
||||
<input name="password" type="text" autocomplete="new-password" value="{{ tcx.password }}" required="">
|
||||
</td>
|
||||
</tr>
|
||||
{% if !(perms.bypass_captcha() || perms.owner()) %}
|
||||
{% if !(tcx.perms.bypass_captcha() || tcx.perms.owner()) %}
|
||||
{% if reply %}
|
||||
{% if let Some((id, base64)) = board.reply_captcha() %}
|
||||
<tr>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<span class="tripcode">{{ tripcode }}</span> 
|
||||
{% endif %}
|
||||
{% if let Some(capcode) = post.capcode %}
|
||||
<span class="capcode">## {{ capcode }}</span> 
|
||||
<span class="capcode">## {{ capcode }} <img class="icon" src="/favicon.ico"></span> 
|
||||
{% endif %}
|
||||
{% if tcx.ip == post.ip %}
|
||||
{# Technically not a tripcode or something but same styling #}
|
||||
@ -41,8 +41,11 @@
|
||||
{% for file in post.files.0 %}
|
||||
<div class="post-file">
|
||||
<a download="{{ file.original_name }}" href="{{ file.file_url() }}">
|
||||
{% if file.spoiler %}<i>[Spoiler]</i>{% else %}{{ file.original_name }}{% endif %} 
|
||||
<img class="icon" src="/static/icons/download.png">
|
||||
{% if file.spoiler %}
|
||||
[Spoiler]
|
||||
{% else %}
|
||||
{{ file.original_name }}
|
||||
{% endif %}
|
||||
</a>
|
||||
<br>
|
||||
({{ file.size|filesizeformat }}, {{ file.width }}x{{ file.height }})
|
||||
|
@ -1,21 +1,21 @@
|
||||
{% macro staff_nav(perms) %}
|
||||
{% macro staff_nav() %}
|
||||
<div class="box inline-block pagination">
|
||||
<a href="/staff/account">[Účet]</a> 
|
||||
<a href="/staff/accounts">[Účty]</a> 
|
||||
|
||||
{% if perms.owner() || perms.board_config() || perms.banners() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.board_config() || tcx.perms.banners() %}
|
||||
<a href="/staff/boards">[Nástěnky]</a> 
|
||||
{% endif %}
|
||||
|
||||
{% if perms.owner() || perms.bans() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.bans() %}
|
||||
<a href="/staff/bans">[Bany]</a> 
|
||||
{% endif %}
|
||||
|
||||
{% if perms.owner() || perms.banners() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.banners() %}
|
||||
<a href="/staff/banners">[Bannery]</a> 
|
||||
{% endif %}
|
||||
|
||||
{% if perms.owner() || perms.reports() %}
|
||||
{% if tcx.perms.owner() || tcx.perms.reports() %}
|
||||
<a href="/staff/reports">[Hlášení]</a> 
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -22,6 +22,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
<hr>
|
||||
{% call post_actions::post_actions(tcx.perms) %}
|
||||
{% call post_actions::post_actions() %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -42,6 +42,6 @@
|
||||
{% endfor %}
|
||||
{% call pagination::pagination("/overboard", pages, page) %}
|
||||
<hr>
|
||||
{% call post_actions::post_actions(tcx.perms) %}
|
||||
{% call post_actions::post_actions() %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Účet ({{ account.username }})</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<h2>Změnit heslo</h2>
|
||||
<form method="post" action="/staff/actions/change-password">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Účty</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<h2>Účty</h2>
|
||||
<form method="post" action="/staff/actions/remove-accounts">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Bannery</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<h2>Bannery</h2>
|
||||
<form method="post" action="/staff/actions/remove-banners">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Bany</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<h2>Bany</h2>
|
||||
<form method="post" action="/staff/actions/remove-bans">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Nastavení (/{{ board.id }}/)</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<form method="post" action="/staff/actions/update-board-config">
|
||||
<input name="board" type="hidden" value="{{ board.id }}">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Nástěnky</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<h2>Nástěnky</h2>
|
||||
<form method="post">
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Záznamy</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<h2>Záznamy</h2>
|
||||
<div class="table-wrap">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Oprávnění ({{ account.username }})</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
{% if account.perms().owner() %}
|
||||
<h2 class="title">Tento uživatel je vlastník, změny nebudou mít žádný vliv.</h2>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Hlášení</h1>
|
||||
{% call staff_nav::staff_nav(tcx.perms) %}
|
||||
{% call staff_nav::staff_nav() %}
|
||||
<hr>
|
||||
<h1>Dočasně nedostupné</h1>
|
||||
{% endblock %}
|
||||
|
@ -14,7 +14,7 @@
|
||||
<p class="description">{{ board.description }}</p>
|
||||
<a href="/boards/{{ board.id }}/catalog">Katalog</a>
|
||||
</div>
|
||||
{% call post_form::post_form(board, tcx.perms, true, thread.id) %}
|
||||
{% call post_form::post_form(board, true, thread.id) %}
|
||||
</div>
|
||||
<hr>
|
||||
<form method="post">
|
||||
@ -26,6 +26,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
<hr>
|
||||
{% call post_actions::post_actions(tcx.perms) %}
|
||||
{% call post_actions::post_actions() %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
Načítá se…
Odkázat v novém úkolu
Zablokovat Uživatele