Skip to content

Commit

Permalink
Merge pull request #71 from perl6/tag-fixes
Browse files Browse the repository at this point in the history
Tag fixes
  • Loading branch information
zoffixznet committed Mar 11, 2017
2 parents 68f0ff3 + 8807d51 commit 1490aa1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
10 changes: 0 additions & 10 deletions assets/js/main.js
Expand Up @@ -9,16 +9,6 @@ $(function(){

function setup_tags() {
var limit_count = 3, added_weak_tag_expander = 0;
$('#tags').html(
$('#tags li').sort(function(el){
return $(el).find('small').text() < limit_count ? 1 : 0;
}).sort(function(el){
// our < limit_count tags are in reverse-alphabetic order now
// sort them again to reverse the order
return $(el).find('small').text() < limit_count ? 1 : 0;
})
);

$('#tags li').each(function (i, el) {
if($(el).find('small').text() < limit_count) {
if ( ! added_weak_tag_expander ) {
Expand Down
4 changes: 3 additions & 1 deletion lib/ModulesPerl6/Controller/Root.pm
Expand Up @@ -39,9 +39,11 @@ sub index {
@$dists = grep { grep $_ eq $active_tag, @{ $_->{tags} } } @$dists;
}

my @tags = map +{ tag => $_, count => $tags{$_} }, sort keys %tags;
my %data = (
tags => [
map +{ tag => $_, count => $tags{$_} }, sort keys %tags
( grep { $_->{count} >= 3 } @tags ),
( grep { $_->{count} < 3 } @tags )
],
dists => $dists,
more => $self->url_for('current')->to_abs,
Expand Down
11 changes: 7 additions & 4 deletions lib/ModulesPerl6/DbBuilder/Dist/Source.pm
Expand Up @@ -5,7 +5,7 @@ use File::Spec::Functions qw/catfile/;
use JSON::Meth qw/$json/;
use Mojo::JSON qw/from_json/;
use Mojo::UserAgent;
use Mojo::Util qw/slurp spurt decode/;
use Mojo::Util qw/slurp spurt decode trim/;
use Try::Tiny;

use ModulesPerl6::DbBuilder::Log;
Expand Down Expand Up @@ -85,9 +85,12 @@ sub _parse_meta {
} map {
$tags->{$_} || $_ # perform substitution to common form
} grep {
length and not ref and not $no_index->{$_}
} map uc, @{ $json->{tags} };
log warn => "`$json->{name}` does not have any tags";
length and not $no_index->{$_}
} map { trim uc } grep { not ref } @{ $json->{tags} };

log warn => "`$json->{name}` does not have any tags"
unless @{ $json->{tags} };

return $self->_fill_missing( {%$json} );
}

Expand Down

0 comments on commit 1490aa1

Please sign in to comment.