File tree Expand file tree Collapse file tree 3 files changed +10
-15
lines changed Expand file tree Collapse file tree 3 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,6 @@ $(function(){
9
9
10
10
function setup_tags ( ) {
11
11
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
-
22
12
$ ( '#tags li' ) . each ( function ( i , el ) {
23
13
if ( $ ( el ) . find ( 'small' ) . text ( ) < limit_count ) {
24
14
if ( ! added_weak_tag_expander ) {
Original file line number Diff line number Diff line change @@ -39,9 +39,11 @@ sub index {
39
39
@$dists = grep { grep $_ eq $active_tag , @{ $_ -> {tags } } } @$dists ;
40
40
}
41
41
42
+ my @tags = map +{ tag => $_ , count => $tags {$_ } }, sort keys %tags ;
42
43
my %data = (
43
44
tags => [
44
- map +{ tag => $_ , count => $tags {$_ } }, sort keys %tags
45
+ ( grep { $_ -> {count } >= 3 } @tags ),
46
+ ( grep { $_ -> {count } < 3 } @tags )
45
47
],
46
48
dists => $dists ,
47
49
more => $self -> url_for(' current' )-> to_abs,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use File::Spec::Functions qw/catfile/;
5
5
use JSON::Meth qw/ $json/ ;
6
6
use Mojo::JSON qw/ from_json/ ;
7
7
use Mojo::UserAgent;
8
- use Mojo::Util qw/ slurp spurt decode/ ;
8
+ use Mojo::Util qw/ slurp spurt decode trim / ;
9
9
use Try::Tiny;
10
10
11
11
use ModulesPerl6::DbBuilder::Log;
@@ -85,9 +85,12 @@ sub _parse_meta {
85
85
} map {
86
86
$tags -> {$_ } || $_ # perform substitution to common form
87
87
} 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
+
91
94
return $self -> _fill_missing( {%$json } );
92
95
}
93
96
You can’t perform that action at this time.
0 commit comments