backend: adapt to /media/tags/:media_id API change
This commit is contained in:
parent
945770eb1b
commit
1a2e86d666
@ -42,17 +42,23 @@ sub show ($self)
|
||||
|
||||
my $media_id = $self->stash("media_id");
|
||||
my $poorbooru_api = $self->config("poorbooru_api");
|
||||
my $res = $self->ua->get("$poorbooru_api/media/$media_id?page=$page")
|
||||
my $res = $self->ua->get("$poorbooru_api/media/$media_id")
|
||||
->result;
|
||||
|
||||
return $self->render(status => $res->code) if $res->is_error;
|
||||
|
||||
my $media = $res->json;
|
||||
$media->{download} = $self->seaweed->url_for($media->{download});
|
||||
|
||||
$res = $self->ua->get("$poorbooru_api/media/tags/$media_id?page=$page")
|
||||
->result;
|
||||
my $tags = $res->json->{tags};
|
||||
|
||||
return $self->render(status => $res->code) if $res->is_error;
|
||||
|
||||
return $self->render(
|
||||
template => "media",
|
||||
media => $media,
|
||||
tags => $tags,
|
||||
pager => { $self->pager_links($res->json->{pager}) },
|
||||
);
|
||||
};
|
||||
|
@ -14,11 +14,11 @@
|
||||
<dt>Content-Type</dt>
|
||||
<dd><%= $media->{content_type} %></dd>
|
||||
<dt>Tags</dt>
|
||||
% if ($media->{tags}->@* == 0) {
|
||||
% if ($tags->@* == 0) {
|
||||
<dd>None yet.</dd>
|
||||
% } else {
|
||||
<dd>
|
||||
% for my $tag ($media->{tags}->@*) {
|
||||
% for my $tag ($tags->@*) {
|
||||
<%= link_to $tag => url_for("tag_show", tag_id_or_name => $tag) %>
|
||||
% }
|
||||
</dd>
|
||||
|
Loading…
Reference in New Issue
Block a user