Skip to content

Commit

Permalink
[themes] remove redundant block headings
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Dec 14, 2024
1 parent e426904 commit 8c66949
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function add_block(Block $block): void
* Find a block which contains the given text
* (Useful for unit tests)
*/
public function find_block(string $text): Block
public function find_block(?string $text): Block
{
foreach ($this->blocks as $block) {
if ($block->header == $text) {
Expand Down
2 changes: 1 addition & 1 deletion ext/blocks/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ public function display_blocks(array $blocks): void

$page->set_title("Blocks");
$page->add_block(new NavBlock());
$page->add_block(new Block("Block Editor", $html));
$page->add_block(new Block(null, $html));
}
}
4 changes: 2 additions & 2 deletions ext/ext_manager/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function display_table(Page $page, array $extensions, bool $editable): vo

$page->set_title("Extensions");
$page->add_block(new Block("Navigation", \MicroHTML\joinHTML(BR(), $cat_html), "left", 0));
$page->add_block(new Block("Extension Manager", $form));
$page->add_block(new Block(null, $form));
}

public function display_doc(Page $page, ExtensionInfo $info): void
Expand Down Expand Up @@ -154,6 +154,6 @@ public function display_doc(Page $page, ExtensionInfo $info): void
$page->set_title("Documentation for {$info->name}");
$page->set_heading($info->name);
$page->add_block(new NavBlock());
$page->add_block(new Block("Documentation", $html));
$page->add_block(new Block(null, $html));
}
}
4 changes: 2 additions & 2 deletions ext/ipban/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testIPBan(): void
$page = $this->get_page('ip_ban/list');
$this->assertStringContainsString(
"42.42.42.42",
(string)$page->find_block("Edit IP Bans")->body
(string)$page->find_block(null)->body
);

// Delete ban
Expand All @@ -48,7 +48,7 @@ public function testIPBan(): void
$page = $this->get_page('ip_ban/list');
$this->assertStringNotContainsString(
"42.42.42.42",
(string)$page->find_block("Edit IP Bans")->body
(string)$page->find_block(null)->body
);
}

Expand Down
6 changes: 3 additions & 3 deletions ext/ipban/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public function display_bans(Page $page, HTMLElement $table, HTMLElement $pagina
$html = "
<a href='".make_link("ip_ban/list", "r__size=1000000")."'>Show All Active</a> /
<a href='".make_link("ip_ban/list", "r_all=on&r__size=1000000")."'>Show EVERYTHING</a>
$table
$paginator
";
$page->set_title("IP Bans");
$page->add_block(new NavBlock());
$page->add_block(new Block("Edit IP Bans", rawHTML($html)));
$page->add_block(new Block(null, rawHTML($html)));
}
}

0 comments on commit 8c66949

Please sign in to comment.