Skip to content

Commit 1490aa1

Browse files
authored
Merge pull request #71 from perl6/tag-fixes
Tag fixes
2 parents 68f0ff3 + 8807d51 commit 1490aa1

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

assets/js/main.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ $(function(){
99

1010
function setup_tags() {
1111
var limit_count = 3, added_weak_tag_expander = 0;
12-
$('#tags').html(
13-
$('#tags li').sort(function(el){
14-
return $(el).find('small').text() < limit_count ? 1 : 0;
15-
}).sort(function(el){
16-
// our < limit_count tags are in reverse-alphabetic order now
17-
// sort them again to reverse the order
18-
return $(el).find('small').text() < limit_count ? 1 : 0;
19-
})
20-
);
21-
2212
$('#tags li').each(function (i, el) {
2313
if($(el).find('small').text() < limit_count) {
2414
if ( ! added_weak_tag_expander ) {

lib/ModulesPerl6/Controller/Root.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ sub index {
3939
@$dists = grep { grep $_ eq $active_tag, @{ $_->{tags} } } @$dists;
4040
}
4141

42+
my @tags = map +{ tag => $_, count => $tags{$_} }, sort keys %tags;
4243
my %data = (
4344
tags => [
44-
map +{ tag => $_, count => $tags{$_} }, sort keys %tags
45+
( grep { $_->{count} >= 3 } @tags ),
46+
( grep { $_->{count} < 3 } @tags )
4547
],
4648
dists => $dists,
4749
more => $self->url_for('current')->to_abs,

lib/ModulesPerl6/DbBuilder/Dist/Source.pm

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use File::Spec::Functions qw/catfile/;
55
use JSON::Meth qw/$json/;
66
use Mojo::JSON qw/from_json/;
77
use Mojo::UserAgent;
8-
use Mojo::Util qw/slurp spurt decode/;
8+
use Mojo::Util qw/slurp spurt decode trim/;
99
use Try::Tiny;
1010

1111
use ModulesPerl6::DbBuilder::Log;
@@ -85,9 +85,12 @@ sub _parse_meta {
8585
} map {
8686
$tags->{$_} || $_ # perform substitution to common form
8787
} grep {
88-
length and not ref and not $no_index->{$_}
89-
} map uc, @{ $json->{tags} };
90-
log warn => "`$json->{name}` does not have any tags";
88+
length and not $no_index->{$_}
89+
} map { trim uc } grep { not ref } @{ $json->{tags} };
90+
91+
log warn => "`$json->{name}` does not have any tags"
92+
unless @{ $json->{tags} };
93+
9194
return $self->_fill_missing( {%$json} );
9295
}
9396

0 commit comments

Comments
 (0)