summaryrefslogtreecommitdiff
path: root/lib/VNWeb/TT/TagPage.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-05-21 13:07:06 +0200
committerYorhel <git@yorhel.nl>2021-05-21 13:07:08 +0200
commit09062eaba0297123eaf298827c803db5a5fe0e2e (patch)
treec19d133b0f05f80ca586f4196e4e8153fd2bb195 /lib/VNWeb/TT/TagPage.pm
parent892af2bbbc9c7b6675708bf01f0ebd304014fa0f (diff)
Tags/Traits: Add main/primary flag to parents list
This way there is always a single canonical path for each tag/trait, which fixes the problem with traits that could belong to multiple groups yet you couldn't control which one was selected, and this also removes duplication in the VN->tags tab, which now doesn't have to non-canonical tag paths.
Diffstat (limited to 'lib/VNWeb/TT/TagPage.pm')
-rw-r--r--lib/VNWeb/TT/TagPage.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/VNWeb/TT/TagPage.pm b/lib/VNWeb/TT/TagPage.pm
index 819a6bd1..e7b63f31 100644
--- a/lib/VNWeb/TT/TagPage.pm
+++ b/lib/VNWeb/TT/TagPage.pm
@@ -11,6 +11,7 @@ sub rev_ {
my($t) = @_;
sub enrich_item {
enrich_merge parent => 'SELECT id AS parent, name FROM tags WHERE id IN', $_[0]{parents};
+ $_[0]{parents} = [ sort { $a->{name} cmp $b->{name} || $a->{parent} <=> $b->{parent} } $_[0]{parents}->@* ];
}
enrich_item $t;
revision_ $t, \&enrich_item,
@@ -21,7 +22,7 @@ sub rev_ {
[ searchable => 'Searchable', fmt => 'bool' ],
[ applicable => 'Applicable', fmt => 'bool' ],
[ defaultspoil => 'Default spoiler level' ],
- [ parents => 'Parent tags', fmt => sub { a_ href => "/$_->{parent}", $_->{name}; } ];
+ [ parents => 'Parent tags', fmt => sub { a_ href => "/$_->{parent}", $_->{name}; txt_ ' (primary)' if $_->{main} } ];
}