Merge pull request 'Add the About theme' (#141) from about-theme into config

Reviewed-on: #141
This commit is contained in:
Zankaria 2024-05-21 14:46:51 +00:00
commit 0d38349a10
5 changed files with 108 additions and 1 deletions

View File

@ -1205,6 +1205,14 @@ span.pln {
min-width: 48px;
}
/* The center tag has been deprecated in HTML 5 */
.center {
display: block;
margin-left: auto;
margin-right: auto;
text-align: center;
}
/* Text and accessibility */
.ltr {
direction: ltr;
@ -1980,4 +1988,3 @@ span.orangeQuote {
float: right;
margin: 0em 1em;
}

View File

@ -0,0 +1,32 @@
{% filter remove_whitespace %}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
<title>{{ theme_config.title }}</title>
{% include 'header.html' %}
</head>
<body class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">
<div id="top-hud" class="bar top">
{{ board_list.top }}
</div>
<header>
<h1 data-text="{{ theme_config.title }}"> {{ theme_config.title }}</h1>
</header>
<img class="center" img alt="logo" src="{{ config.logo }}" width=15%/>
<div class="center ban">{{ theme_config.description }}</div>
<hr/>
<footer>
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="https://github.com/savetheinternet/Tinyboard">Tinyboard</a> +
<a href='https://github.com/vichan-devel/vichan'>vichan</a> +
<br><a href="https://github.com/savetheinternet/Tinyboard">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
<br><a href="https://github.com/vichan-devel/vichan">vichan</a> Copyright &copy; 2012-2016 vichan-devel
</footer>
<div id="bottom-hud" class="bar bottom">
<div class="pages"></div>
</div>
</body>
</html>
{% endfilter %}

View File

@ -0,0 +1,31 @@
<?php
$theme = [
// Theme name.
'name' => 'About',
// Description (you can use Tinyboard markup here).
'description' => 'Extremely basic about page. Enabling board links is recommended for this theme.',
'version' => 'v0.0.1',
// Theme configuration.
'config' => [
[
'title' => 'Site title',
'name' => 'title',
'type' => 'text',
'default' => 'Title goes here'
],
[
'title' => 'Text',
'name' => 'description',
'type' => 'text',
'default' => 'Text goes here'
],
[
'title' => 'File path',
'name' => 'path',
'type' => 'text',
'default' => 'about.html',
'comment' => '(eg. "about.html")'
]
],
'build_function' => 'about_build'
];

View File

@ -0,0 +1,37 @@
<?php
require_once 'info.php';
function about_build(string $action, array $theme_config, $board): void {
$obj = new AboutTheme($theme_config);
$obj->build($action);
}
class AboutTheme {
private $theme_config;
private function render(): string {
global $config;
return Element('themes/about/about.html', [
'theme_config' => $this->theme_config,
'config' => $config,
'board_list' => createBoardlist(),
]);
}
public function __construct(array $theme_config) {
$this->theme_config = $theme_config;
}
public function build(string $action): void {
global $config;
if ($action == 'all') {
$about_page = $this->render();
$home = $config['dir']['home'];
$path = $this->theme_config['path'];
file_write($home . $path, $about_page);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB