Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Giraffaman committed Mar 14, 2024
2 parents 14745d1 + cc8e4ff commit c4c45e2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
3 changes: 3 additions & 0 deletions ext/tag_categories/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public function show_tag_categories(Page $page, array $tc_dict): void
';

// add html to stuffs
$page->set_title("Tag Categories");
$page->set_heading("Tag Categories");
$page->add_block(new NavBlock());
$page->add_block(new Block("Editing", $html, "main", 10));
}

Expand Down
39 changes: 19 additions & 20 deletions ext/tag_list/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,26 @@ public function onPageRequest(PageRequestEvent $event): void
$tags_min = $config->get_int(TagListConfig::TAGS_MIN); // get the default.
}

if($user->is_logged_in()) {
switch ($sub) {
default:
case 'map':
$this->theme->set_heading("Tag Map");
$this->theme->set_tag_list($this->build_tag_map($starts_with, $tags_min));
break;
case 'alphabetic':
$this->theme->set_heading("Alphabetic Tag List");
$this->theme->set_tag_list($this->build_tag_alphabetic($starts_with, $tags_min));
break;
case 'popularity':
$this->theme->set_heading("Tag List by Popularity");
$this->theme->set_tag_list($this->build_tag_popularity($tags_min));
break;
}
} else {
$errMessage = "You must be registered and logged in to use tags.";
$this->theme->display_error(401, "Unauthorized", $errMessage);
switch ($sub) {
case 'map':
$this->theme->set_heading("Tag Map");
$this->theme->set_tag_list($this->build_tag_map($starts_with, $tags_min));
$this->theme->display_page($page);
break;
case 'alphabetic':
$this->theme->set_heading("Alphabetic Tag List");
$this->theme->set_tag_list($this->build_tag_alphabetic($starts_with, $tags_min));
$this->theme->display_page($page);
break;
case 'popularity':
$this->theme->set_heading("Tag List by Popularity");
$this->theme->set_tag_list($this->build_tag_popularity($tags_min));
$this->theme->display_page($page);
break;
default:
// don't display anything
break;
}
$this->theme->display_page($page);
} elseif ($event->page_matches("tags")) {
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("tags/map"));
Expand Down
5 changes: 1 addition & 4 deletions ext/tag_list/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class TagListTest extends ShimmiePHPUnitTestCase
{
/** @var string[] */
private array $pages = ["map", "alphabetic", "popularity", "categories"];
private array $pages = ["map", "alphabetic", "popularity"];

public function testTagList(): void
{
Expand All @@ -20,9 +20,6 @@ public function testTagList(): void
$this->get_page('tags/popularity');
$this->assert_title('Tag List');

$this->get_page('tags/categories');
$this->assert_title('Tag List');

# FIXME: test that these show the right stuff
}

Expand Down

0 comments on commit c4c45e2

Please sign in to comment.