theme notes

This commit is contained in:
Shish 2023-12-26 22:53:09 +00:00
parent f506ab8b13
commit f902fba814
5 changed files with 16 additions and 0 deletions

View file

@ -6,6 +6,7 @@ namespace Shimmie2;
class CustomHomeTheme extends HomeTheme
{
// Override to add ads
public function build_body(string $sitename, string $main_links, string $main_text, string $contact_link, $num_comma, string $counter_text): string
{
$main_links_html = empty($main_links) ? "" : "<div class='space' id='links'>$main_links</div>";

View file

@ -8,6 +8,8 @@ class CustomIndexTheme extends IndexTheme
{
public static array $_search_query = [];
// override to add the can-del class, so that thumbnail HTML can be cached
// with admin-controls included, and CSS is used to show or hide the controls
protected function build_table(array $images, ?string $query): string
{
global $user;
@ -23,6 +25,7 @@ class CustomIndexTheme extends IndexTheme
return $table;
}
// Override to add a custom error message
public function display_page(Page $page, $images)
{
$this->display_page_header($page, $images);

View file

@ -21,17 +21,21 @@ use function MicroHTML\P;
class CustomUploadTheme extends UploadTheme
{
// override to put upload block in head and left
// (with css media queries deciding which one is visible)
public function display_block(Page $page): void
{
$page->add_block(new Block("Upload", $this->build_upload_block(), "head", 20));
$page->add_block(new Block("Upload", $this->build_upload_block(), "left", 20));
}
// override to put the warning in the header
public function display_full(Page $page): void
{
$page->add_block(new Block("Upload", "Disk nearly full, uploads disabled", "head", 20));
}
// override to add link to tagging guide
public function display_page(Page $page): void
{
global $config, $page;
@ -77,6 +81,8 @@ class CustomUploadTheme extends UploadTheme
$page->add_block(new Block(null, $html, "main", 19));
}
// override to remove small uploader and just show a link to
// the big page
protected function build_upload_block(): HTMLElement
{
return A(["href" => make_link("upload"), "style" => 'font-size: 2rem; display: block;'], "Upload");

View file

@ -23,6 +23,8 @@ use function MicroHTML\OPTION;
class CustomUserPageTheme extends UserPageTheme
{
// Override to display user block in the head and in the left column
// (with css media queries deciding which one is visible)
public function display_user_block(Page $page, User $user, $parts)
{
$h_name = html_escape($user->name);
@ -42,6 +44,8 @@ class CustomUserPageTheme extends UserPageTheme
$page->add_block(new Block("Logged in as $h_name", $html, "left", 15, "UserBlockleft"));
}
// Override to display login block in the head and in the left column
// (with css media queries deciding which one is visible)
public function display_login_block(Page $page)
{
global $config;
@ -112,6 +116,7 @@ class CustomUserPageTheme extends UserPageTheme
$page->add_block(new Block("Signup", $html));
}
// override to make email required
public function display_user_creator()
{
global $page;

View file

@ -10,6 +10,7 @@ use function MicroHTML\{TR, TH, TD, emptyHTML, rawHTML, joinHTML, DIV, INPUT, A}
class CustomViewImageTheme extends ViewImageTheme
{
// override to make info box always in edit mode
protected function build_info(Image $image, $editor_parts): string
{
global $user;