-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGcmdKeyword.pm
45 lines (35 loc) · 1.05 KB
/
GcmdKeyword.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
=head1 NAME
Tuba::GcmdKeyword : Controller class for gcmd keywords.
=cut
package Tuba::GcmdKeyword;
use Mojo::Base qw/Tuba::Controller/;
use Tuba::DB::Objects qw/-nicknames/;
sub list {
my $c = shift;
$c->stash(objects => GcmdKeywords->get_objects(with_objects => 'publications', page => $c->page, per_page => $c->per_page));
my $count = GcmdKeywords->get_objects_count;
$c->stash(extra_cols => [qw/label/]);
$c->set_pages($count);
$c->SUPER::list(@_);
}
sub show {
my $c = shift;
my $kw = $c->_this_object or $c->reply->not_found;
$c->stash(object => $kw);
$c->SUPER::show(@_);
}
sub children {
my $c = shift;
my $gcmd_keyword = $c->stash('gcmd_keyword');
my $obj = GcmdKeyword->new(
identifier => $gcmd_keyword,
)->load(speculative => 1) or return $c->reply->not_found;
my $keywords = $obj->gcmd_keywords;
$c->stash(objects => $keywords);
$c->stash(extra_cols => [qw/label/]);
$c->SUPER::list();
}
sub _guess_object_class {
return 'Tuba::DB::Object::GcmdKeyword';
}
1;