summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/Chars.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-04-06 14:12:19 +0200
committerYorhel <git@yorhel.nl>2011-04-06 14:12:19 +0200
commit13bab98d3b202e1b17b845524b0893f7c2c4b91d (patch)
tree18aa4dcea5aa168f3754c7d0cb3f0314fb8eb693 /lib/VNDB/Handler/Chars.pm
parent446112f425251cd319df7c46771dc077a5385022 (diff)
Bugfix: Hide pointless groups and commas on spoiler-hidden trait display
Diffstat (limited to 'lib/VNDB/Handler/Chars.pm')
-rw-r--r--lib/VNDB/Handler/Chars.pm18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm
index 06c2ecde..7968b66c 100644
--- a/lib/VNDB/Handler/Chars.pm
+++ b/lib/VNDB/Handler/Chars.pm
@@ -163,13 +163,21 @@ sub charTable {
push @{$groups{ $g }}, $_
}
for my $g (@groups) {
- Tr ++$i % 2 ? (class => 'odd') : ();
+ my $minspoil = 5;
+ $minspoil = $minspoil > $_->{spoil} ? $_->{spoil} : $minspoil for(@{$groups{$g}});
+ Tr class => charspoil($minspoil).(++$i % 2 ? ' odd' : '');
td class => 'key'; a href => '/i'.($groups{$g}[0]{group}||$groups{$g}[0]{tid}), $groups{$g}[0]{groupname} || $groups{$g}[0]{name}; end;
td;
- for (@{$groups{$g}}) {
- span class => charspoil $_->{spoil};
- txt ', ' if $_->{tid} != $groups{$g}[0]{tid};
- a href => "/i$_->{tid}", $_->{name};
+ for (0..$#{$groups{$g}}) {
+ my $t = $groups{$g}[$_];
+ span class => charspoil $t->{spoil};
+ a href => "/i$t->{tid}", $t->{name};
+ # spoiler setting of the comma = max(current, min(@remaining_spoil))
+ # since it is in the current <span>, which has 'current', only the second part is relevant if it is > current
+ my $min_remaining = 5;
+ $min_remaining = $min_remaining > $groups{$g}[$_]{spoil} ? $groups{$g}[$_]{spoil} : $min_remaining for($_+1..$#{$groups{$g}});
+ span class => charspoil($min_remaining), ', ' if $min_remaining != 5 && $min_remaining > $t->{spoil};
+ txt ', ' if $min_remaining != 5 && $min_remaining <= $t->{spoil};
end;
}
end;