all: prefer postfix dereference syntax
This commit is contained in:
parent
56ee34eb7c
commit
396ab297a8
@ -27,7 +27,7 @@ sub list ($self)
|
|||||||
media_src => $self->seaweed->url_for(
|
media_src => $self->seaweed->url_for(
|
||||||
SeaweedFS::FID->from_string($_->{seaweedfs_fid})
|
SeaweedFS::FID->from_string($_->{seaweedfs_fid})
|
||||||
),
|
),
|
||||||
}, @{$res->json->{media}};
|
}, $res->json->{media}->@*;
|
||||||
|
|
||||||
return $self->render(
|
return $self->render(
|
||||||
template => "gallery",
|
template => "gallery",
|
||||||
|
@ -24,7 +24,7 @@ sub list ($self)
|
|||||||
name => $_->{name},
|
name => $_->{name},
|
||||||
count => $_->{count},
|
count => $_->{count},
|
||||||
uri => $self->url_for("tag_show", tag_id_or_name => $_->{name}),
|
uri => $self->url_for("tag_show", tag_id_or_name => $_->{name}),
|
||||||
}, @{$res->json->{tags}};
|
}, $res->json->{tags}->@*;
|
||||||
|
|
||||||
return $self->render(
|
return $self->render(
|
||||||
template => "tags",
|
template => "tags",
|
||||||
@ -54,7 +54,7 @@ sub show ($self)
|
|||||||
media_src => $self->seaweed->url_for(
|
media_src => $self->seaweed->url_for(
|
||||||
SeaweedFS::FID->from_string($_->{seaweedfs_fid})
|
SeaweedFS::FID->from_string($_->{seaweedfs_fid})
|
||||||
),
|
),
|
||||||
}, @{$res->json->{media}};
|
}, $res->json->{media}->@*;
|
||||||
|
|
||||||
return $self->render(
|
return $self->render(
|
||||||
template => "gallery",
|
template => "gallery",
|
||||||
|
@ -34,17 +34,17 @@ sub url_for
|
|||||||
|
|
||||||
my $vid = $fid->volume_id;
|
my $vid = $fid->volume_id;
|
||||||
|
|
||||||
if (!defined($self->{_vurls}{$vid}) || @{$self->{_vurls}{$vid}} == 0) {
|
if (!defined($self->{_vurls}{$vid}) || $self->{_vurls}{$vid}->@* == 0) {
|
||||||
my $res = $self->{_ua}
|
my $res = $self->{_ua}
|
||||||
->get("$self->{_murl}/dir/lookup?fileId=$fid&read=yes")
|
->get("$self->{_murl}/dir/lookup?fileId=$fid&read=yes")
|
||||||
->result;
|
->result;
|
||||||
|
|
||||||
$self->{_vurls}{$vid} = [
|
$self->{_vurls}{$vid} = [
|
||||||
map { $_->{publicUrl} } @{$res->json->{locations}}
|
map { $_->{publicUrl} } $res->json->{locations}->@*
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
my $url = sample(1, @{$self->{_vurls}{$vid}});
|
my $url = sample(1, $self->{_vurls}{$vid}->@*);
|
||||||
return undef unless defined $url;
|
return undef unless defined $url;
|
||||||
|
|
||||||
$url = "http://$url" if $url !~ m{^https?://};
|
$url = "http://$url" if $url !~ m{^https?://};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
% layout "main";
|
% layout "main";
|
||||||
|
|
||||||
<div class="flex-c-horizontal flex-c-wrap gallery">
|
<div class="flex-c-horizontal flex-c-wrap gallery">
|
||||||
% for my $m (@$media) {
|
% for my $m ($media->@*) {
|
||||||
<%= link_to $m->{media_link} => begin %>
|
<%= link_to $m->{media_link} => begin %>
|
||||||
<%= image $m->{media_src} %>
|
<%= image $m->{media_src} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
% layout "main";
|
% layout "main";
|
||||||
|
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
% for my $t (@$tags) {
|
% for my $t ($tags->@*) {
|
||||||
<%= link_to "$t->{name} ($t->{count})" => $t->{uri} %>
|
<%= link_to "$t->{name} ($t->{count})" => $t->{uri} %>
|
||||||
% }
|
% }
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user